From: Jason Gunthorpe <jgg@nvidia.com>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Robin Murphy <robin.murphy@arm.com>,
Christoph Hellwig <hch@infradead.org>,
Kevin Tian <kevin.tian@intel.com>, Will Deacon <will@kernel.org>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] iommu: Use sysfs_emit() for sysfs show
Date: Wed, 22 Mar 2023 09:36:45 -0300 [thread overview]
Message-ID: <ZBr2XZr25jwAp3kO@nvidia.com> (raw)
In-Reply-To: <20230322123421.278852-1-baolu.lu@linux.intel.com>
On Wed, Mar 22, 2023 at 08:34:21PM +0800, Lu Baolu wrote:
> Use sysfs_emit() instead of the sprintf() for sysfs entries. sysfs_emit()
> knows the maximum of the temporary buffer used for outputting sysfs
> content and avoids overrunning the buffer length.
>
> Prefer 'long long' over 'long long int' as suggested by checkpatch.pl.
>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
> drivers/iommu/amd/init.c | 4 ++--
> drivers/iommu/intel/iommu.c | 17 +++++++++--------
> drivers/iommu/iommu.c | 31 +++++++++++++++----------------
> 3 files changed, 26 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
> index 19a46b9f7357..a98202018140 100644
> --- a/drivers/iommu/amd/init.c
> +++ b/drivers/iommu/amd/init.c
> @@ -1941,7 +1941,7 @@ static ssize_t amd_iommu_show_cap(struct device *dev,
> char *buf)
> {
> struct amd_iommu *iommu = dev_to_amd_iommu(dev);
> - return sprintf(buf, "%x\n", iommu->cap);
> + return sysfs_emit(buf, "%x\n", iommu->cap);
> }
It would be nice to add the missing whitespace after declarations here
and other places to follow the coding convention
The conversions look OK though
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
next prev parent reply other threads:[~2023-03-22 12:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 12:34 [PATCH 1/1] iommu: Use sysfs_emit() for sysfs show Lu Baolu
2023-03-22 12:36 ` Jason Gunthorpe [this message]
2023-03-22 14:47 ` 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=ZBr2XZr25jwAp3kO@nvidia.com \
--to=jgg@nvidia.com \
--cc=baolu.lu@linux.intel.com \
--cc=hch@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=suravee.suthikulpanit@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