From: Markus Elfring <Markus.Elfring@web.de>
To: "Can Peng" <pengcan@kylinos.cn>,
iommu@lists.linux.dev, "Jörg Rödel" <joro@8bytes.org>,
"Robin Murphy" <robin.murphy@arm.com>,
"Vasant Hegde" <vasant.hegde@amd.com>,
"Will Deacon" <will@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v4] iommu: simplify list initialization across the iommu subsystem
Date: Fri, 16 Jan 2026 09:02:30 +0100 [thread overview]
Message-ID: <2067dfae-5399-434e-afc3-ca6a5816f78f@web.de> (raw)
In-Reply-To: <20260116065554.830579-1-pengcan@kylinos.cn>
> Replace separate list head declarations and INIT_LIST_HEAD() calls with
> the combined LIST_HEAD() macro throughout the iommu directory.
> Using LIST_HEAD() merges declaration and initialization into a single
> statement, improving code readability and reducing boilerplate without
> altering any functionality.
…
> Markus Elfring suggested using a more concise summary and
> recommended the use of Coccinelle for this kind of transformation.
Some development tools can help to achieve desirable changes in more convenient ways
and that possible adjustments would become more complete eventually.
…
> +++ b/drivers/iommu/iommu.c
> @@ -932,7 +932,7 @@ int iommu_get_group_resv_regions(struct iommu_group *group,
>
> mutex_lock(&group->mutex);
> for_each_group_device(group, device) {
> - struct list_head dev_resv_regions;
> + LIST_HEAD(dev_resv_regions);
>
> /*
> * Non-API groups still expose reserved_regions in sysfs,
> @@ -941,7 +941,6 @@ int iommu_get_group_resv_regions(struct iommu_group *group,
> if (!dev_has_iommu(device->dev))
> break;
>
> - INIT_LIST_HEAD(&dev_resv_regions);
> iommu_get_resv_regions(device->dev, &dev_resv_regions);
> ret = iommu_insert_device_resv_regions(&dev_resv_regions, head);
> iommu_put_resv_regions(device->dev, &dev_resv_regions);
…
> +++ b/drivers/iommu/iommufd/eventq.c
> @@ -21,12 +21,11 @@ void iommufd_auto_response_faults(struct iommufd_hw_pagetable *hwpt,
> {
> struct iommufd_fault *fault = hwpt->fault;
> struct iopf_group *group, *next;
> - struct list_head free_list;
> + LIST_HEAD(free_list);
> unsigned long index;
>
> if (!fault || !handle)
> return;
> - INIT_LIST_HEAD(&free_list);
>
> mutex_lock(&fault->mutex);
…
Does anything hinder to apply LIST_HEAD() calls at other source code positions?
May variable scopes be reduced for more use cases?
Regards,
Markus
prev parent reply other threads:[~2026-01-16 8:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 6:55 Can Peng
2026-01-16 8:02 ` Markus Elfring [this message]
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=2067dfae-5399-434e-afc3-ca6a5816f78f@web.de \
--to=markus.elfring@web.de \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pengcan@kylinos.cn \
--cc=robin.murphy@arm.com \
--cc=vasant.hegde@amd.com \
--cc=will@kernel.org \
/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®