* [PATCH] iommu: simplify list initialization in iommu_create_device_direct_mappings()
@ 2025-12-09 7:15 Can Peng
2026-01-10 9:59 ` Jörg Rödel
2026-01-10 11:48 ` Markus Elfring
0 siblings, 2 replies; 3+ messages in thread
From: Can Peng @ 2025-12-09 7:15 UTC (permalink / raw)
To: joro, will, robin.murphy; +Cc: iommu, linux-kernel, Can Peng
Use LIST_HEAD() to declare and initialize the 'mappings' list head in
iommu_create_device_direct_mappings() instead of separate declaration and
INIT_LIST_HEAD(). This simplifies the code by combining declaration and
initialization into a single idiomatic form, improving readability without
changing functionality.
Signed-off-by: Can Peng <pengcan@kylinos.cn>
---
drivers/iommu/iommu.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 2ca990dfbb88..77d723f43546 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1173,12 +1173,11 @@ static int iommu_create_device_direct_mappings(struct iommu_domain *domain,
struct device *dev)
{
struct iommu_resv_region *entry;
- struct list_head mappings;
+ LIST_HEAD(mappings);
unsigned long pg_size;
int ret = 0;
pg_size = domain->pgsize_bitmap ? 1UL << __ffs(domain->pgsize_bitmap) : 0;
- INIT_LIST_HEAD(&mappings);
if (WARN_ON_ONCE(iommu_is_dma_domain(domain) && !pg_size))
return -EINVAL;
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] iommu: simplify list initialization in iommu_create_device_direct_mappings()
2025-12-09 7:15 [PATCH] iommu: simplify list initialization in iommu_create_device_direct_mappings() Can Peng
@ 2026-01-10 9:59 ` Jörg Rödel
2026-01-10 11:48 ` Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: Jörg Rödel @ 2026-01-10 9:59 UTC (permalink / raw)
To: Can Peng; +Cc: will, robin.murphy, iommu, linux-kernel
On Tue, Dec 09, 2025 at 03:15:13PM +0800, Can Peng wrote:
> Use LIST_HEAD() to declare and initialize the 'mappings' list head in
> iommu_create_device_direct_mappings() instead of separate declaration and
> INIT_LIST_HEAD(). This simplifies the code by combining declaration and
> initialization into a single idiomatic form, improving readability without
> changing functionality.
>
> Signed-off-by: Can Peng <pengcan@kylinos.cn>
> ---
> drivers/iommu/iommu.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu: simplify list initialization in iommu_create_device_direct_mappings()
2025-12-09 7:15 [PATCH] iommu: simplify list initialization in iommu_create_device_direct_mappings() Can Peng
2026-01-10 9:59 ` Jörg Rödel
@ 2026-01-10 11:48 ` Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2026-01-10 11:48 UTC (permalink / raw)
To: Can Peng, iommu, Jörg Rödel, Robin Murphy, Will Deacon; +Cc: LKML
> Use LIST_HEAD() to declare and initialize the 'mappings' list head in
> iommu_create_device_direct_mappings() instead of separate declaration and
> INIT_LIST_HEAD(). This simplifies the code by combining declaration and
> initialization into a single idiomatic form, improving readability without
> changing functionality.
…
How do you think about to repeat the mentioned transformation approach for the implementation
of the function “iommu_group_show_resv_regions”?
https://elixir.bootlin.com/linux/v6.19-rc4/source/drivers/iommu/iommu.c#L949-L969
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-10 11:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-09 7:15 [PATCH] iommu: simplify list initialization in iommu_create_device_direct_mappings() Can Peng
2026-01-10 9:59 ` Jörg Rödel
2026-01-10 11:48 ` Markus Elfring
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®