From: Robin Murphy <robin.murphy@arm.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Yong Wu <yong.wu@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>
Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 3/3] iommu: mtk_iommu_v1: Simplify by dropping local 'mtk_mapping' variable
Date: Tue, 24 Jun 2025 18:36:29 +0100 [thread overview]
Message-ID: <33672077-77b9-476c-9565-b78aae2a38de@arm.com> (raw)
In-Reply-To: <20250624-syscon-phandle-args-iommu-v3-3-1a36487d69b8@linaro.org>
On 2025-06-24 1:22 pm, Krzysztof Kozlowski wrote:
> Storing 'data->mapping' in local variable in
> mtk_iommu_v1_probe_finalize() does not make the code easier to read.
> Use the 'data->mapping' directly.
>
> ARM64 W=1 builds also complain with:
>
> mtk_iommu_v1.c:512:28: error: variable 'mtk_mapping' set but not used [-Werror,-Wunused-but-set-variable]
>
> but this is not being fixed here and 'data' still won't be used in such
> compile test.
Sorry, I guess that's on me for doing the COMPILE_TEST stubs the lazy
way... TBH I'm still not sure this driver hasn't completely bitrotted,
but if we're touching it at all we should probably actually fix the
warning, e.g.:
-#define arm_iommu_attach_device(...) -ENODEV
+#define arm_iommu_attach_device(d, m) ((void)m, -ENODEV)
or perhaps make it a less lazy static inline.
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>
> ---
>
> Old warning is changed now to:
>
> error: variable 'data' set but not used [-Werror,-Wunused-but-set-variable]
> ---
> drivers/iommu/mtk_iommu_v1.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> index 66824982e05fbfdda224276ad41b90f9d5f9ca4e..bbe3e9d901c69ac6405d9549a4481fc80f1adb80 100644
> --- a/drivers/iommu/mtk_iommu_v1.c
> +++ b/drivers/iommu/mtk_iommu_v1.c
> @@ -509,14 +509,12 @@ static struct iommu_device *mtk_iommu_v1_probe_device(struct device *dev)
>
> static void mtk_iommu_v1_probe_finalize(struct device *dev)
> {
> - struct dma_iommu_mapping *mtk_mapping;
> struct mtk_iommu_v1_data *data;
> int err;
>
> data = dev_iommu_priv_get(dev);
And for the sake of a readability cleanup you may as well fold this into
the declaration line as well. And then maybe also whack a __maybe_unused
on it, for even less effort than the first silly thing I thought of
above... :)
Thanks,
Robin.
> - mtk_mapping = data->mapping;
>
> - err = arm_iommu_attach_device(dev, mtk_mapping);
> + err = arm_iommu_attach_device(dev, data->mapping);
> if (err)
> dev_err(dev, "Can't create IOMMU mapping - DMA-OPS will not work\n");
> }
>
next prev parent reply other threads:[~2025-06-24 17:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-24 12:22 [PATCH v3 0/3] iommu: omap: Simplify few things Krzysztof Kozlowski
2025-06-24 12:22 ` [PATCH v3 1/3] iommu: omap: Drop redundant check if ti,syscon-mmuconfig exists Krzysztof Kozlowski
2025-06-24 17:15 ` Robin Murphy
2025-06-24 12:22 ` [PATCH v3 2/3] iommu: omap: Use syscon_regmap_lookup_by_phandle_args Krzysztof Kozlowski
2025-06-24 12:22 ` [PATCH v3 3/3] iommu: mtk_iommu_v1: Simplify by dropping local 'mtk_mapping' variable Krzysztof Kozlowski
2025-06-24 17:36 ` Robin Murphy [this message]
2025-06-27 7:22 ` [PATCH v3 0/3] iommu: omap: Simplify few things Joerg Roedel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=33672077-77b9-476c-9565-b78aae2a38de@arm.com \
--to=robin.murphy@arm.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=will@kernel.org \
--cc=yong.wu@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®