* [PATCH] iommu/mediatek-v1: Tidy up probe_finalize
@ 2025-06-27 15:07 Robin Murphy
2025-06-28 8:09 ` Yong Wu (吴勇)
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Robin Murphy @ 2025-06-27 15:07 UTC (permalink / raw)
To: joro, will
Cc: iommu, linux-arm-kernel, linux-mediatek, yong.wu,
Krzysztof Kozlowski
Krzysztof points out that although the driver now supports COMPILE_TEST
for other architectures, it does not build cleanly with W=1 where the
stubbed-out ARM API can lead to an unused variable warning.
Since this is effectively the correct intent of the code in such cases,
mark it as __maybe_unused, tidying up some cruft in the process.
Reported-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
Since I'd already got as far as thinking this through, I figure I may
as well save Krzysztof the trouble of rewriting it :)
drivers/iommu/mtk_iommu_v1.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 66824982e05f..2fc18e194e19 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -509,14 +509,10 @@ 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;
+ __maybe_unused struct mtk_iommu_v1_data *data = dev_iommu_priv_get(dev);
int err;
- data = dev_iommu_priv_get(dev);
- 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");
}
--
2.39.2.101.g768bb238c484.dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iommu/mediatek-v1: Tidy up probe_finalize
2025-06-27 15:07 [PATCH] iommu/mediatek-v1: Tidy up probe_finalize Robin Murphy
@ 2025-06-28 8:09 ` Yong Wu (吴勇)
2025-06-28 8:36 ` Krzysztof Kozlowski
2025-07-04 8:33 ` Joerg Roedel
2 siblings, 0 replies; 4+ messages in thread
From: Yong Wu (吴勇) @ 2025-06-28 8:09 UTC (permalink / raw)
To: robin.murphy@arm.com, joro@8bytes.org, will@kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
krzysztof.kozlowski@linaro.org, iommu@lists.linux.dev
On Fri, 2025-06-27 at 16:07 +0100, Robin Murphy wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> Krzysztof points out that although the driver now supports
> COMPILE_TEST
> for other architectures, it does not build cleanly with W=1 where the
> stubbed-out ARM API can lead to an unused variable warning.
>
> Since this is effectively the correct intent of the code in such
> cases,
> mark it as __maybe_unused, tidying up some cruft in the process.
>
> Reported-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Yong Wu <yong.wu@mediatek.com>
> ---
>
> Since I'd already got as far as thinking this through, I figure I may
> as well save Krzysztof the trouble of rewriting it :)
>
> drivers/iommu/mtk_iommu_v1.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iommu/mtk_iommu_v1.c
> b/drivers/iommu/mtk_iommu_v1.c
> index 66824982e05f..2fc18e194e19 100644
> --- a/drivers/iommu/mtk_iommu_v1.c
> +++ b/drivers/iommu/mtk_iommu_v1.c
> @@ -509,14 +509,10 @@ 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;
> + __maybe_unused struct mtk_iommu_v1_data *data =
> dev_iommu_priv_get(dev);
> int err;
>
> - data = dev_iommu_priv_get(dev);
> - 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");
> }
> --
> 2.39.2.101.g768bb238c484.dirty
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iommu/mediatek-v1: Tidy up probe_finalize
2025-06-27 15:07 [PATCH] iommu/mediatek-v1: Tidy up probe_finalize Robin Murphy
2025-06-28 8:09 ` Yong Wu (吴勇)
@ 2025-06-28 8:36 ` Krzysztof Kozlowski
2025-07-04 8:33 ` Joerg Roedel
2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2025-06-28 8:36 UTC (permalink / raw)
To: Robin Murphy, joro, will; +Cc: iommu, linux-arm-kernel, linux-mediatek, yong.wu
On 27/06/2025 17:07, Robin Murphy wrote:
> Krzysztof points out that although the driver now supports COMPILE_TEST
> for other architectures, it does not build cleanly with W=1 where the
> stubbed-out ARM API can lead to an unused variable warning.
>
> Since this is effectively the correct intent of the code in such cases,
> mark it as __maybe_unused, tidying up some cruft in the process.
>
> Reported-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>
> Since I'd already got as far as thinking this through, I figure I may
> as well save Krzysztof the trouble of rewriting it :)
Sure, thanks!
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iommu/mediatek-v1: Tidy up probe_finalize
2025-06-27 15:07 [PATCH] iommu/mediatek-v1: Tidy up probe_finalize Robin Murphy
2025-06-28 8:09 ` Yong Wu (吴勇)
2025-06-28 8:36 ` Krzysztof Kozlowski
@ 2025-07-04 8:33 ` Joerg Roedel
2 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2025-07-04 8:33 UTC (permalink / raw)
To: Robin Murphy
Cc: will, iommu, linux-arm-kernel, linux-mediatek, yong.wu,
Krzysztof Kozlowski
On Fri, Jun 27, 2025 at 04:07:10PM +0100, Robin Murphy wrote:
> drivers/iommu/mtk_iommu_v1.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
Applied, thanks Robin.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-07-04 11:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27 15:07 [PATCH] iommu/mediatek-v1: Tidy up probe_finalize Robin Murphy
2025-06-28 8:09 ` Yong Wu (吴勇)
2025-06-28 8:36 ` Krzysztof Kozlowski
2025-07-04 8:33 ` Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).