public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: iio: adc: ad7816: use sysfs_streq() instead of strcmp()
@ 2026-03-30  7:48 Md. Mahmudul Hasan Mabud
  2026-03-30 10:09 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Md. Mahmudul Hasan Mabud @ 2026-03-30  7:48 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23, gregkh
  Cc: dlechner, nuno.sa, andy, linux-iio, linux-staging, linux-kernel,
	Md. Mahmudul Hasan Mabud

Use sysfs_streq() to compare the input buffer with the mode strings.
This is more robust as it ignores trailing newlines, making it safer
for sysfs store functions.

Signed-off-by: Md. Mahmudul Hasan Mabud <mdmahmudulhasan1511@gmail.com>
---
 drivers/staging/iio/adc/ad7816.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 172acf135..c2544415e 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -136,7 +136,7 @@ static ssize_t ad7816_store_mode(struct device *dev,
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7816_chip_info *chip = iio_priv(indio_dev);
 
-	if (strcmp(buf, "full") == 0) {
+	if (sysfs_streq(buf, "full")) {
 		gpiod_set_value(chip->rdwr_pin, 1);
 		chip->mode = AD7816_FULL;
 	} else {
-- 
2.34.1


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

end of thread, other threads:[~2026-04-12 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30  7:48 [PATCH] staging: iio: adc: ad7816: use sysfs_streq() instead of strcmp() Md. Mahmudul Hasan Mabud
2026-03-30 10:09 ` Andy Shevchenko
2026-04-12 18:42   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox