iio: accel: bma220: Fix returned codes from bma220_init(), bma220_deinit()
Subsystems (2)
PATCH 1/8 iio: accel: bma220: Fix returned codes from bma220_init(), bma220_deinit()
Potentially bma220_init() and bma220_deinit() may return positive codes. Fix the logic to return proper error codes instead.
--- drivers/iio/accel/bma220_spi.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/iio/accel/bma220_spi.c +9 -5
@@ -198,10 +198,12 @@ static int bma220_init(struct spi_device *spi)/* Make sure the chip is powered on */ ret =bma220_read_reg (spi,BMA220_REG_SUSPEND ); +if (ret ==BMA220_SUSPEND_WAKE ) + ret =bma220_read_reg (spi,BMA220_REG_SUSPEND );if (ret <0 )return ret; -else if (ret ==BMA220_SUSPEND_WAKE ) -return bma220_read_reg (spi,BMA220_REG_SUSPEND ); +if (ret ==BMA220_SUSPEND_WAKE ) +return -EBUSY ;return 0 ; }
@@ -212,10 +214,12 @@ static int bma220_deinit(struct spi_device *spi)/* Make sure the chip is powered off */ ret =bma220_read_reg (spi,BMA220_REG_SUSPEND ); +if (ret ==BMA220_SUSPEND_SLEEP ) + ret =bma220_read_reg (spi,BMA220_REG_SUSPEND );if (ret <0 )return ret; -else if (ret ==BMA220_SUSPEND_SLEEP ) -return bma220_read_reg (spi,BMA220_REG_SUSPEND ); +if (ret ==BMA220_SUSPEND_SLEEP ) +return -EBUSY ;return 0 ; }
@@ -245,7 +249,7 @@ static int bma220_probe(struct spi_device *spi) indio_dev->available_scan_masks = bma220_accel_scan_masks; ret =bma220_init (data->spi_device); -if (ret <0 ) +if (ret)return ret; ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
Signature · 1 line
2.28.0
PATCH 2/8 iio: accel: bma220: Convert to use ->read_avail()
Convert to use ->read_avail() instead of open-coded attribute handling.
While here, fix the typo in array definition and append comma in case of the future extension.
--- drivers/iio/accel/bma220_spi.c | 36 ++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 15 deletions(-)
drivers/iio/accel/bma220_spi.c +21 -15
@@ -30,7 +30,6 @@#define BMA220_SUSPEND_WAKE 0x00#define BMA220_DEVICE_NAME "bma220" -#define BMA220_SCALE_AVAILABLE "0.623 1.248 2.491 4.983"#define BMA220_ACCEL_CHANNEL (index, reg, axis) { \ .type = IIO_ACCEL, \
@@ -55,19 +54,8 @@ enum bma220_axis { AXIS_Z, }; -static IIO_CONST_ATTR(in_accel_scale_available, BMA220_SCALE_AVAILABLE); - -static struct attribute *bma220_attributes[] = { - &iio_const_attr_in_accel_scale_available.dev_attr.attr, -NULL , -}; - -static const struct attribute_group bma220_attribute_group = { - .attrs = bma220_attributes, -}; - -static const int bma220_scale_table[][4 ] = { - {0 ,623000 }, {1 ,248000 }, {2 ,491000 }, {4 ,983000 } +static const int bma220_scale_table[][2 ] = { + {0 ,623000 }, {1 ,248000 }, {2 ,491000 }, {4 ,983000 }, };struct bma220_data {
@@ -182,10 +170,28 @@ static int bma220_write_raw(struct iio_dev *indio_dev,return -EINVAL ; } +static int bma220_read_avail (struct iio_dev *indio_dev, +struct iio_chan_spec const *chan, +const int **vals,int *type,int *length, +long mask) +{ +struct bma220_data *data =iio_priv (indio_dev); + +switch (mask) { +case IIO_CHAN_INFO_SCALE : + *vals = (int *)bma220_scale_table; + *type =IIO_VAL_INT_PLUS_MICRO ; + *length =ARRAY_SIZE (bma220_scale_table) *2 ; +return IIO_AVAIL_LIST ; +default : +return -EINVAL ; + } +} +static const struct iio_info bma220_info = { .read_raw = bma220_read_raw, .write_raw = bma220_write_raw, - .attrs = &bma220_attribute_group, + .read_avail = bma220_read_avail, };static int bma220_init (struct spi_device *spi)
Signature · 1 line
2.28.0
Jonathan Cameron
maintainerRe: [PATCH v1 2/8] iio: accel: bma220: Convert to use ->read_avail()
Quoted 6 lines · On Mon, 31 Aug 2020 12:08:07 +0300 Andy Shevchenko…
Convert to use ->read_avail() instead of open-coded attribute handling.
While here, fix the typo in array definition and append comma in case of the future extension.
Signed-off-by Andy Shevchenko <[email protected]>
I missed a build warning inline. Now fixed.
Quoted 39 lines
--- drivers/iio/accel/bma220_spi.c | 36 ++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 15 deletions(-)drivers/iio/accel/bma220_spi.c +2
-14@@ -30,7 +30,6 @@#define BMA220_SUSPEND_WAKE 0x00#define BMA220_DEVICE_NAME "bma220" -#define BMA220_SCALE_AVAILABLE "0.623 1.248 2.491 4.983"#define BMA220_ACCEL_CHANNEL (index, reg, axis) { \ .type = IIO_ACCEL, \@@ -55,19 +54,8 @@ enum bma220_axis { AXIS_Z, }; -static IIO_CONST_ATTR(in_accel_scale_available, BMA220_SCALE_AVAILABLE); - -static struct attribute *bma220_attributes[] = { - &iio_const_attr_in_accel_scale_available.dev_attr.attr, -NULL , -}; - -static const struct attribute_group bma220_attribute_group = { - .attrs = bma220_attributes, -}; - -static const int bma220_scale_table[][4 ] = { - {0 ,623000 }, {1 ,248000 }, {2 ,491000 }, {4 ,983000 } +static const int bma220_scale_table[][2 ] = { + {0 ,623000 }, {1 ,248000 }, {2 ,491000 }, {4 ,983000 }, };struct bma220_data {
drivers/iio/accel/bma220_spi.c static int bma220_write_raw(struct iio_dev *indio_dev, · line 178
Quoted 9 lines
drivers/iio/accel/bma220_spi.c +6
-0@@ -182,10 +170,28 @@ static int bma220_write_raw(struct iio_dev *indio_dev,return -EINVAL ; } +static int bma220_read_avail (struct iio_dev *indio_dev, +struct iio_chan_spec const *chan, +const int **vals,int *type,int *length, +long mask) +{ +struct bma220_data *data =iio_priv (indio_dev);
Not used.
Quoted 20 lines
drivers/iio/accel/bma220_spi.c +13
-1+ +switch (mask) { +case IIO_CHAN_INFO_SCALE : + *vals = (int *)bma220_scale_table; + *type =IIO_VAL_INT_PLUS_MICRO ; + *length =ARRAY_SIZE (bma220_scale_table) *2 ; +return IIO_AVAIL_LIST ; +default : +return -EINVAL ; + } +} +static const struct iio_info bma220_info = { .read_raw = bma220_read_raw, .write_raw = bma220_write_raw, - .attrs = &bma220_attribute_group, + .read_avail = bma220_read_avail, };static int bma220_init (struct spi_device *spi)
Re: [PATCH v1 2/8] iio: accel: bma220: Convert to use ->read_avail()
Quoted 4 lines · Jonathan Cameron
On Mon, 31 Aug 2020 12:08:07 +0300
Andy Shevchenko <[email protected]> wrote:
Quoted 8 lines
Quoted 6 lines
Convert to use ->read_avail() instead of open-coded attribute handling.
While here, fix the typo in array definition and append comma in case of the future extension.
Signed-off-by Andy Shevchenko <[email protected]>I missed a build warning inline. Now fixed.
Thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 3/8 iio: accel: bma220: Use dev_get_drvdata() directly
In reply to Andy ShevchenkoInstead of using to_spi_dev() + spi_get_drvdata(), use dev_get_drvdata() to make code simpler.
--- drivers/iio/accel/bma220_spi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/accel/bma220_spi.c +2 -4
@@ -291,8 +291,7 @@ static int bma220_remove(struct spi_device *spi)#ifdef CONFIG_PM_SLEEP static int bma220_suspend (struct device *dev) { -struct bma220_data *data = -iio_priv (spi_get_drvdata (to_spi_device (dev))); +struct bma220_data *data =iio_priv (dev_get_drvdata (dev));/* The chip can be suspended/woken up by a simple register read. */ return bma220_read_reg (data->spi_device,BMA220_REG_SUSPEND );
@@ -300,8 +299,7 @@ static int bma220_suspend(struct device *dev)static int bma220_resume (struct device *dev) { -struct bma220_data *data = -iio_priv (spi_get_drvdata (to_spi_device (dev))); +struct bma220_data *data =iio_priv (dev_get_drvdata (dev));return bma220_read_reg (data->spi_device,BMA220_REG_SUSPEND ); }
Signature · 1 line
2.28.0
PATCH 4/8 iio: accel: bma220: Mark PM functions as __maybe_unused
In reply to Andy ShevchenkoInstead of using ugly ifdeffery, mark PM functions as __maybe_unused.
--- drivers/iio/accel/bma220_spi.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/iio/accel/bma220_spi.c +3 -9
@@ -288,8 +288,7 @@ static int bma220_remove(struct spi_device *spi)return bma220_deinit (spi); } -#ifdef CONFIG_PM_SLEEP -static int bma220_suspend (struct device *dev) +static __maybe_unused int bma220_suspend (struct device *dev) {struct bma220_data *data =iio_priv (dev_get_drvdata (dev));
@@ -297,7 +296,7 @@ static int bma220_suspend(struct device *dev)return bma220_read_reg (data->spi_device,BMA220_REG_SUSPEND ); } -static int bma220_resume (struct device *dev) +static __maybe_unused int bma220_resume (struct device *dev) {struct bma220_data *data =iio_priv (dev_get_drvdata (dev));
@@ -306,11 +305,6 @@ static int bma220_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(bma220_pm_ops, bma220_suspend, bma220_resume); -#define BMA220_PM_OPS (&bma220_pm_ops) -#else -#define BMA220_PM_OPS NULL -#endif -static const struct spi_device_id bma220_spi_id[] = { {"bma220" ,0 }, {}
@@ -328,7 +322,7 @@ MODULE_DEVICE_TABLE(spi, bma220_spi_id);static struct spi_driver bma220_driver = { .driver = { .name ="bma220_spi" , - .pm =BMA220_PM_OPS , + .pm = &bma220_pm_ops, .acpi_match_table =ACPI_PTR (bma220_acpi_id), }, .probe = bma220_probe,
Signature · 1 line
2.28.0
PATCH 5/8 iio: accel: bma220: Drop ACPI_PTR() and accompanying ifdeffery
In reply to Andy ShevchenkoThe driver is quite likely used only on ACPI based platforms and rarely build with CONFIG_ACPI=n. Even though, the few dozens of bytes is better than ugly ifdeffery and inclusion of heavy header.
As a result, replace acpi.h with mod_devicetable.h.
--- drivers/iio/accel/bma220_spi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/accel/bma220_spi.c +2 -4
@@ -5,8 +5,8 @@* Copyright (c) 2016, Intel Corporation. */ -#include <linux/acpi.h> #include <linux/kernel.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/iio/buffer.h> #include <linux/iio/iio.h>
@@ -310,20 +310,18 @@ static const struct spi_device_id bma220_spi_id[] = { {} }; -#ifdef CONFIG_ACPI static const struct acpi_device_id bma220_acpi_id[] = { {"BMA0220" ,0 }, {} };MODULE_DEVICE_TABLE (spi, bma220_spi_id); -#endif static struct spi_driver bma220_driver = { .driver = { .name ="bma220_spi" , .pm = &bma220_pm_ops, - .acpi_match_table =ACPI_PTR (bma220_acpi_id), + .acpi_match_table = bma220_acpi_id, }, .probe = bma220_probe, .remove = bma220_remove,
Signature · 1 line
2.28.0
Jonathan Cameron
maintainerRe: [PATCH v1 5/8] iio: accel: bma220: Drop ACPI_PTR() and accompanying ifdeffery
Quoted 3 lines · On Mon, 31 Aug 2020 12:08:10 +0300 Andy Shevchenko…
The driver is quite likely used only on ACPI based platforms and rarely build with
CONFIG_ACPI=n. Even though, the few dozens of bytes is better than ugly ifdeffery and inclusion of heavy header.
Given this part is readily available on maker type break out boards I doubt it is mostly ACPI. Rest of the comment is fine though.
Jonathan
Quoted 44 lines
As a result, replace
acpi.hwithmod_devicetable.h.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/iio/accel/bma220_spi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/iio/accel/bma220_spi.c +2
-4@@ -5,8 +5,8 @@* Copyright (c) 2016, Intel Corporation. */ -#include <linux/acpi.h> #include <linux/kernel.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/iio/buffer.h> #include <linux/iio/iio.h> @@ -310,20 +310,18 @@ static const struct spi_device_id bma220_spi_id[] = { {} }; -#ifdef CONFIG_ACPI static const struct acpi_device_id bma220_acpi_id[] = { {"BMA0220" ,0 }, {} };MODULE_DEVICE_TABLE (spi, bma220_spi_id); -#endif static struct spi_driver bma220_driver = { .driver = { .name ="bma220_spi" , .pm = &bma220_pm_ops, - .acpi_match_table =ACPI_PTR (bma220_acpi_id), + .acpi_match_table = bma220_acpi_id, }, .probe = bma220_probe, .remove = bma220_remove,
Re: [PATCH v1 5/8] iio: accel: bma220: Drop ACPI_PTR() and accompanying ifdeffery
Quoted 10 lines · Jonathan Cameron
Quoted 3 lines · On Mon, 31 Aug 2020 12:08:10 +0300 Andy Shevchenko…
The driver is quite likely used only on ACPI based platforms and rarely build with
CONFIG_ACPI=n. Even though, the few dozens of bytes is better than ugly ifdeffery and inclusion of heavy header.Given this part is readily available on maker type break out boards I doubt it is mostly ACPI. Rest of the comment is fine though.
In-kernel use seems only ACPI (I grepped for pure SPI driver by name and didn't find anything).
I hope we will have DT support for that as well (basically means adding OF ID table).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH v1 5/8] iio: accel: bma220: Drop ACPI_PTR() and accompanying ifdeffery
Quoted 9 lines · On Mon, 31 Aug 2020 12:39:10 +0300 Andy Shevchenko <[email protected]>…
Quoted 8 lines · Jonathan Cameron
Quoted 3 lines · On Mon, 31 Aug 2020 12:08:10 +0300 Andy Shevchenko…
The driver is quite likely used only on ACPI based platforms and rarely build with
CONFIG_ACPI=n. Even though, the few dozens of bytes is better than ugly ifdeffery and inclusion of heavy header.
Quoted 8 lines
Quoted 2 lines
Given this part is readily available on maker type break out boards I doubt it is mostly ACPI. Rest of the comment is fine though.
In-kernel use seems only ACPI (I grepped for pure SPI driver by name and didn't find anything).
I hope we will have DT support for that as well (basically means adding OF ID table).
Good to add the explicit DT support, but I think the nasty fallback is still in place in which the old style ID table is used if we get a match without manufacturer ID.
So should be possible to instantiate it from DT even without the table.
Jonathan
Re: [PATCH v1 5/8] iio: accel: bma220: Drop ACPI_PTR() and accompanying ifdeffery
Quoted 19 lines · Jonathan Cameron
Quoted 8 lines · On Mon, 31 Aug 2020 12:39:10 +0300 Andy Shevchenko <[email protected]>…
Quoted 7 lines · Jonathan Cameron
Quoted 3 lines · On Mon, 31 Aug 2020 12:08:10 +0300 Andy Shevchenko…
The driver is quite likely used only on ACPI based platforms and rarely build with
CONFIG_ACPI=n. Even though, the few dozens of bytes is better than ugly ifdeffery and inclusion of heavy header.Quoted 8 lines
Quoted 2 lines
Given this part is readily available on maker type break out boards I doubt it is mostly ACPI. Rest of the comment is fine though.
In-kernel use seems only ACPI (I grepped for pure SPI driver by name and didn't find anything).
I hope we will have DT support for that as well (basically means adding OF ID table).
Quoted 5 lines
Good to add the explicit DT support, but I think the nasty fallback is still in place in which the old style ID table is used if we get a match without manufacturer ID.
So should be possible to instantiate it from DT even without the table.
True, but as I said, there is no evidence that there is a single user in kernel.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 6/8 iio: accel: bma220: Group IIO headers together
In reply to Andy ShevchenkoGroup IIO headers together and follow the common pattern of header inclusion, i.e. more generic first.
--- drivers/iio/accel/bma220_spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/accel/bma220_spi.c +2 -1
@@ -8,10 +8,11 @@#include <linux/kernel.h> #include <linux/mod_devicetable.h> #include <linux/module.h> +#include <linux/spi/spi.h> +#include <linux/iio/buffer.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> -#include <linux/spi/spi.h> #include <linux/iio/trigger_consumer.h> #include <linux/iio/triggered_buffer.h>
Signature · 1 line
2.28.0
PATCH 7/8 iio: accel: bma220: Use BIT() and GENMASK() macros
In reply to Andy ShevchenkoCode is better to read when numbers of bit are explicitly used.
--- drivers/iio/accel/bma220_spi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/accel/bma220_spi.c +3 -2
@@ -5,6 +5,7 @@* Copyright (c) 2016, Intel Corporation. */ +#include <linux/bits.h> #include <linux/kernel.h> #include <linux/mod_devicetable.h> #include <linux/module.h>
@@ -24,8 +25,8 @@#define BMA220_REG_SUSPEND 0x18#define BMA220_CHIP_ID 0xDD -#define BMA220_READ_MASK 0x80 -#define BMA220_RANGE_MASK 0x03 +#define BMA220_READ_MASK BIT(7) +#define BMA220_RANGE_MASK GENMASK(1, 0)#define BMA220_DATA_SHIFT 2#define BMA220_SUSPEND_SLEEP 0xFF#define BMA220_SUSPEND_WAKE 0x00
Signature · 1 line
2.28.0
PATCH 8/8 iio: accel: bma220: Remove unneeded blank lines
In reply to Andy ShevchenkoThere are few blank lines that split structure definitions with their users. Remove them to increase readability.
While here, update copyright year.
--- drivers/iio/accel/bma220_spi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/iio/accel/bma220_spi.c +1 -4
@@ -2,7 +2,7 @@/** * BMA220 Digital triaxial acceleration sensor driver * -* Copyright (c) 2016, Intel Corporation. +* Copyright (c) 2016,2020 Intel Corporation. */ #include <linux/bits.h>
@@ -304,7 +304,6 @@ static __maybe_unused int bma220_resume(struct device *dev)return bma220_read_reg (data->spi_device,BMA220_REG_SUSPEND ); } - static SIMPLE_DEV_PM_OPS(bma220_pm_ops, bma220_suspend, bma220_resume);static const struct spi_device_id bma220_spi_id[] = {
@@ -316,7 +315,6 @@ static const struct acpi_device_id bma220_acpi_id[] = { {"BMA0220", 0}, {} }; -MODULE_DEVICE_TABLE (spi, bma220_spi_id); static struct spi_driver bma220_driver = {
@@ -329,7 +327,6 @@ static struct spi_driver bma220_driver = { .remove = bma220_remove, .id_table = bma220_spi_id, }; -module_spi_driver (bma220_driver);MODULE_AUTHOR ("Tiberiu Breana <[email protected]>" );
Signature · 1 line
2.28.0
Jonathan Cameron
maintainerQuoted 4 lines · On Mon, 31 Aug 2020 12:08:06 +0300 Andy Shevchenko…
Potentially
bma220_init()andbma220_deinit()may return positive codes. Fix the logic to return proper error codes instead.Signed-off-by Andy Shevchenko <[email protected]>
Hi Andy
A nice straight forward set and I suspect we aren't going to get any other reviews, hence...
Series applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to poke at it.
Thanks,
Jonathan
Quoted 47 lines
--- drivers/iio/accel/bma220_spi.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)drivers/iio/accel/bma220_spi.c +9
-5@@ -198,10 +198,12 @@ static int bma220_init(struct spi_device *spi)/* Make sure the chip is powered on */ ret =bma220_read_reg (spi,BMA220_REG_SUSPEND ); +if (ret ==BMA220_SUSPEND_WAKE ) + ret =bma220_read_reg (spi,BMA220_REG_SUSPEND );if (ret <0 )return ret; -else if (ret ==BMA220_SUSPEND_WAKE ) -return bma220_read_reg (spi,BMA220_REG_SUSPEND ); +if (ret ==BMA220_SUSPEND_WAKE ) +return -EBUSY ;return 0 ; }@@ -212,10 +214,12 @@ static int bma220_deinit(struct spi_device *spi)/* Make sure the chip is powered off */ ret =bma220_read_reg (spi,BMA220_REG_SUSPEND ); +if (ret ==BMA220_SUSPEND_SLEEP ) + ret =bma220_read_reg (spi,BMA220_REG_SUSPEND );if (ret <0 )return ret; -else if (ret ==BMA220_SUSPEND_SLEEP ) -return bma220_read_reg (spi,BMA220_REG_SUSPEND ); +if (ret ==BMA220_SUSPEND_SLEEP ) +return -EBUSY ;return 0 ; }@@ -245,7 +249,7 @@ static int bma220_probe(struct spi_device *spi) indio_dev->available_scan_masks = bma220_accel_scan_masks; ret =bma220_init (data->spi_device); -if (ret <0 ) +if (ret)return ret; ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
Quoted 6 lines · Jonathan Cameron
Quoted 3 lines · On Mon, 31 Aug 2020 12:08:06 +0300 Andy Shevchenko…
Potentially
bma220_init()andbma220_deinit()may return positive codes. Fix the logic to return proper error codes instead.
Quoted 8 lines
Quoted 1 line
Signed-off-by Andy Shevchenko <[email protected]>Hi Andy
A nice straight forward set and I suspect we aren't going to get any other reviews, hence...
Series applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to poke at it.
Thanks!
P.S. Consider this series as an example what can be done to many IIO drivers in order to clean them up. My focus, of course, ACPI interaction:
- use of ACPI_PTR / ifdeffery
- inclusion of acpi.h
- ...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerQuoted 16 lines · On Mon, 31 Aug 2020 14:49:04 +0300 Andy Shevchenko…
Quoted 6 lines · Jonathan Cameron
Quoted 3 lines · On Mon, 31 Aug 2020 12:08:06 +0300 Andy Shevchenko…
Potentially
bma220_init()andbma220_deinit()may return positive codes. Fix the logic to return proper error codes instead.Quoted 8 lines
Quoted 1 line
Signed-off-by Andy Shevchenko <[email protected]>Hi Andy
A nice straight forward set and I suspect we aren't going to get any other reviews, hence...
Series applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to poke at it.
Quoted 8 lines
Thanks!
P.S. Consider this series as an example what can be done to many IIO drivers in order to clean them up. My focus, of course, ACPI interaction:
- use ofACPI_PTR/ ifdeffery
- inclusion ofacpi.h
- ...
Thanks. This is probably a good one for anyone who wants to grow their experience in kernel patches etc. I'll add it to my more or less never ending list if not and get to it eventually.
In the meantime we'll try to avoid introducing any new variants!
Jonathan
Quoted 28 lines · On Mon, 31 Aug 2020 15:12:01 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 16 lines · On Mon, 31 Aug 2020 14:49:04 +0300 Andy Shevchenko…
Quoted 6 lines · Jonathan Cameron
Quoted 3 lines · On Mon, 31 Aug 2020 12:08:06 +0300 Andy Shevchenko…
Potentially
bma220_init()andbma220_deinit()may return positive codes. Fix the logic to return proper error codes instead.Quoted 8 lines
Quoted 1 line
Signed-off-by Andy Shevchenko <[email protected]>Hi Andy
A nice straight forward set and I suspect we aren't going to get any other reviews, hence...
Series applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to poke at it.
Quoted 8 lines
Thanks!
P.S. Consider this series as an example what can be done to many IIO drivers in order to clean them up. My focus, of course, ACPI interaction:
- use ofACPI_PTR/ ifdeffery
- inclusion ofacpi.h
- ...
Quoted 7 lines
Thanks. This is probably a good one for anyone who wants to grow their experience in kernel patches etc. I'll add it to my more or less never ending list if not and get to it eventually.
In the meantime we'll try to avoid introducing any new variants!
Jonathan
Andy, one thing that might want adjusting is the docs that suggest doing ACPI_PTR and ifdeffery.
J
Quoted 5 lines · Jonathan Cameron
Quoted 3 lines · On Mon, 31 Aug 2020 15:12:01 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 1 line · On Mon, 31 Aug 2020 14:49:04 +0300 Andy Shevchenko…
On Mon, Aug 31, 2020 at 10:21:45AM +0100, Jonathan Cameron wrote:
...
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
P.S. Consider this series as an example what can be done to many IIO drivers in order to clean them up. My focus, of course, ACPI interaction:
- use ofACPI_PTR/ ifdeffery
- inclusion ofacpi.h
- ...Thanks. This is probably a good one for anyone who wants to grow their experience in kernel patches etc. I'll add it to my more or less never ending list if not and get to it eventually.
Quoted 6 lines
Quoted 1 line
In the meantime we'll try to avoid introducing any new variants!
Andy, one thing that might want adjusting is the docs that suggest doing
ACPI_PTRand ifdeffery.
I briefly looked at the text and it seems that there is not one problem (typo, etc) in it. The entire document needs to be revisited. Unfortunately I have no time right now to do that. Regarding ACPI_PTR() it looks like case by case, because in the example you pointed out it's just a style preference (and somebody may actually want to save few dozen of bytes in their driver to reduce memory footprint). That said, we rather need to describe both options and tell the difference.
Signature · 2 lines
With Best Regards, Andy Shevchenko