From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
Cc: jean-baptiste.maneyrol@tdk.com, 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] iio: imu: inv_mpu6050: Replace scnprintf with sysfs_emit
Date: Tue, 1 Jul 2025 16:54:47 +0300 [thread overview]
Message-ID: <aGPopyM1KbbDS4IH@smile.fi.intel.com> (raw)
In-Reply-To: <20250701113945.6865-1-chelsyratnawat2001@gmail.com>
On Tue, Jul 01, 2025 at 04:39:45AM -0700, Chelsy Ratnawat wrote:
> Documentation/filesystems/sysfs.rst mentions that show() should only
> use sysfs_emit() or sysfs_emit_at() when formating the value to be
> returned to user space. So replace scnprintf() with sysfs_emit().
...
> case ATTR_ACCL_MATRIX:
> m = st->plat_data.orientation;
>
> - return scnprintf(buf, PAGE_SIZE,
> + return sysfs_emit(buf,
> "%d, %d, %d; %d, %d, %d; %d, %d, %d\n",
Now this fits one line
return sysfs_emit(buf, "%d, %d, %d; %d, %d, %d; %d, %d, %d\n",
> m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8]);
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2025-07-01 13:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 11:39 [PATCH] iio: imu: inv_mpu6050: Replace scnprintf with sysfs_emit Chelsy Ratnawat
2025-07-01 13:54 ` 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=aGPopyM1KbbDS4IH@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=chelsyratnawat2001@gmail.com \
--cc=dlechner@baylibre.com \
--cc=jean-baptiste.maneyrol@tdk.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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 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.