From: kernel test robot <lkp@intel.com>
To: Abdelnasser Hussein <abdelnasserhussein11@gmail.com>,
jic23@kernel.org, gregkh@linuxfoundation.org, nuno.sa@analog.com,
Michael.Hennerich@analog.com
Cc: oe-kbuild-all@lists.linux.dev, dlechner@baylibre.com,
andy@kernel.org, linux@analog.com, linux-iio@vger.kernel.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
joshua.crofts1@gmail.com, error27@gmail.com,
Abdelnasser Hussein <abdelnasserhussein11@gmail.com>
Subject: Re: [PATCH v2] staging: iio: adc: ad7816: Protect sysfs attributes with mutex
Date: Wed, 23 Sep 2026 08:13:49 +0200 [thread overview]
Message-ID: <202609230855.IEzAf41u-lkp@intel.com> (raw)
In-Reply-To: <20260920091522.15507-1-abdelnasserhussein11@gmail.com>
Hi Abdelnasser,
kernel test robot noticed the following build errors:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/intel-lab-lkp/linux/commits/Abdelnasser-Hussein/staging-iio-adc-ad7816-Protect-sysfs-attributes-with-mutex/20260920-121522
base: staging/staging-testing
patch link: https://lore.kernel.org/r/20260920091522.15507-1-abdelnasserhussein11%40gmail.com
patch subject: [PATCH v2] staging: iio: adc: ad7816: Protect sysfs attributes with mutex
config: sparc-randconfig-2001-20260923 (https://download.01.org/0day-ci/archive/20260923/202609230855.IEzAf41u-lkp@intel.com/config)
compiler: sparc-linux-gcc (GCC) 14.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260923/202609230855.IEzAf41u-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609230855.IEzAf41u-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/linux/irqflags.h:17,
from include/asm-generic/cmpxchg-local.h:6,
from arch/sparc/include/asm/cmpxchg_32.h:67,
from arch/sparc/include/asm/cmpxchg.h:7,
from arch/sparc/include/asm/atomic_32.h:17,
from arch/sparc/include/asm/atomic.h:7,
from include/linux/atomic.h:7,
from include/asm-generic/bitops/lock.h:5,
from arch/sparc/include/asm/bitops_32.h:102,
from arch/sparc/include/asm/bitops.h:7,
from include/linux/bitops.h:67,
from include/linux/kernel.h:23,
from include/linux/interrupt.h:6,
from drivers/staging/iio/adc/ad7816.c:8:
drivers/staging/iio/adc/ad7816.c: In function 'ad7816_store_mode':
>> drivers/staging/iio/adc/ad7816.c:139:27: error: 'struct ad7816_chip_info' has no member named 'lock'
139 | guard(mutex)(&chip->lock);
| ^~
include/linux/cleanup.h:558:37: note: in definition of macro 'WITH_LOCK_GUARD_1_ATTRS'
558 | class_##_name##_constructor(_T), \
| ^~
include/linux/cleanup.h:303:17: note: in expansion of macro 'class_mutex_constructor'
303 | class_##_name##_constructor
| ^~~~~~
include/linux/cleanup.h:423:9: note: in expansion of macro 'CLASS'
423 | CLASS(_name, __UNIQUE_ID(guard))
| ^~~~~
drivers/staging/iio/adc/ad7816.c:139:9: note: in expansion of macro 'guard'
139 | guard(mutex)(&chip->lock);
| ^~~~~
>> drivers/staging/iio/adc/ad7816.c:139:27: error: 'struct ad7816_chip_info' has no member named 'lock'
139 | guard(mutex)(&chip->lock);
| ^~
include/linux/cleanup.h:559:97: note: in definition of macro 'WITH_LOCK_GUARD_1_ATTRS'
559 | *__UNIQUE_ID(unlock) __cleanup(__class_##_name##_cleanup_ctx) = (void *)(unsigned long)(_T)
| ^~
include/linux/cleanup.h:303:17: note: in expansion of macro 'class_mutex_constructor'
303 | class_##_name##_constructor
| ^~~~~~
include/linux/cleanup.h:423:9: note: in expansion of macro 'CLASS'
423 | CLASS(_name, __UNIQUE_ID(guard))
| ^~~~~
drivers/staging/iio/adc/ad7816.c:139:9: note: in expansion of macro 'guard'
139 | guard(mutex)(&chip->lock);
| ^~~~~
drivers/staging/iio/adc/ad7816.c: In function 'ad7816_store_channel':
drivers/staging/iio/adc/ad7816.c:205:27: error: 'struct ad7816_chip_info' has no member named 'lock'
205 | guard(mutex)(&chip->lock);
| ^~
include/linux/cleanup.h:558:37: note: in definition of macro 'WITH_LOCK_GUARD_1_ATTRS'
558 | class_##_name##_constructor(_T), \
| ^~
include/linux/cleanup.h:303:17: note: in expansion of macro 'class_mutex_constructor'
303 | class_##_name##_constructor
| ^~~~~~
include/linux/cleanup.h:423:9: note: in expansion of macro 'CLASS'
423 | CLASS(_name, __UNIQUE_ID(guard))
| ^~~~~
drivers/staging/iio/adc/ad7816.c:205:9: note: in expansion of macro 'guard'
205 | guard(mutex)(&chip->lock);
| ^~~~~
drivers/staging/iio/adc/ad7816.c:205:27: error: 'struct ad7816_chip_info' has no member named 'lock'
205 | guard(mutex)(&chip->lock);
| ^~
include/linux/cleanup.h:559:97: note: in definition of macro 'WITH_LOCK_GUARD_1_ATTRS'
559 | *__UNIQUE_ID(unlock) __cleanup(__class_##_name##_cleanup_ctx) = (void *)(unsigned long)(_T)
| ^~
include/linux/cleanup.h:303:17: note: in expansion of macro 'class_mutex_constructor'
303 | class_##_name##_constructor
| ^~~~~~
include/linux/cleanup.h:423:9: note: in expansion of macro 'CLASS'
423 | CLASS(_name, __UNIQUE_ID(guard))
| ^~~~~
drivers/staging/iio/adc/ad7816.c:205:9: note: in expansion of macro 'guard'
205 | guard(mutex)(&chip->lock);
| ^~~~~
vim +139 drivers/staging/iio/adc/ad7816.c
> 8 #include <linux/interrupt.h>
9 #include <linux/gpio/consumer.h>
10 #include <linux/device.h>
11 #include <linux/kernel.h>
12 #include <linux/slab.h>
13 #include <linux/sysfs.h>
14 #include <linux/list.h>
15 #include <linux/spi/spi.h>
16 #include <linux/module.h>
17
18 #include <linux/iio/iio.h>
19 #include <linux/iio/sysfs.h>
20 #include <linux/iio/events.h>
21
22 /*
23 * AD7816 config masks
24 */
25 #define AD7816_FULL 0x1
26 #define AD7816_PD 0x2
27 #define AD7816_CS_MASK 0x7
28 #define AD7816_CS_MAX 0x4
29
30 /*
31 * AD7816 temperature masks
32 */
33 #define AD7816_VALUE_OFFSET 6
34 #define AD7816_BOUND_VALUE_BASE 0x8
35 #define AD7816_BOUND_VALUE_MIN -95
36 #define AD7816_BOUND_VALUE_MAX 152
37 #define AD7816_TEMP_FLOAT_OFFSET 2
38 #define AD7816_TEMP_FLOAT_MASK 0x3
39
40 /*
41 * struct ad7816_chip_info - chip specific information
42 */
43
44 struct ad7816_chip_info {
45 kernel_ulong_t id;
46 struct spi_device *spi_dev;
47 struct gpio_desc *rdwr_pin;
48 struct gpio_desc *convert_pin;
49 struct gpio_desc *busy_pin;
50 u8 oti_data[AD7816_CS_MAX + 1];
51 u8 channel_id; /* 0 always be temperature */
52 u8 mode;
53 };
54
55 enum ad7816_type {
56 ID_AD7816,
57 ID_AD7817,
58 ID_AD7818,
59 };
60
61 /*
62 * ad7816 data access by SPI
63 */
64 static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)
65 {
66 struct spi_device *spi_dev = chip->spi_dev;
67 int ret;
68 __be16 buf;
69
70 gpiod_set_value(chip->rdwr_pin, 1);
71 gpiod_set_value(chip->rdwr_pin, 0);
72 ret = spi_write(spi_dev, &chip->channel_id, sizeof(chip->channel_id));
73 if (ret < 0) {
74 dev_err(&spi_dev->dev, "SPI channel setting error\n");
75 return ret;
76 }
77 gpiod_set_value(chip->rdwr_pin, 1);
78
79 if (chip->mode == AD7816_PD) { /* operating mode 2 */
80 gpiod_set_value(chip->convert_pin, 1);
81 gpiod_set_value(chip->convert_pin, 0);
82 } else { /* operating mode 1 */
83 gpiod_set_value(chip->convert_pin, 0);
84 gpiod_set_value(chip->convert_pin, 1);
85 }
86
87 if (chip->id == ID_AD7816 || chip->id == ID_AD7817) {
88 while (gpiod_get_value(chip->busy_pin))
89 cpu_relax();
90 }
91
92 gpiod_set_value(chip->rdwr_pin, 0);
93 gpiod_set_value(chip->rdwr_pin, 1);
94 ret = spi_read(spi_dev, &buf, sizeof(*data));
95 if (ret < 0) {
96 dev_err(&spi_dev->dev, "SPI data read error\n");
97 return ret;
98 }
99
100 *data = be16_to_cpu(buf);
101
102 return ret;
103 }
104
105 static int ad7816_spi_write(struct ad7816_chip_info *chip, u8 data)
106 {
107 struct spi_device *spi_dev = chip->spi_dev;
108 int ret;
109
110 gpiod_set_value(chip->rdwr_pin, 1);
111 gpiod_set_value(chip->rdwr_pin, 0);
112 ret = spi_write(spi_dev, &data, sizeof(data));
113 if (ret < 0)
114 dev_err(&spi_dev->dev, "SPI oti data write error\n");
115
116 return ret;
117 }
118
119 static ssize_t ad7816_show_mode(struct device *dev,
120 struct device_attribute *attr,
121 char *buf)
122 {
123 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
124 struct ad7816_chip_info *chip = iio_priv(indio_dev);
125
126 if (chip->mode)
127 return sysfs_emit(buf, "power-save\n");
128 return sysfs_emit(buf, "full\n");
129 }
130
131 static ssize_t ad7816_store_mode(struct device *dev,
132 struct device_attribute *attr,
133 const char *buf,
134 size_t len)
135 {
136 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
137 struct ad7816_chip_info *chip = iio_priv(indio_dev);
138
> 139 guard(mutex)(&chip->lock);
140
141 if (strcmp(buf, "full") == 0) {
142 gpiod_set_value(chip->rdwr_pin, 1);
143 chip->mode = AD7816_FULL;
144 } else {
145 gpiod_set_value(chip->rdwr_pin, 0);
146 chip->mode = AD7816_PD;
147 }
148
149 return len;
150 }
151
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2026-09-23 6:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-20 9:15 Abdelnasser Hussein
2026-09-21 3:49 ` Jonathan Cameron
2026-09-23 6:13 ` kernel test robot [this message]
2026-09-23 12:44 ` kernel test robot
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=202609230855.IEzAf41u-lkp@intel.com \
--to=lkp@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=abdelnasserhussein11@gmail.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=joshua.crofts1@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux@analog.com \
--cc=nuno.sa@analog.com \
--cc=oe-kbuild-all@lists.linux.dev \
/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®