* [PATCH v4 0/4] staging: iio: adc: ad7816: code cleanups and modernization
@ 2026-03-31 7:24 Md. Mahmudul Hasan Mabud
2026-03-31 7:24 ` [PATCH v4 1/4] staging: iio: adc: ad7816: redefine mode constants to start from 0 Md. Mahmudul Hasan Mabud
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Md. Mahmudul Hasan Mabud @ 2026-03-31 7:24 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
Greg Kroah-Hartman
Cc: Andy Shevchenko, David Lechner, Nuno Sá, linux-iio,
linux-staging, linux-kernel, Md. Mahmudul Hasan Mabud
This series addresses feedback from Andy Shevchenko to modernize and clean
up the ad7816 driver.
Changes in v4:
- Added a blank line after the AD7816_FULL and AD7816_PD definitions to
improve code readability, as requested by Andy Shevchenko.
Changes in v3:
- Added missing Signed-off-by tags and detailed patch descriptions to
all commits as requested by the automated patch-bot.
- No functional changes since v2.
Changes in v2:
- Renamed sysfs callback functions (e.g., ad7816_show_mode to mode_show)
to satisfy the requirements of modern IIO attribute macros.
- Fixed usage of sysfs_match_string() by removing the unnecessary
ARRAY_SIZE parameter.
- Fixed vertical alignment of function parameters to match open parenthesis.
- Replaced sprintf() with sysfs_emit() across all show attributes.
Md. Mahmudul Hasan Mabud (4):
staging: iio: adc: ad7816: redefine mode constants to start from 0
staging: iio: adc: ad7816: use sysfs_match_string() for mode selection
staging: iio: adc: ad7816: replace sprintf() with sysfs_emit()
staging: iio: adc: ad7816: use modern IIO attribute macros
drivers/staging/iio/adc/ad7816.c | 112 +++++++++++++++----------------
1 file changed, 54 insertions(+), 58 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v4 1/4] staging: iio: adc: ad7816: redefine mode constants to start from 0
2026-03-31 7:24 [PATCH v4 0/4] staging: iio: adc: ad7816: code cleanups and modernization Md. Mahmudul Hasan Mabud
@ 2026-03-31 7:24 ` Md. Mahmudul Hasan Mabud
2026-04-12 18:45 ` Jonathan Cameron
2026-04-12 18:46 ` Jonathan Cameron
2026-03-31 7:24 ` [PATCH v4 2/4] staging: iio: adc: ad7816: use sysfs_match_string() for mode selection Md. Mahmudul Hasan Mabud
` (2 subsequent siblings)
3 siblings, 2 replies; 10+ messages in thread
From: Md. Mahmudul Hasan Mabud @ 2026-03-31 7:24 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
Greg Kroah-Hartman
Cc: Andy Shevchenko, David Lechner, Nuno Sá, linux-iio,
linux-staging, linux-kernel, Md. Mahmudul Hasan Mabud
Redefine AD7816_FULL and AD7816_PD constants to start from 0 instead
of 1. This change is necessary to use these constants as direct
indices for the mode string array and to align with standard
indexing in modern sysfs helpers.
Signed-off-by: Md. Mahmudul Hasan Mabud <mdmahmudulhasan1511@gmail.com>
---
drivers/staging/iio/adc/ad7816.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 172acf135..9a2f60b97 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -22,8 +22,9 @@
/*
* AD7816 config masks
*/
-#define AD7816_FULL 0x1
-#define AD7816_PD 0x2
+#define AD7816_FULL 0
+#define AD7816_PD 1
+
#define AD7816_CS_MASK 0x7
#define AD7816_CS_MAX 0x4
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v4 2/4] staging: iio: adc: ad7816: use sysfs_match_string() for mode selection
2026-03-31 7:24 [PATCH v4 0/4] staging: iio: adc: ad7816: code cleanups and modernization Md. Mahmudul Hasan Mabud
2026-03-31 7:24 ` [PATCH v4 1/4] staging: iio: adc: ad7816: redefine mode constants to start from 0 Md. Mahmudul Hasan Mabud
@ 2026-03-31 7:24 ` Md. Mahmudul Hasan Mabud
2026-03-31 7:24 ` [PATCH v4 3/4] staging: iio: adc: ad7816: replace sprintf() with sysfs_emit() Md. Mahmudul Hasan Mabud
2026-03-31 7:24 ` [PATCH v4 4/4] staging: iio: adc: ad7816: use modern IIO attribute macros Md. Mahmudul Hasan Mabud
3 siblings, 0 replies; 10+ messages in thread
From: Md. Mahmudul Hasan Mabud @ 2026-03-31 7:24 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
Greg Kroah-Hartman
Cc: Andy Shevchenko, David Lechner, Nuno Sá, linux-iio,
linux-staging, linux-kernel, Md. Mahmudul Hasan Mabud
Replace manual strcmp() logic with sysfs_match_string() to simplify
the mode selection process. This reduces boilerplate code and
leverages standard kernel helper functions for string matching.
Signed-off-by: Md. Mahmudul Hasan Mabud <mdmahmudulhasan1511@gmail.com>
---
drivers/staging/iio/adc/ad7816.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 9a2f60b97..253ef2262 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -59,6 +59,11 @@ enum ad7816_type {
ID_AD7818,
};
+static const char * const ad7816_modes[] = {
+ [AD7816_FULL] = "full",
+ [AD7816_PD] = "power-save",
+};
+
/*
* ad7816 data access by SPI
*/
@@ -136,14 +141,14 @@ 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);
+ int ret;
- if (strcmp(buf, "full") == 0) {
- gpiod_set_value(chip->rdwr_pin, 1);
- chip->mode = AD7816_FULL;
- } else {
- gpiod_set_value(chip->rdwr_pin, 0);
- chip->mode = AD7816_PD;
- }
+ ret = sysfs_match_string(ad7816_modes, buf);
+ if (ret < 0)
+ return ret;
+
+ chip->mode = ret;
+ gpiod_set_value(chip->rdwr_pin, ret == AD7816_FULL);
return len;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v4 3/4] staging: iio: adc: ad7816: replace sprintf() with sysfs_emit()
2026-03-31 7:24 [PATCH v4 0/4] staging: iio: adc: ad7816: code cleanups and modernization Md. Mahmudul Hasan Mabud
2026-03-31 7:24 ` [PATCH v4 1/4] staging: iio: adc: ad7816: redefine mode constants to start from 0 Md. Mahmudul Hasan Mabud
2026-03-31 7:24 ` [PATCH v4 2/4] staging: iio: adc: ad7816: use sysfs_match_string() for mode selection Md. Mahmudul Hasan Mabud
@ 2026-03-31 7:24 ` Md. Mahmudul Hasan Mabud
2026-03-31 9:09 ` Andy Shevchenko
2026-03-31 7:24 ` [PATCH v4 4/4] staging: iio: adc: ad7816: use modern IIO attribute macros Md. Mahmudul Hasan Mabud
3 siblings, 1 reply; 10+ messages in thread
From: Md. Mahmudul Hasan Mabud @ 2026-03-31 7:24 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
Greg Kroah-Hartman
Cc: Andy Shevchenko, David Lechner, Nuno Sá, linux-iio,
linux-staging, linux-kernel, Md. Mahmudul Hasan Mabud
Replace sprintf() with sysfs_emit() in all show attributes.
sysfs_emit() is the preferred way to return values in sysfs
callbacks as it is safer and handles page boundary checks
automatically.
Signed-off-by: Md. Mahmudul Hasan Mabud <mdmahmudulhasan1511@gmail.com>
---
drivers/staging/iio/adc/ad7816.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 253ef2262..790b04544 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -129,9 +129,7 @@ static ssize_t ad7816_show_mode(struct device *dev,
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7816_chip_info *chip = iio_priv(indio_dev);
- if (chip->mode)
- return sprintf(buf, "power-save\n");
- return sprintf(buf, "full\n");
+ return sysfs_emit(buf, "%s\n", ad7816_modes[chip->mode]);
}
static ssize_t ad7816_store_mode(struct device *dev,
@@ -162,7 +160,7 @@ static ssize_t ad7816_show_available_modes(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- return sprintf(buf, "full\npower-save\n");
+ return sysfs_emit(buf, "full\npower-save\n");
}
static IIO_DEVICE_ATTR(available_modes, 0444, ad7816_show_available_modes,
@@ -175,7 +173,7 @@ static ssize_t ad7816_show_channel(struct device *dev,
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7816_chip_info *chip = iio_priv(indio_dev);
- return sprintf(buf, "%d\n", chip->channel_id);
+ return sysfs_emit(buf, "%d\n", chip->channel_id);
}
static ssize_t ad7816_store_channel(struct device *dev,
@@ -237,9 +235,9 @@ static ssize_t ad7816_show_value(struct device *dev,
data &= AD7816_TEMP_FLOAT_MASK;
if (value < 0)
data = BIT(AD7816_TEMP_FLOAT_OFFSET) - data;
- return sprintf(buf, "%d.%.2d\n", value, data * 25);
+ return sysfs_emit(buf, "%d.%.2d\n", value, data * 25);
}
- return sprintf(buf, "%u\n", data);
+ return sysfs_emit(buf, "%u\n", data);
}
static IIO_DEVICE_ATTR(value, 0444, ad7816_show_value, NULL, 0);
@@ -287,9 +285,9 @@ static ssize_t ad7816_show_oti(struct device *dev,
value = AD7816_BOUND_VALUE_MIN +
(chip->oti_data[chip->channel_id] -
AD7816_BOUND_VALUE_BASE);
- return sprintf(buf, "%d\n", value);
+ return sysfs_emit(buf, "%d\n", value);
}
- return sprintf(buf, "%u\n", chip->oti_data[chip->channel_id]);
+ return sysfs_emit(buf, "%u\n", chip->oti_data[chip->channel_id]);
}
static inline ssize_t ad7816_set_oti(struct device *dev,
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v4 4/4] staging: iio: adc: ad7816: use modern IIO attribute macros
2026-03-31 7:24 [PATCH v4 0/4] staging: iio: adc: ad7816: code cleanups and modernization Md. Mahmudul Hasan Mabud
` (2 preceding siblings ...)
2026-03-31 7:24 ` [PATCH v4 3/4] staging: iio: adc: ad7816: replace sprintf() with sysfs_emit() Md. Mahmudul Hasan Mabud
@ 2026-03-31 7:24 ` Md. Mahmudul Hasan Mabud
2026-03-31 9:10 ` Andy Shevchenko
3 siblings, 1 reply; 10+ messages in thread
From: Md. Mahmudul Hasan Mabud @ 2026-03-31 7:24 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
Greg Kroah-Hartman
Cc: Andy Shevchenko, David Lechner, Nuno Sá, linux-iio,
linux-staging, linux-kernel, Md. Mahmudul Hasan Mabud
Modernize the driver by using IIO_DEVICE_ATTR_RW and
IIO_DEVICE_ATTR_RO macros. This involves renaming the callback
functions to standard <name>_show and <name>_store formats, making
the code cleaner and more maintainable.
Signed-off-by: Md. Mahmudul Hasan Mabud <mdmahmudulhasan1511@gmail.com>
---
drivers/staging/iio/adc/ad7816.c | 72 ++++++++++++++------------------
1 file changed, 32 insertions(+), 40 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 790b04544..c83f7f70d 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -122,9 +122,9 @@ static int ad7816_spi_write(struct ad7816_chip_info *chip, u8 data)
return ret;
}
-static ssize_t ad7816_show_mode(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t mode_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7816_chip_info *chip = iio_priv(indio_dev);
@@ -132,10 +132,10 @@ static ssize_t ad7816_show_mode(struct device *dev,
return sysfs_emit(buf, "%s\n", ad7816_modes[chip->mode]);
}
-static ssize_t ad7816_store_mode(struct device *dev,
- struct device_attribute *attr,
- const char *buf,
- size_t len)
+static ssize_t mode_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf,
+ size_t len)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7816_chip_info *chip = iio_priv(indio_dev);
@@ -151,24 +151,20 @@ static ssize_t ad7816_store_mode(struct device *dev,
return len;
}
-static IIO_DEVICE_ATTR(mode, 0644,
- ad7816_show_mode,
- ad7816_store_mode,
- 0);
+static IIO_DEVICE_ATTR_RW(mode, 0);
-static ssize_t ad7816_show_available_modes(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t available_modes_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
return sysfs_emit(buf, "full\npower-save\n");
}
-static IIO_DEVICE_ATTR(available_modes, 0444, ad7816_show_available_modes,
- NULL, 0);
+static IIO_DEVICE_ATTR_RO(available_modes, 0);
-static ssize_t ad7816_show_channel(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t channel_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7816_chip_info *chip = iio_priv(indio_dev);
@@ -176,10 +172,10 @@ static ssize_t ad7816_show_channel(struct device *dev,
return sysfs_emit(buf, "%d\n", chip->channel_id);
}
-static ssize_t ad7816_store_channel(struct device *dev,
- struct device_attribute *attr,
- const char *buf,
- size_t len)
+static ssize_t channel_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf,
+ size_t len)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7816_chip_info *chip = iio_priv(indio_dev);
@@ -209,14 +205,11 @@ static ssize_t ad7816_store_channel(struct device *dev,
return len;
}
-static IIO_DEVICE_ATTR(channel, 0644,
- ad7816_show_channel,
- ad7816_store_channel,
- 0);
+static IIO_DEVICE_ATTR_RW(channel, 0);
-static ssize_t ad7816_show_value(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t value_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7816_chip_info *chip = iio_priv(indio_dev);
@@ -240,7 +233,7 @@ static ssize_t ad7816_show_value(struct device *dev,
return sysfs_emit(buf, "%u\n", data);
}
-static IIO_DEVICE_ATTR(value, 0444, ad7816_show_value, NULL, 0);
+static IIO_DEVICE_ATTR_RO(value, 0);
static struct attribute *ad7816_attributes[] = {
&iio_dev_attr_available_modes.dev_attr.attr,
@@ -270,9 +263,9 @@ static irqreturn_t ad7816_event_handler(int irq, void *private)
return IRQ_HANDLED;
}
-static ssize_t ad7816_show_oti(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t oti_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7816_chip_info *chip = iio_priv(indio_dev);
@@ -290,10 +283,10 @@ static ssize_t ad7816_show_oti(struct device *dev,
return sysfs_emit(buf, "%u\n", chip->oti_data[chip->channel_id]);
}
-static inline ssize_t ad7816_set_oti(struct device *dev,
- struct device_attribute *attr,
- const char *buf,
- size_t len)
+static inline ssize_t oti_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf,
+ size_t len)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7816_chip_info *chip = iio_priv(indio_dev);
@@ -331,8 +324,7 @@ static inline ssize_t ad7816_set_oti(struct device *dev,
return len;
}
-static IIO_DEVICE_ATTR(oti, 0644,
- ad7816_show_oti, ad7816_set_oti, 0);
+static IIO_DEVICE_ATTR_RW(oti, 0);
static struct attribute *ad7816_event_attributes[] = {
&iio_dev_attr_oti.dev_attr.attr,
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v4 3/4] staging: iio: adc: ad7816: replace sprintf() with sysfs_emit()
2026-03-31 7:24 ` [PATCH v4 3/4] staging: iio: adc: ad7816: replace sprintf() with sysfs_emit() Md. Mahmudul Hasan Mabud
@ 2026-03-31 9:09 ` Andy Shevchenko
0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2026-03-31 9:09 UTC (permalink / raw)
To: Md. Mahmudul Hasan Mabud
Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
Greg Kroah-Hartman, David Lechner, Nuno Sá, linux-iio,
linux-staging, linux-kernel
On Tue, Mar 31, 2026 at 01:24:52PM +0600, Md. Mahmudul Hasan Mabud wrote:
> Replace sprintf() with sysfs_emit() in all show attributes.
> sysfs_emit() is the preferred way to return values in sysfs
> callbacks as it is safer and handles page boundary checks
> automatically.
...
> static ssize_t ad7816_show_available_modes(struct device *dev,
> struct device_attribute *attr,
> char *buf)
> {
> - return sprintf(buf, "full\npower-save\n");
> + return sysfs_emit(buf, "full\npower-save\n");
Missed a comment. This needs to be converted to a for-loop with use of
sysfs_emit_at().
> }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v4 4/4] staging: iio: adc: ad7816: use modern IIO attribute macros
2026-03-31 7:24 ` [PATCH v4 4/4] staging: iio: adc: ad7816: use modern IIO attribute macros Md. Mahmudul Hasan Mabud
@ 2026-03-31 9:10 ` Andy Shevchenko
2026-04-12 18:50 ` Jonathan Cameron
0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2026-03-31 9:10 UTC (permalink / raw)
To: Md. Mahmudul Hasan Mabud
Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
Greg Kroah-Hartman, David Lechner, Nuno Sá, linux-iio,
linux-staging, linux-kernel
On Tue, Mar 31, 2026 at 01:24:53PM +0600, Md. Mahmudul Hasan Mabud wrote:
> Modernize the driver by using IIO_DEVICE_ATTR_RW and
> IIO_DEVICE_ATTR_RO macros. This involves renaming the callback
> functions to standard <name>_show and <name>_store formats, making
> the code cleaner and more maintainable.
Missed my comments about commit message changes and below about line lengths.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v4 1/4] staging: iio: adc: ad7816: redefine mode constants to start from 0
2026-03-31 7:24 ` [PATCH v4 1/4] staging: iio: adc: ad7816: redefine mode constants to start from 0 Md. Mahmudul Hasan Mabud
@ 2026-04-12 18:45 ` Jonathan Cameron
2026-04-12 18:46 ` Jonathan Cameron
1 sibling, 0 replies; 10+ messages in thread
From: Jonathan Cameron @ 2026-04-12 18:45 UTC (permalink / raw)
To: Md. Mahmudul Hasan Mabud
Cc: Lars-Peter Clausen, Michael Hennerich, Greg Kroah-Hartman,
Andy Shevchenko, David Lechner, Nuno Sá, linux-iio,
linux-staging, linux-kernel
On Tue, 31 Mar 2026 13:24:50 +0600
"Md. Mahmudul Hasan Mabud" <mdmahmudulhasan1511@gmail.com> wrote:
> Redefine AD7816_FULL and AD7816_PD constants to start from 0 instead
> of 1. This change is necessary to use these constants as direct
> indices for the mode string array and to align with standard
> indexing in modern sysfs helpers.
>
> Signed-off-by: Md. Mahmudul Hasan Mabud <mdmahmudulhasan1511@gmail.com>
Hi.
This shows one of the perhaps less well documented bits of kernel process.
Hold off before sending a new version for a while! Dan commented on this
in v3 but after you'd already sent v4.
General rule is wait at least a week between versions unless it's very minor
stuff after the patch set is very stable or you get an explicit request to
repost sooner (I'll do that occasionally at the end of a kernel cycle).
Anyhow, see discussion on v3.
Jonathan
> ---
> drivers/staging/iio/adc/ad7816.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
> index 172acf135..9a2f60b97 100644
> --- a/drivers/staging/iio/adc/ad7816.c
> +++ b/drivers/staging/iio/adc/ad7816.c
> @@ -22,8 +22,9 @@
> /*
> * AD7816 config masks
> */
> -#define AD7816_FULL 0x1
> -#define AD7816_PD 0x2
> +#define AD7816_FULL 0
> +#define AD7816_PD 1
> +
> #define AD7816_CS_MASK 0x7
> #define AD7816_CS_MAX 0x4
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v4 1/4] staging: iio: adc: ad7816: redefine mode constants to start from 0
2026-03-31 7:24 ` [PATCH v4 1/4] staging: iio: adc: ad7816: redefine mode constants to start from 0 Md. Mahmudul Hasan Mabud
2026-04-12 18:45 ` Jonathan Cameron
@ 2026-04-12 18:46 ` Jonathan Cameron
1 sibling, 0 replies; 10+ messages in thread
From: Jonathan Cameron @ 2026-04-12 18:46 UTC (permalink / raw)
To: Md. Mahmudul Hasan Mabud
Cc: Lars-Peter Clausen, Michael Hennerich, Greg Kroah-Hartman,
Andy Shevchenko, David Lechner, Nuno Sá, linux-iio,
linux-staging, linux-kernel
On Tue, 31 Mar 2026 13:24:50 +0600
"Md. Mahmudul Hasan Mabud" <mdmahmudulhasan1511@gmail.com> wrote:
> Redefine AD7816_FULL and AD7816_PD constants to start from 0 instead
> of 1. This change is necessary to use these constants as direct
> indices for the mode string array and to align with standard
> indexing in modern sysfs helpers.
>
> Signed-off-by: Md. Mahmudul Hasan Mabud <mdmahmudulhasan1511@gmail.com>
> ---
> drivers/staging/iio/adc/ad7816.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
> index 172acf135..9a2f60b97 100644
> --- a/drivers/staging/iio/adc/ad7816.c
> +++ b/drivers/staging/iio/adc/ad7816.c
> @@ -22,8 +22,9 @@
> /*
> * AD7816 config masks
Beyond the discussion on v3, in what way are these now config masks?
> */
> -#define AD7816_FULL 0x1
> -#define AD7816_PD 0x2
> +#define AD7816_FULL 0
> +#define AD7816_PD 1
> +
> #define AD7816_CS_MASK 0x7
> #define AD7816_CS_MAX 0x4
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v4 4/4] staging: iio: adc: ad7816: use modern IIO attribute macros
2026-03-31 9:10 ` Andy Shevchenko
@ 2026-04-12 18:50 ` Jonathan Cameron
0 siblings, 0 replies; 10+ messages in thread
From: Jonathan Cameron @ 2026-04-12 18:50 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Md. Mahmudul Hasan Mabud, Lars-Peter Clausen, Michael Hennerich,
Greg Kroah-Hartman, David Lechner, Nuno Sá, linux-iio,
linux-staging, linux-kernel
On Tue, 31 Mar 2026 12:10:44 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> On Tue, Mar 31, 2026 at 01:24:53PM +0600, Md. Mahmudul Hasan Mabud wrote:
> > Modernize the driver by using IIO_DEVICE_ATTR_RW and
> > IIO_DEVICE_ATTR_RO macros. This involves renaming the callback
> > functions to standard <name>_show and <name>_store formats, making
> > the code cleaner and more maintainable.
>
> Missed my comments about commit message changes and below about line lengths.
>
>
Another example of why you should go slow in sending new versions!
Andy's email came in after you sent this version I think.
J
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-04-12 18:51 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-31 7:24 [PATCH v4 0/4] staging: iio: adc: ad7816: code cleanups and modernization Md. Mahmudul Hasan Mabud
2026-03-31 7:24 ` [PATCH v4 1/4] staging: iio: adc: ad7816: redefine mode constants to start from 0 Md. Mahmudul Hasan Mabud
2026-04-12 18:45 ` Jonathan Cameron
2026-04-12 18:46 ` Jonathan Cameron
2026-03-31 7:24 ` [PATCH v4 2/4] staging: iio: adc: ad7816: use sysfs_match_string() for mode selection Md. Mahmudul Hasan Mabud
2026-03-31 7:24 ` [PATCH v4 3/4] staging: iio: adc: ad7816: replace sprintf() with sysfs_emit() Md. Mahmudul Hasan Mabud
2026-03-31 9:09 ` Andy Shevchenko
2026-03-31 7:24 ` [PATCH v4 4/4] staging: iio: adc: ad7816: use modern IIO attribute macros Md. Mahmudul Hasan Mabud
2026-03-31 9:10 ` Andy Shevchenko
2026-04-12 18:50 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox