* [PATCH v1 1/1] iio: chemical: atlas-ezo-sensor: Make use of device properties
@ 2022-02-03 12:25 Andy Shevchenko
2022-02-03 15:48 ` kernel test robot
2022-02-03 16:09 ` kernel test robot
0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-02-03 12:25 UTC (permalink / raw)
To: Andy Shevchenko, linux-iio, linux-kernel
Cc: Jonathan Cameron, Lars-Peter Clausen
Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/iio/chemical/atlas-ezo-sensor.c | 41 ++++++++++---------------
1 file changed, 17 insertions(+), 24 deletions(-)
diff --git a/drivers/iio/chemical/atlas-ezo-sensor.c b/drivers/iio/chemical/atlas-ezo-sensor.c
index b1bacfe3c3ce..dbec0499ec1e 100644
--- a/drivers/iio/chemical/atlas-ezo-sensor.c
+++ b/drivers/iio/chemical/atlas-ezo-sensor.c
@@ -6,25 +6,21 @@
* Author: Matt Ranostay <matt.ranostay@konsulko.com>
*/
-#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
#include <linux/mutex.h>
+#include <linux/property.h>
#include <linux/err.h>
#include <linux/i2c.h>
-#include <linux/of_device.h>
+
#include <linux/iio/iio.h>
#define ATLAS_EZO_DRV_NAME "atlas-ezo-sensor"
#define ATLAS_INT_TIME_IN_MS 950
#define ATLAS_INT_HUM_TIME_IN_MS 350
-enum {
- ATLAS_CO2_EZO,
- ATLAS_O2_EZO,
- ATLAS_HUM_EZO,
-};
-
struct atlas_ezo_device {
const struct iio_chan_spec *channels;
int num_channels;
@@ -81,17 +77,17 @@ static const struct iio_chan_spec atlas_hum_ezo_channels[] = {
};
static struct atlas_ezo_device atlas_ezo_devices[] = {
- [ATLAS_CO2_EZO] = {
+ [0] = {
.channels = atlas_co2_ezo_channels,
.num_channels = 1,
.delay = ATLAS_INT_TIME_IN_MS,
},
- [ATLAS_O2_EZO] = {
+ [1] = {
.channels = atlas_o2_ezo_channels,
.num_channels = 1,
.delay = ATLAS_INT_TIME_IN_MS,
},
- [ATLAS_HUM_EZO] = {
+ [2] = {
.channels = atlas_hum_ezo_channels,
.num_channels = 1,
.delay = ATLAS_INT_HUM_TIME_IN_MS,
@@ -184,17 +180,17 @@ static const struct iio_info atlas_info = {
};
static const struct i2c_device_id atlas_ezo_id[] = {
- { "atlas-co2-ezo", ATLAS_CO2_EZO },
- { "atlas-o2-ezo", ATLAS_O2_EZO },
- { "atlas-hum-ezo", ATLAS_HUM_EZO },
+ { "atlas-co2-ezo", &atlas_ezo_devices[0] },
+ { "atlas-o2-ezo", &atlas_ezo_devices[1] },
+ { "atlas-hum-ezo", &atlas_ezo_devices[2] },
{}
};
MODULE_DEVICE_TABLE(i2c, atlas_ezo_id);
static const struct of_device_id atlas_ezo_dt_ids[] = {
- { .compatible = "atlas,co2-ezo", .data = (void *)ATLAS_CO2_EZO, },
- { .compatible = "atlas,o2-ezo", .data = (void *)ATLAS_O2_EZO, },
- { .compatible = "atlas,hum-ezo", .data = (void *)ATLAS_HUM_EZO, },
+ { .compatible = "atlas,co2-ezo", .data = &atlas_ezo_devices[0], },
+ { .compatible = "atlas,o2-ezo", .data = &atlas_ezo_devices[1], },
+ { .compatible = "atlas,hum-ezo", .data = &atlas_ezo_devices[2], },
{}
};
MODULE_DEVICE_TABLE(of, atlas_ezo_dt_ids);
@@ -202,20 +198,17 @@ MODULE_DEVICE_TABLE(of, atlas_ezo_dt_ids);
static int atlas_ezo_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
+ const struct atlas_ezo_device *chip;
struct atlas_ezo_data *data;
- struct atlas_ezo_device *chip;
- const struct of_device_id *of_id;
struct iio_dev *indio_dev;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
if (!indio_dev)
return -ENOMEM;
- of_id = of_match_device(atlas_ezo_dt_ids, &client->dev);
- if (!of_id)
- chip = &atlas_ezo_devices[id->driver_data];
- else
- chip = &atlas_ezo_devices[(unsigned long)of_id->data];
+ chip = device_get_match_data(&client->dev);
+ if (!chip)
+ chip = (const struct atlas_ezo_device *)id->driver_data;
indio_dev->info = &atlas_info;
indio_dev->name = ATLAS_EZO_DRV_NAME;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] iio: chemical: atlas-ezo-sensor: Make use of device properties
2022-02-03 12:25 [PATCH v1 1/1] iio: chemical: atlas-ezo-sensor: Make use of device properties Andy Shevchenko
@ 2022-02-03 15:48 ` kernel test robot
2022-02-03 16:09 ` kernel test robot
1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-02-03 15:48 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 5029 bytes --]
Hi Andy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on v5.17-rc2 next-20220203]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/iio-chemical-atlas-ezo-sensor-Make-use-of-device-properties/20220203-202716
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220203/202202032354.wewk3q69-lkp(a)intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/262e5b667d25332f90b88e6869ba161b11e8f88e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/iio-chemical-atlas-ezo-sensor-Make-use-of-device-properties/20220203-202716
git checkout 262e5b667d25332f90b88e6869ba161b11e8f88e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash drivers/iio/chemical/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/iio/chemical/atlas-ezo-sensor.c:183:28: warning: initialization of 'long unsigned int' from 'struct atlas_ezo_device *' makes integer from pointer without a cast [-Wint-conversion]
183 | { "atlas-co2-ezo", &atlas_ezo_devices[0] },
| ^
drivers/iio/chemical/atlas-ezo-sensor.c:183:28: note: (near initialization for 'atlas_ezo_id[0].driver_data')
drivers/iio/chemical/atlas-ezo-sensor.c:184:27: warning: initialization of 'long unsigned int' from 'struct atlas_ezo_device *' makes integer from pointer without a cast [-Wint-conversion]
184 | { "atlas-o2-ezo", &atlas_ezo_devices[1] },
| ^
drivers/iio/chemical/atlas-ezo-sensor.c:184:27: note: (near initialization for 'atlas_ezo_id[1].driver_data')
drivers/iio/chemical/atlas-ezo-sensor.c:185:28: warning: initialization of 'long unsigned int' from 'struct atlas_ezo_device *' makes integer from pointer without a cast [-Wint-conversion]
185 | { "atlas-hum-ezo", &atlas_ezo_devices[2] },
| ^
drivers/iio/chemical/atlas-ezo-sensor.c:185:28: note: (near initialization for 'atlas_ezo_id[2].driver_data')
drivers/iio/chemical/atlas-ezo-sensor.c: In function 'atlas_ezo_probe':
>> drivers/iio/chemical/atlas-ezo-sensor.c:221:20: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
221 | data->chip = chip;
| ^
vim +183 drivers/iio/chemical/atlas-ezo-sensor.c
181
182 static const struct i2c_device_id atlas_ezo_id[] = {
> 183 { "atlas-co2-ezo", &atlas_ezo_devices[0] },
> 184 { "atlas-o2-ezo", &atlas_ezo_devices[1] },
185 { "atlas-hum-ezo", &atlas_ezo_devices[2] },
186 {}
187 };
188 MODULE_DEVICE_TABLE(i2c, atlas_ezo_id);
189
190 static const struct of_device_id atlas_ezo_dt_ids[] = {
191 { .compatible = "atlas,co2-ezo", .data = &atlas_ezo_devices[0], },
192 { .compatible = "atlas,o2-ezo", .data = &atlas_ezo_devices[1], },
193 { .compatible = "atlas,hum-ezo", .data = &atlas_ezo_devices[2], },
194 {}
195 };
196 MODULE_DEVICE_TABLE(of, atlas_ezo_dt_ids);
197
198 static int atlas_ezo_probe(struct i2c_client *client,
199 const struct i2c_device_id *id)
200 {
201 const struct atlas_ezo_device *chip;
202 struct atlas_ezo_data *data;
203 struct iio_dev *indio_dev;
204
205 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
206 if (!indio_dev)
207 return -ENOMEM;
208
209 chip = device_get_match_data(&client->dev);
210 if (!chip)
211 chip = (const struct atlas_ezo_device *)id->driver_data;
212
213 indio_dev->info = &atlas_info;
214 indio_dev->name = ATLAS_EZO_DRV_NAME;
215 indio_dev->channels = chip->channels;
216 indio_dev->num_channels = chip->num_channels;
217 indio_dev->modes = INDIO_DIRECT_MODE;
218
219 data = iio_priv(indio_dev);
220 data->client = client;
> 221 data->chip = chip;
222 mutex_init(&data->lock);
223
224 return devm_iio_device_register(&client->dev, indio_dev);
225 };
226
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] iio: chemical: atlas-ezo-sensor: Make use of device properties
2022-02-03 12:25 [PATCH v1 1/1] iio: chemical: atlas-ezo-sensor: Make use of device properties Andy Shevchenko
@ 2022-02-03 16:09 ` kernel test robot
2022-02-03 16:09 ` kernel test robot
1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-02-03 16:09 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: llvm, kbuild-all
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on v5.17-rc2 next-20220203]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/iio-chemical-atlas-ezo-sensor-Make-use-of-device-properties/20220203-202716
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: hexagon-randconfig-r041-20220203 (https://download.01.org/0day-ci/archive/20220204/202202040047.MYaXoBXz-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a73e4ce6a59b01f0e37037761c1e6889d539d233)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/262e5b667d25332f90b88e6869ba161b11e8f88e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/iio-chemical-atlas-ezo-sensor-Make-use-of-device-properties/20220203-202716
git checkout 262e5b667d25332f90b88e6869ba161b11e8f88e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/iio/chemical/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
>> drivers/iio/chemical/atlas-ezo-sensor.c:183:21: warning: incompatible pointer to integer conversion initializing 'kernel_ulong_t' (aka 'unsigned long') with an expression of type 'struct atlas_ezo_device *' [-Wint-conversion]
{ "atlas-co2-ezo", &atlas_ezo_devices[0] },
^~~~~~~~~~~~~~~~~~~~~
drivers/iio/chemical/atlas-ezo-sensor.c:184:20: warning: incompatible pointer to integer conversion initializing 'kernel_ulong_t' (aka 'unsigned long') with an expression of type 'struct atlas_ezo_device *' [-Wint-conversion]
{ "atlas-o2-ezo", &atlas_ezo_devices[1] },
^~~~~~~~~~~~~~~~~~~~~
drivers/iio/chemical/atlas-ezo-sensor.c:185:21: warning: incompatible pointer to integer conversion initializing 'kernel_ulong_t' (aka 'unsigned long') with an expression of type 'struct atlas_ezo_device *' [-Wint-conversion]
{ "atlas-hum-ezo", &atlas_ezo_devices[2] },
^~~~~~~~~~~~~~~~~~~~~
>> drivers/iio/chemical/atlas-ezo-sensor.c:221:13: error: assigning to 'struct atlas_ezo_device *' from 'const struct atlas_ezo_device *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
data->chip = chip;
^ ~~~~
3 warnings and 1 error generated.
vim +221 drivers/iio/chemical/atlas-ezo-sensor.c
8712b3098b3d03 Matt Ranostay 2020-05-11 181
8712b3098b3d03 Matt Ranostay 2020-05-11 182 static const struct i2c_device_id atlas_ezo_id[] = {
262e5b667d2533 Andy Shevchenko 2022-02-03 @183 { "atlas-co2-ezo", &atlas_ezo_devices[0] },
262e5b667d2533 Andy Shevchenko 2022-02-03 184 { "atlas-o2-ezo", &atlas_ezo_devices[1] },
262e5b667d2533 Andy Shevchenko 2022-02-03 185 { "atlas-hum-ezo", &atlas_ezo_devices[2] },
8712b3098b3d03 Matt Ranostay 2020-05-11 186 {}
8712b3098b3d03 Matt Ranostay 2020-05-11 187 };
8712b3098b3d03 Matt Ranostay 2020-05-11 188 MODULE_DEVICE_TABLE(i2c, atlas_ezo_id);
8712b3098b3d03 Matt Ranostay 2020-05-11 189
8712b3098b3d03 Matt Ranostay 2020-05-11 190 static const struct of_device_id atlas_ezo_dt_ids[] = {
262e5b667d2533 Andy Shevchenko 2022-02-03 191 { .compatible = "atlas,co2-ezo", .data = &atlas_ezo_devices[0], },
262e5b667d2533 Andy Shevchenko 2022-02-03 192 { .compatible = "atlas,o2-ezo", .data = &atlas_ezo_devices[1], },
262e5b667d2533 Andy Shevchenko 2022-02-03 193 { .compatible = "atlas,hum-ezo", .data = &atlas_ezo_devices[2], },
8712b3098b3d03 Matt Ranostay 2020-05-11 194 {}
8712b3098b3d03 Matt Ranostay 2020-05-11 195 };
8712b3098b3d03 Matt Ranostay 2020-05-11 196 MODULE_DEVICE_TABLE(of, atlas_ezo_dt_ids);
8712b3098b3d03 Matt Ranostay 2020-05-11 197
8712b3098b3d03 Matt Ranostay 2020-05-11 198 static int atlas_ezo_probe(struct i2c_client *client,
8712b3098b3d03 Matt Ranostay 2020-05-11 199 const struct i2c_device_id *id)
8712b3098b3d03 Matt Ranostay 2020-05-11 200 {
262e5b667d2533 Andy Shevchenko 2022-02-03 201 const struct atlas_ezo_device *chip;
8712b3098b3d03 Matt Ranostay 2020-05-11 202 struct atlas_ezo_data *data;
8712b3098b3d03 Matt Ranostay 2020-05-11 203 struct iio_dev *indio_dev;
8712b3098b3d03 Matt Ranostay 2020-05-11 204
8712b3098b3d03 Matt Ranostay 2020-05-11 205 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
8712b3098b3d03 Matt Ranostay 2020-05-11 206 if (!indio_dev)
8712b3098b3d03 Matt Ranostay 2020-05-11 207 return -ENOMEM;
8712b3098b3d03 Matt Ranostay 2020-05-11 208
262e5b667d2533 Andy Shevchenko 2022-02-03 209 chip = device_get_match_data(&client->dev);
262e5b667d2533 Andy Shevchenko 2022-02-03 210 if (!chip)
262e5b667d2533 Andy Shevchenko 2022-02-03 211 chip = (const struct atlas_ezo_device *)id->driver_data;
8712b3098b3d03 Matt Ranostay 2020-05-11 212
8712b3098b3d03 Matt Ranostay 2020-05-11 213 indio_dev->info = &atlas_info;
8712b3098b3d03 Matt Ranostay 2020-05-11 214 indio_dev->name = ATLAS_EZO_DRV_NAME;
8712b3098b3d03 Matt Ranostay 2020-05-11 215 indio_dev->channels = chip->channels;
8712b3098b3d03 Matt Ranostay 2020-05-11 216 indio_dev->num_channels = chip->num_channels;
8712b3098b3d03 Matt Ranostay 2020-05-11 217 indio_dev->modes = INDIO_DIRECT_MODE;
8712b3098b3d03 Matt Ranostay 2020-05-11 218
8712b3098b3d03 Matt Ranostay 2020-05-11 219 data = iio_priv(indio_dev);
8712b3098b3d03 Matt Ranostay 2020-05-11 220 data->client = client;
8712b3098b3d03 Matt Ranostay 2020-05-11 @221 data->chip = chip;
8712b3098b3d03 Matt Ranostay 2020-05-11 222 mutex_init(&data->lock);
8712b3098b3d03 Matt Ranostay 2020-05-11 223
8712b3098b3d03 Matt Ranostay 2020-05-11 224 return devm_iio_device_register(&client->dev, indio_dev);
8712b3098b3d03 Matt Ranostay 2020-05-11 225 };
8712b3098b3d03 Matt Ranostay 2020-05-11 226
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] iio: chemical: atlas-ezo-sensor: Make use of device properties
@ 2022-02-03 16:09 ` kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-02-03 16:09 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 6807 bytes --]
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on v5.17-rc2 next-20220203]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/iio-chemical-atlas-ezo-sensor-Make-use-of-device-properties/20220203-202716
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: hexagon-randconfig-r041-20220203 (https://download.01.org/0day-ci/archive/20220204/202202040047.MYaXoBXz-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a73e4ce6a59b01f0e37037761c1e6889d539d233)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/262e5b667d25332f90b88e6869ba161b11e8f88e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/iio-chemical-atlas-ezo-sensor-Make-use-of-device-properties/20220203-202716
git checkout 262e5b667d25332f90b88e6869ba161b11e8f88e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/iio/chemical/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
>> drivers/iio/chemical/atlas-ezo-sensor.c:183:21: warning: incompatible pointer to integer conversion initializing 'kernel_ulong_t' (aka 'unsigned long') with an expression of type 'struct atlas_ezo_device *' [-Wint-conversion]
{ "atlas-co2-ezo", &atlas_ezo_devices[0] },
^~~~~~~~~~~~~~~~~~~~~
drivers/iio/chemical/atlas-ezo-sensor.c:184:20: warning: incompatible pointer to integer conversion initializing 'kernel_ulong_t' (aka 'unsigned long') with an expression of type 'struct atlas_ezo_device *' [-Wint-conversion]
{ "atlas-o2-ezo", &atlas_ezo_devices[1] },
^~~~~~~~~~~~~~~~~~~~~
drivers/iio/chemical/atlas-ezo-sensor.c:185:21: warning: incompatible pointer to integer conversion initializing 'kernel_ulong_t' (aka 'unsigned long') with an expression of type 'struct atlas_ezo_device *' [-Wint-conversion]
{ "atlas-hum-ezo", &atlas_ezo_devices[2] },
^~~~~~~~~~~~~~~~~~~~~
>> drivers/iio/chemical/atlas-ezo-sensor.c:221:13: error: assigning to 'struct atlas_ezo_device *' from 'const struct atlas_ezo_device *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
data->chip = chip;
^ ~~~~
3 warnings and 1 error generated.
vim +221 drivers/iio/chemical/atlas-ezo-sensor.c
8712b3098b3d03 Matt Ranostay 2020-05-11 181
8712b3098b3d03 Matt Ranostay 2020-05-11 182 static const struct i2c_device_id atlas_ezo_id[] = {
262e5b667d2533 Andy Shevchenko 2022-02-03 @183 { "atlas-co2-ezo", &atlas_ezo_devices[0] },
262e5b667d2533 Andy Shevchenko 2022-02-03 184 { "atlas-o2-ezo", &atlas_ezo_devices[1] },
262e5b667d2533 Andy Shevchenko 2022-02-03 185 { "atlas-hum-ezo", &atlas_ezo_devices[2] },
8712b3098b3d03 Matt Ranostay 2020-05-11 186 {}
8712b3098b3d03 Matt Ranostay 2020-05-11 187 };
8712b3098b3d03 Matt Ranostay 2020-05-11 188 MODULE_DEVICE_TABLE(i2c, atlas_ezo_id);
8712b3098b3d03 Matt Ranostay 2020-05-11 189
8712b3098b3d03 Matt Ranostay 2020-05-11 190 static const struct of_device_id atlas_ezo_dt_ids[] = {
262e5b667d2533 Andy Shevchenko 2022-02-03 191 { .compatible = "atlas,co2-ezo", .data = &atlas_ezo_devices[0], },
262e5b667d2533 Andy Shevchenko 2022-02-03 192 { .compatible = "atlas,o2-ezo", .data = &atlas_ezo_devices[1], },
262e5b667d2533 Andy Shevchenko 2022-02-03 193 { .compatible = "atlas,hum-ezo", .data = &atlas_ezo_devices[2], },
8712b3098b3d03 Matt Ranostay 2020-05-11 194 {}
8712b3098b3d03 Matt Ranostay 2020-05-11 195 };
8712b3098b3d03 Matt Ranostay 2020-05-11 196 MODULE_DEVICE_TABLE(of, atlas_ezo_dt_ids);
8712b3098b3d03 Matt Ranostay 2020-05-11 197
8712b3098b3d03 Matt Ranostay 2020-05-11 198 static int atlas_ezo_probe(struct i2c_client *client,
8712b3098b3d03 Matt Ranostay 2020-05-11 199 const struct i2c_device_id *id)
8712b3098b3d03 Matt Ranostay 2020-05-11 200 {
262e5b667d2533 Andy Shevchenko 2022-02-03 201 const struct atlas_ezo_device *chip;
8712b3098b3d03 Matt Ranostay 2020-05-11 202 struct atlas_ezo_data *data;
8712b3098b3d03 Matt Ranostay 2020-05-11 203 struct iio_dev *indio_dev;
8712b3098b3d03 Matt Ranostay 2020-05-11 204
8712b3098b3d03 Matt Ranostay 2020-05-11 205 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
8712b3098b3d03 Matt Ranostay 2020-05-11 206 if (!indio_dev)
8712b3098b3d03 Matt Ranostay 2020-05-11 207 return -ENOMEM;
8712b3098b3d03 Matt Ranostay 2020-05-11 208
262e5b667d2533 Andy Shevchenko 2022-02-03 209 chip = device_get_match_data(&client->dev);
262e5b667d2533 Andy Shevchenko 2022-02-03 210 if (!chip)
262e5b667d2533 Andy Shevchenko 2022-02-03 211 chip = (const struct atlas_ezo_device *)id->driver_data;
8712b3098b3d03 Matt Ranostay 2020-05-11 212
8712b3098b3d03 Matt Ranostay 2020-05-11 213 indio_dev->info = &atlas_info;
8712b3098b3d03 Matt Ranostay 2020-05-11 214 indio_dev->name = ATLAS_EZO_DRV_NAME;
8712b3098b3d03 Matt Ranostay 2020-05-11 215 indio_dev->channels = chip->channels;
8712b3098b3d03 Matt Ranostay 2020-05-11 216 indio_dev->num_channels = chip->num_channels;
8712b3098b3d03 Matt Ranostay 2020-05-11 217 indio_dev->modes = INDIO_DIRECT_MODE;
8712b3098b3d03 Matt Ranostay 2020-05-11 218
8712b3098b3d03 Matt Ranostay 2020-05-11 219 data = iio_priv(indio_dev);
8712b3098b3d03 Matt Ranostay 2020-05-11 220 data->client = client;
8712b3098b3d03 Matt Ranostay 2020-05-11 @221 data->chip = chip;
8712b3098b3d03 Matt Ranostay 2020-05-11 222 mutex_init(&data->lock);
8712b3098b3d03 Matt Ranostay 2020-05-11 223
8712b3098b3d03 Matt Ranostay 2020-05-11 224 return devm_iio_device_register(&client->dev, indio_dev);
8712b3098b3d03 Matt Ranostay 2020-05-11 225 };
8712b3098b3d03 Matt Ranostay 2020-05-11 226
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-03 16:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 12:25 [PATCH v1 1/1] iio: chemical: atlas-ezo-sensor: Make use of device properties Andy Shevchenko
2022-02-03 15:48 ` kernel test robot
2022-02-03 16:09 ` kernel test robot
2022-02-03 16:09 ` kernel test robot
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.