mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Maxwell Doose <m32285159@gmail.com>
Cc: ak@it-klinger.de, jic23@kernel.org, dlechner@baylibre.com,
	nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] iio: proximity: srf08: replace sprintf() with sysfs_emit()
Date: Wed, 22 Apr 2026 09:59:47 +0300	[thread overview]
Message-ID: <aehx448D3sA8vSbM@ashevche-desk.local> (raw)
In-Reply-To: <20260420230813.25985-1-m32285159@gmail.com>

On Mon, Apr 20, 2026 at 06:08:13PM -0500, Maxwell Doose wrote:
> This patch replaces sprintf() function calls with sysfs_emit() and
> sysfs_emit_at(). While the current code is fine, sysfs_emit() is
> preferred over sprintf(), and will help modernize the driver.

...

> static ssize_t srf08_show_range_mm(struct device *dev,

>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	struct srf08_data *data = iio_priv(indio_dev);
>  
> -	return sprintf(buf, "%d.%03d\n", data->range_mm / 1000,
> -						data->range_mm % 1000);
> +	return sysfs_emit(buf, "%d.%03d\n",
> +			data->range_mm / 1000, data->range_mm % 1000);

Wrong indentation.

>  }

...

>  	for (i = 0; i < data->chip_info->num_sensitivity_avail; i++)
>  		if (data->chip_info->sensitivity_avail[i])
> -			len += sprintf(buf + len, "%d ",
> +			len += sysfs_emit_at(buf, len, "%d ",
>  				data->chip_info->sensitivity_avail[i]);

Ditto.

...

The rest is okay.

-- 
With Best Regards,
Andy Shevchenko



      parent reply	other threads:[~2026-04-22  6:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 23:08 Maxwell Doose
2026-04-21 14:42 ` Jonathan Cameron
2026-04-21 16:38   ` Maxwell Doose
2026-04-22  6:59 ` Andy Shevchenko [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=aehx448D3sA8vSbM@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=ak@it-klinger.de \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m32285159@gmail.com \
    --cc=nuno.sa@analog.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

all inboxes | Powered by JetHome®