All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: common: scmi_iio: use sysfs_emit() to instead of   scnprintf()
@ 2022-12-01  3:56 ye.xingchen
  2022-12-04 15:49 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: ye.xingchen @ 2022-12-01  3:56 UTC (permalink / raw)
  To: jbhayana; +Cc: jic23, lars, linux-iio, linux-kernel

From: ye xingchen <ye.xingchen@zte.com.cn>

Replace the open-code with sysfs_emit() to simplify the code.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 drivers/iio/common/scmi_sensors/scmi_iio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/common/scmi_sensors/scmi_iio.c b/drivers/iio/common/scmi_sensors/scmi_iio.c
index d92f7f651f7b..0c2caf3570db 100644
--- a/drivers/iio/common/scmi_sensors/scmi_iio.c
+++ b/drivers/iio/common/scmi_sensors/scmi_iio.c
@@ -400,12 +400,12 @@ static ssize_t scmi_iio_get_raw_available(struct iio_dev *iio_dev,
 			rem = do_div(resolution,
 				     int_pow(10, abs(exponent))
 				     );
-			len = scnprintf(buf, PAGE_SIZE,
+			len = sysfs_emit(buf,
 					"[%lld %llu.%llu %lld]\n", min_range,
 					resolution, rem, max_range);
 		} else {
 			resolution = resolution * int_pow(10, exponent);
-			len = scnprintf(buf, PAGE_SIZE, "[%lld %llu %lld]\n",
+			len = sysfs_emit(buf, "[%lld %llu %lld]\n",
 					min_range, resolution, max_range);
 		}
 	}
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: common: scmi_iio: use sysfs_emit() to instead of  scnprintf()
  2022-12-01  3:56 [PATCH] iio: common: scmi_iio: use sysfs_emit() to instead of scnprintf() ye.xingchen
@ 2022-12-04 15:49 ` Jonathan Cameron
  2022-12-05 10:39   ` Sudeep Holla
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2022-12-04 15:49 UTC (permalink / raw)
  To: ye.xingchen
  Cc: jbhayana, lars, linux-iio, linux-kernel, Sudeep Holla, Cristian Marussi

On Thu, 1 Dec 2022 11:56:31 +0800 (CST)
<ye.xingchen@zte.com.cn> wrote:

> From: ye xingchen <ye.xingchen@zte.com.cn>
> 
> Replace the open-code with sysfs_emit() to simplify the code.
> 
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Applied. Cc'd scmi people as well just in case they are interested.


> ---
>  drivers/iio/common/scmi_sensors/scmi_iio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/common/scmi_sensors/scmi_iio.c b/drivers/iio/common/scmi_sensors/scmi_iio.c
> index d92f7f651f7b..0c2caf3570db 100644
> --- a/drivers/iio/common/scmi_sensors/scmi_iio.c
> +++ b/drivers/iio/common/scmi_sensors/scmi_iio.c
> @@ -400,12 +400,12 @@ static ssize_t scmi_iio_get_raw_available(struct iio_dev *iio_dev,
>  			rem = do_div(resolution,
>  				     int_pow(10, abs(exponent))
>  				     );
> -			len = scnprintf(buf, PAGE_SIZE,
> +			len = sysfs_emit(buf,
>  					"[%lld %llu.%llu %lld]\n", min_range,
>  					resolution, rem, max_range);
>  		} else {
>  			resolution = resolution * int_pow(10, exponent);
> -			len = scnprintf(buf, PAGE_SIZE, "[%lld %llu %lld]\n",
> +			len = sysfs_emit(buf, "[%lld %llu %lld]\n",
>  					min_range, resolution, max_range);
>  		}
>  	}


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: common: scmi_iio: use sysfs_emit() to instead of scnprintf()
  2022-12-04 15:49 ` Jonathan Cameron
@ 2022-12-05 10:39   ` Sudeep Holla
  0 siblings, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2022-12-05 10:39 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: ye.xingchen, jbhayana, lars, Sudeep Holla, linux-iio,
	linux-kernel, Cristian Marussi

On Sun, Dec 04, 2022 at 03:49:06PM +0000, Jonathan Cameron wrote:
> On Thu, 1 Dec 2022 11:56:31 +0800 (CST)
> <ye.xingchen@zte.com.cn> wrote:
> 
> > From: ye xingchen <ye.xingchen@zte.com.cn>
> > 
> > Replace the open-code with sysfs_emit() to simplify the code.
> > 
> > Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
> Applied. Cc'd scmi people as well just in case they are interested.

Thanks Ye for the patch and Jonathan for Cc-in and applying.

-- 
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-05 10:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-01  3:56 [PATCH] iio: common: scmi_iio: use sysfs_emit() to instead of scnprintf() ye.xingchen
2022-12-04 15:49 ` Jonathan Cameron
2022-12-05 10:39   ` Sudeep Holla

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.