linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: Vishal Verma <vishal.l.verma@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
	Dave Jiang <dave.jiang@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Oscar Salvador <osalvador@suse.de>,
	linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev,
	linux-cxl@vger.kernel.org, David Hildenbrand <david@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Huang Ying <ying.huang@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthew Wilcox <willy@infradead.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH v7 2/5] dax/bus.c: replace several sprintf() with sysfs_emit()
Date: Fri, 26 Jan 2024 13:14:42 -0800	[thread overview]
Message-ID: <ZbQgwt/Wc3uWvXXK@aschofie-mobl2> (raw)
In-Reply-To: <20240124-vv-dax_abi-v7-2-20d16cb8d23d@intel.com>

On Wed, Jan 24, 2024 at 12:03:47PM -0800, Vishal Verma wrote:
> There were several places where drivers/dax/bus.c uses 'sprintf' to
> print sysfs data. Since a sysfs_emit() helper is available specifically
> for this purpose, replace all the sprintf() usage for sysfs with
> sysfs_emit() in this file.
>

Reviewed-by: Alison Schofield <alison.schofield@intel.com>


> Cc: Dan Williams <dan.j.williams@intel.com>
> Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
>  drivers/dax/bus.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
> index cb148f74ceda..0fd948a4443e 100644
> --- a/drivers/dax/bus.c
> +++ b/drivers/dax/bus.c
> @@ -269,7 +269,7 @@ static ssize_t id_show(struct device *dev,
>  {
>  	struct dax_region *dax_region = dev_get_drvdata(dev);
>  
> -	return sprintf(buf, "%d\n", dax_region->id);
> +	return sysfs_emit(buf, "%d\n", dax_region->id);
>  }
>  static DEVICE_ATTR_RO(id);
>  
> @@ -278,8 +278,8 @@ static ssize_t region_size_show(struct device *dev,
>  {
>  	struct dax_region *dax_region = dev_get_drvdata(dev);
>  
> -	return sprintf(buf, "%llu\n", (unsigned long long)
> -			resource_size(&dax_region->res));
> +	return sysfs_emit(buf, "%llu\n",
> +			  (unsigned long long)resource_size(&dax_region->res));
>  }
>  static struct device_attribute dev_attr_region_size = __ATTR(size, 0444,
>  		region_size_show, NULL);
> @@ -289,7 +289,7 @@ static ssize_t region_align_show(struct device *dev,
>  {
>  	struct dax_region *dax_region = dev_get_drvdata(dev);
>  
> -	return sprintf(buf, "%u\n", dax_region->align);
> +	return sysfs_emit(buf, "%u\n", dax_region->align);
>  }
>  static struct device_attribute dev_attr_region_align =
>  		__ATTR(align, 0400, region_align_show, NULL);
> @@ -322,7 +322,7 @@ static ssize_t available_size_show(struct device *dev,
>  	size = dax_region_avail_size(dax_region);
>  	up_read(&dax_region_rwsem);
>  
> -	return sprintf(buf, "%llu\n", size);
> +	return sysfs_emit(buf, "%llu\n", size);
>  }
>  static DEVICE_ATTR_RO(available_size);
>  
> @@ -340,7 +340,7 @@ static ssize_t seed_show(struct device *dev,
>  	if (rc)
>  		return rc;
>  	seed = dax_region->seed;
> -	rc = sprintf(buf, "%s\n", seed ? dev_name(seed) : "");
> +	rc = sysfs_emit(buf, "%s\n", seed ? dev_name(seed) : "");
>  	up_read(&dax_region_rwsem);
>  
>  	return rc;
> @@ -361,7 +361,7 @@ static ssize_t create_show(struct device *dev,
>  	if (rc)
>  		return rc;
>  	youngest = dax_region->youngest;
> -	rc = sprintf(buf, "%s\n", youngest ? dev_name(youngest) : "");
> +	rc = sysfs_emit(buf, "%s\n", youngest ? dev_name(youngest) : "");
>  	up_read(&dax_region_rwsem);
>  
>  	return rc;
> @@ -763,7 +763,7 @@ static ssize_t start_show(struct device *dev,
>  	dax_range = get_dax_range(dev);
>  	if (!dax_range)
>  		return -ENXIO;
> -	rc = sprintf(buf, "%#llx\n", dax_range->range.start);
> +	rc = sysfs_emit(buf, "%#llx\n", dax_range->range.start);
>  	put_dax_range();
>  
>  	return rc;
> @@ -779,7 +779,7 @@ static ssize_t end_show(struct device *dev,
>  	dax_range = get_dax_range(dev);
>  	if (!dax_range)
>  		return -ENXIO;
> -	rc = sprintf(buf, "%#llx\n", dax_range->range.end);
> +	rc = sysfs_emit(buf, "%#llx\n", dax_range->range.end);
>  	put_dax_range();
>  
>  	return rc;
> @@ -795,7 +795,7 @@ static ssize_t pgoff_show(struct device *dev,
>  	dax_range = get_dax_range(dev);
>  	if (!dax_range)
>  		return -ENXIO;
> -	rc = sprintf(buf, "%#lx\n", dax_range->pgoff);
> +	rc = sysfs_emit(buf, "%#lx\n", dax_range->pgoff);
>  	put_dax_range();
>  
>  	return rc;
> @@ -969,7 +969,7 @@ static ssize_t size_show(struct device *dev,
>  	size = dev_dax_size(dev_dax);
>  	up_write(&dax_dev_rwsem);
>  
> -	return sprintf(buf, "%llu\n", size);
> +	return sysfs_emit(buf, "%llu\n", size);
>  }
>  
>  static bool alloc_is_aligned(struct dev_dax *dev_dax, resource_size_t size)
> @@ -1233,7 +1233,7 @@ static ssize_t align_show(struct device *dev,
>  {
>  	struct dev_dax *dev_dax = to_dev_dax(dev);
>  
> -	return sprintf(buf, "%d\n", dev_dax->align);
> +	return sysfs_emit(buf, "%d\n", dev_dax->align);
>  }
>  
>  static ssize_t dev_dax_validate_align(struct dev_dax *dev_dax)
> @@ -1311,7 +1311,7 @@ static ssize_t target_node_show(struct device *dev,
>  {
>  	struct dev_dax *dev_dax = to_dev_dax(dev);
>  
> -	return sprintf(buf, "%d\n", dev_dax_target_node(dev_dax));
> +	return sysfs_emit(buf, "%d\n", dev_dax_target_node(dev_dax));
>  }
>  static DEVICE_ATTR_RO(target_node);
>  
> @@ -1327,7 +1327,7 @@ static ssize_t resource_show(struct device *dev,
>  	else
>  		start = dev_dax->ranges[0].range.start;
>  
> -	return sprintf(buf, "%#llx\n", start);
> +	return sysfs_emit(buf, "%#llx\n", start);
>  }
>  static DEVICE_ATTR(resource, 0400, resource_show, NULL);
>  
> @@ -1338,14 +1338,14 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
>  	 * We only ever expect to handle device-dax instances, i.e. the
>  	 * @type argument to MODULE_ALIAS_DAX_DEVICE() is always zero
>  	 */
> -	return sprintf(buf, DAX_DEVICE_MODALIAS_FMT "\n", 0);
> +	return sysfs_emit(buf, DAX_DEVICE_MODALIAS_FMT "\n", 0);
>  }
>  static DEVICE_ATTR_RO(modalias);
>  
>  static ssize_t numa_node_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
> -	return sprintf(buf, "%d\n", dev_to_node(dev));
> +	return sysfs_emit(buf, "%d\n", dev_to_node(dev));
>  }
>  static DEVICE_ATTR_RO(numa_node);
>  
> 
> -- 
> 2.43.0
> 
> 


  reply	other threads:[~2024-01-26 21:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 20:03 [PATCH v7 0/5] Add DAX ABI for memmap_on_memory Vishal Verma
2024-01-24 20:03 ` [PATCH v7 1/5] dax/bus.c: replace driver-core lock usage by a local rwsem Vishal Verma
2024-01-26 21:12   ` Alison Schofield
2024-03-12 20:07   ` Dan Williams
2024-03-12 20:20     ` Verma, Vishal L
2024-03-12 20:22       ` Andrew Morton
2024-01-24 20:03 ` [PATCH v7 2/5] dax/bus.c: replace several sprintf() with sysfs_emit() Vishal Verma
2024-01-26 21:14   ` Alison Schofield [this message]
2024-01-24 20:03 ` [PATCH v7 3/5] Documentatiion/ABI: Add ABI documentation for sys-bus-dax Vishal Verma
2024-01-24 20:03 ` [PATCH v7 4/5] mm/memory_hotplug: export mhp_supports_memmap_on_memory() Vishal Verma
2024-01-24 20:03 ` [PATCH v7 5/5] dax: add a sysfs knob to control memmap_on_memory behavior Vishal Verma
2024-01-26 21:40   ` Alison Schofield
2024-01-26  1:29 ` [PATCH v7 0/5] Add DAX ABI for memmap_on_memory Andrew Morton

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=ZbQgwt/Wc3uWvXXK@aschofie-mobl2 \
    --to=alison.schofield@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave.jiang@intel.com \
    --cc=david@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=osalvador@suse.de \
    --cc=vishal.l.verma@intel.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.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;
as well as URLs for NNTP newsgroup(s).