* [PATCH v4 1/1] staging: iio: adc: ad7280a: use devm_* APIs
@ 2018-10-29 16:52 Slawomir Stepien
2018-11-03 12:21 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Slawomir Stepien @ 2018-10-29 16:52 UTC (permalink / raw)
To: lars, Michael.Hennerich, jic23, knaack.h, pmeerw
Cc: linux-iio, gregkh, Slawomir Stepien
devm_* APIs are device managed and make code simpler.
Signed-off-by: Slawomir Stepien <sst@poczta.fm>
---
drivers/staging/iio/adc/ad7280a.c | 95 +++++++++++++------------------
1 file changed, 39 insertions(+), 56 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index b736275c10f5..1263b70693ed 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -342,6 +342,14 @@ static int ad7280_read_all_channels(struct ad7280_state *st, unsigned int cnt,
return sum;
}
+static void ad7280_sw_power_down(void *data)
+{
+ struct ad7280_state *st = data;
+
+ ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_HB, 1,
+ AD7280A_CTRL_HB_PWRDN_SW | st->ctrl_hb);
+}
+
static int ad7280_chain_setup(struct ad7280_state *st)
{
unsigned int val, n;
@@ -492,8 +500,8 @@ static int ad7280_channel_init(struct ad7280_state *st)
{
int dev, ch, cnt;
- st->channels = kcalloc((st->slave_num + 1) * 12 + 2,
- sizeof(*st->channels), GFP_KERNEL);
+ st->channels = devm_kcalloc(&st->spi->dev, (st->slave_num + 1) * 12 + 2,
+ sizeof(*st->channels), GFP_KERNEL);
if (!st->channels)
return -ENOMEM;
@@ -552,16 +560,18 @@ static int ad7280_channel_init(struct ad7280_state *st)
static int ad7280_attr_init(struct ad7280_state *st)
{
int dev, ch, cnt;
+ unsigned int index;
- st->iio_attr = kcalloc(2, sizeof(*st->iio_attr) *
- (st->slave_num + 1) * AD7280A_CELLS_PER_DEV,
- GFP_KERNEL);
+ st->iio_attr = devm_kcalloc(&st->spi->dev, 2, sizeof(*st->iio_attr) *
+ (st->slave_num + 1) * AD7280A_CELLS_PER_DEV,
+ GFP_KERNEL);
if (!st->iio_attr)
return -ENOMEM;
for (dev = 0, cnt = 0; dev <= st->slave_num; dev++)
for (ch = AD7280A_CELL_VOLTAGE_1; ch <= AD7280A_CELL_VOLTAGE_6;
ch++, cnt++) {
+ index = dev * AD7280A_CELLS_PER_DEV + ch;
st->iio_attr[cnt].address =
ad7280a_devaddr(dev) << 8 | ch;
st->iio_attr[cnt].dev_attr.attr.mode =
@@ -571,10 +581,9 @@ static int ad7280_attr_init(struct ad7280_state *st)
st->iio_attr[cnt].dev_attr.store =
ad7280_store_balance_sw;
st->iio_attr[cnt].dev_attr.attr.name =
- kasprintf(GFP_KERNEL,
- "in%d-in%d_balance_switch_en",
- dev * AD7280A_CELLS_PER_DEV + ch,
- dev * AD7280A_CELLS_PER_DEV + ch + 1);
+ devm_kasprintf(&st->spi->dev, GFP_KERNEL,
+ "in%d-in%d_balance_switch_en",
+ index, index + 1);
ad7280_attributes[cnt] =
&st->iio_attr[cnt].dev_attr.attr;
cnt++;
@@ -588,10 +597,9 @@ static int ad7280_attr_init(struct ad7280_state *st)
st->iio_attr[cnt].dev_attr.store =
ad7280_store_balance_timer;
st->iio_attr[cnt].dev_attr.attr.name =
- kasprintf(GFP_KERNEL,
- "in%d-in%d_balance_timer",
- dev * AD7280A_CELLS_PER_DEV + ch,
- dev * AD7280A_CELLS_PER_DEV + ch + 1);
+ devm_kasprintf(&st->spi->dev, GFP_KERNEL,
+ "in%d-in%d_balance_timer",
+ index, index + 1);
ad7280_attributes[cnt] =
&st->iio_attr[cnt].dev_attr.attr;
}
@@ -909,65 +917,41 @@ static int ad7280_probe(struct spi_device *spi)
ret = ad7280_attr_init(st);
if (ret < 0)
- goto error_free_channels;
+ return ret;
- ret = iio_device_register(indio_dev);
+ ret = devm_add_action(&spi->dev, ad7280_sw_power_down, st);
if (ret)
- goto error_free_attr;
+ return ret;
+
+ ret = devm_iio_device_register(&spi->dev, indio_dev);
+ if (ret)
+ return ret;
if (spi->irq > 0) {
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER,
AD7280A_ALERT, 1,
AD7280A_ALERT_RELAY_SIG_CHAIN_DOWN);
if (ret)
- goto error_unregister;
+ return ret;
ret = ad7280_write(st, ad7280a_devaddr(st->slave_num),
AD7280A_ALERT, 0,
AD7280A_ALERT_GEN_STATIC_HIGH |
(pdata->chain_last_alert_ignore & 0xF));
if (ret)
- goto error_unregister;
-
- ret = request_threaded_irq(spi->irq,
- NULL,
- ad7280_event_handler,
- IRQF_TRIGGER_FALLING |
- IRQF_ONESHOT,
- indio_dev->name,
- indio_dev);
+ return ret;
+
+ ret = devm_request_threaded_irq(&spi->dev, spi->irq,
+ NULL,
+ ad7280_event_handler,
+ IRQF_TRIGGER_FALLING |
+ IRQF_ONESHOT,
+ indio_dev->name,
+ indio_dev);
if (ret)
- goto error_unregister;
+ return ret;
}
- return 0;
-error_unregister:
- iio_device_unregister(indio_dev);
-
-error_free_attr:
- kfree(st->iio_attr);
-
-error_free_channels:
- kfree(st->channels);
-
- return ret;
-}
-
-static int ad7280_remove(struct spi_device *spi)
-{
- struct iio_dev *indio_dev = spi_get_drvdata(spi);
- struct ad7280_state *st = iio_priv(indio_dev);
-
- if (spi->irq > 0)
- free_irq(spi->irq, indio_dev);
- iio_device_unregister(indio_dev);
-
- ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_HB, 1,
- AD7280A_CTRL_HB_PWRDN_SW | st->ctrl_hb);
-
- kfree(st->channels);
- kfree(st->iio_attr);
-
return 0;
}
@@ -982,7 +966,6 @@ static struct spi_driver ad7280_driver = {
.name = "ad7280",
},
.probe = ad7280_probe,
- .remove = ad7280_remove,
.id_table = ad7280_id,
};
module_spi_driver(ad7280_driver);
--
2.19.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v4 1/1] staging: iio: adc: ad7280a: use devm_* APIs
2018-10-29 16:52 [PATCH v4 1/1] staging: iio: adc: ad7280a: use devm_* APIs Slawomir Stepien
@ 2018-11-03 12:21 ` Jonathan Cameron
2018-11-04 10:48 ` Slawomir Stepien
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2018-11-03 12:21 UTC (permalink / raw)
To: Slawomir Stepien
Cc: lars, Michael.Hennerich, knaack.h, pmeerw, linux-iio, gregkh
On Mon, 29 Oct 2018 17:52:41 +0100
Slawomir Stepien <sst@poczta.fm> wrote:
> devm_* APIs are device managed and make code simpler.
>
> Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Very nearly perfect (I think).
But there is one path where we don't quite manage to clean everything up.
> ---
Also, I should be seeing a version log here to avoid me having to look back
at previous versions (potentially) to remind me what needed changing.
Thanks,
Jonathan
> drivers/staging/iio/adc/ad7280a.c | 95 +++++++++++++------------------
> 1 file changed, 39 insertions(+), 56 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
> index b736275c10f5..1263b70693ed 100644
> --- a/drivers/staging/iio/adc/ad7280a.c
> +++ b/drivers/staging/iio/adc/ad7280a.c
> @@ -342,6 +342,14 @@ static int ad7280_read_all_channels(struct ad7280_state *st, unsigned int cnt,
> return sum;
> }
>
> +static void ad7280_sw_power_down(void *data)
> +{
> + struct ad7280_state *st = data;
> +
> + ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_HB, 1,
> + AD7280A_CTRL_HB_PWRDN_SW | st->ctrl_hb);
> +}
> +
> static int ad7280_chain_setup(struct ad7280_state *st)
> {
> unsigned int val, n;
> @@ -492,8 +500,8 @@ static int ad7280_channel_init(struct ad7280_state *st)
> {
> int dev, ch, cnt;
>
> - st->channels = kcalloc((st->slave_num + 1) * 12 + 2,
> - sizeof(*st->channels), GFP_KERNEL);
> + st->channels = devm_kcalloc(&st->spi->dev, (st->slave_num + 1) * 12 + 2,
> + sizeof(*st->channels), GFP_KERNEL);
> if (!st->channels)
> return -ENOMEM;
>
> @@ -552,16 +560,18 @@ static int ad7280_channel_init(struct ad7280_state *st)
> static int ad7280_attr_init(struct ad7280_state *st)
> {
> int dev, ch, cnt;
> + unsigned int index;
>
> - st->iio_attr = kcalloc(2, sizeof(*st->iio_attr) *
> - (st->slave_num + 1) * AD7280A_CELLS_PER_DEV,
> - GFP_KERNEL);
> + st->iio_attr = devm_kcalloc(&st->spi->dev, 2, sizeof(*st->iio_attr) *
> + (st->slave_num + 1) * AD7280A_CELLS_PER_DEV,
> + GFP_KERNEL);
> if (!st->iio_attr)
> return -ENOMEM;
>
> for (dev = 0, cnt = 0; dev <= st->slave_num; dev++)
> for (ch = AD7280A_CELL_VOLTAGE_1; ch <= AD7280A_CELL_VOLTAGE_6;
> ch++, cnt++) {
> + index = dev * AD7280A_CELLS_PER_DEV + ch;
> st->iio_attr[cnt].address =
> ad7280a_devaddr(dev) << 8 | ch;
> st->iio_attr[cnt].dev_attr.attr.mode =
> @@ -571,10 +581,9 @@ static int ad7280_attr_init(struct ad7280_state *st)
> st->iio_attr[cnt].dev_attr.store =
> ad7280_store_balance_sw;
> st->iio_attr[cnt].dev_attr.attr.name =
> - kasprintf(GFP_KERNEL,
> - "in%d-in%d_balance_switch_en",
> - dev * AD7280A_CELLS_PER_DEV + ch,
> - dev * AD7280A_CELLS_PER_DEV + ch + 1);
> + devm_kasprintf(&st->spi->dev, GFP_KERNEL,
> + "in%d-in%d_balance_switch_en",
> + index, index + 1);
> ad7280_attributes[cnt] =
> &st->iio_attr[cnt].dev_attr.attr;
> cnt++;
> @@ -588,10 +597,9 @@ static int ad7280_attr_init(struct ad7280_state *st)
> st->iio_attr[cnt].dev_attr.store =
> ad7280_store_balance_timer;
> st->iio_attr[cnt].dev_attr.attr.name =
> - kasprintf(GFP_KERNEL,
> - "in%d-in%d_balance_timer",
> - dev * AD7280A_CELLS_PER_DEV + ch,
> - dev * AD7280A_CELLS_PER_DEV + ch + 1);
> + devm_kasprintf(&st->spi->dev, GFP_KERNEL,
> + "in%d-in%d_balance_timer",
> + index, index + 1);
> ad7280_attributes[cnt] =
> &st->iio_attr[cnt].dev_attr.attr;
> }
> @@ -909,65 +917,41 @@ static int ad7280_probe(struct spi_device *spi)
>
> ret = ad7280_attr_init(st);
> if (ret < 0)
> - goto error_free_channels;
> + return ret;
>
> - ret = iio_device_register(indio_dev);
> + ret = devm_add_action(&spi->dev, ad7280_sw_power_down, st);
> if (ret)
What state are we left in if the devm_add_action fails?
Answer: Everything is unwound except the thing we were adding the action
for. So you need to call ad7280_sw_power_down in the error path here.
> - goto error_free_attr;
> + return ret;
> +
> + ret = devm_iio_device_register(&spi->dev, indio_dev);
> + if (ret)
> + return ret;
>
> if (spi->irq > 0) {
> ret = ad7280_write(st, AD7280A_DEVADDR_MASTER,
> AD7280A_ALERT, 1,
> AD7280A_ALERT_RELAY_SIG_CHAIN_DOWN);
> if (ret)
> - goto error_unregister;
> + return ret;
>
> ret = ad7280_write(st, ad7280a_devaddr(st->slave_num),
> AD7280A_ALERT, 0,
> AD7280A_ALERT_GEN_STATIC_HIGH |
> (pdata->chain_last_alert_ignore & 0xF));
> if (ret)
> - goto error_unregister;
> -
> - ret = request_threaded_irq(spi->irq,
> - NULL,
> - ad7280_event_handler,
> - IRQF_TRIGGER_FALLING |
> - IRQF_ONESHOT,
> - indio_dev->name,
> - indio_dev);
> + return ret;
> +
> + ret = devm_request_threaded_irq(&spi->dev, spi->irq,
> + NULL,
> + ad7280_event_handler,
> + IRQF_TRIGGER_FALLING |
> + IRQF_ONESHOT,
> + indio_dev->name,
> + indio_dev);
> if (ret)
> - goto error_unregister;
> + return ret;
> }
>
> - return 0;
> -error_unregister:
> - iio_device_unregister(indio_dev);
> -
> -error_free_attr:
> - kfree(st->iio_attr);
> -
> -error_free_channels:
> - kfree(st->channels);
> -
> - return ret;
> -}
> -
> -static int ad7280_remove(struct spi_device *spi)
> -{
> - struct iio_dev *indio_dev = spi_get_drvdata(spi);
> - struct ad7280_state *st = iio_priv(indio_dev);
> -
> - if (spi->irq > 0)
> - free_irq(spi->irq, indio_dev);
> - iio_device_unregister(indio_dev);
> -
> - ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_HB, 1,
> - AD7280A_CTRL_HB_PWRDN_SW | st->ctrl_hb);
> -
> - kfree(st->channels);
> - kfree(st->iio_attr);
> -
> return 0;
> }
>
> @@ -982,7 +966,6 @@ static struct spi_driver ad7280_driver = {
> .name = "ad7280",
> },
> .probe = ad7280_probe,
> - .remove = ad7280_remove,
> .id_table = ad7280_id,
> };
> module_spi_driver(ad7280_driver);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4 1/1] staging: iio: adc: ad7280a: use devm_* APIs
2018-11-03 12:21 ` Jonathan Cameron
@ 2018-11-04 10:48 ` Slawomir Stepien
0 siblings, 0 replies; 4+ messages in thread
From: Slawomir Stepien @ 2018-11-04 10:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: lars, Michael.Hennerich, knaack.h, pmeerw, linux-iio, gregkh
On lis 03, 2018 12:21, Jonathan Cameron wrote:
> On Mon, 29 Oct 2018 17:52:41 +0100
> Slawomir Stepien <sst@poczta.fm> wrote:
>
> > devm_* APIs are device managed and make code simpler.
> >
> > Signed-off-by: Slawomir Stepien <sst@poczta.fm>
> Very nearly perfect (I think).
>
> But there is one path where we don't quite manage to clean everything up.
Or maybe more than on. See below and in v5.
> > ---
> Also, I should be seeing a version log here to avoid me having to look back
> at previous versions (potentially) to remind me what needed changing.
I am so sorry about that. Will add the whole history in v5.
> > @@ -909,65 +917,41 @@ static int ad7280_probe(struct spi_device *spi)
> >
> > ret = ad7280_attr_init(st);
> > if (ret < 0)
> > - goto error_free_channels;
> > + return ret;
> >
> > - ret = iio_device_register(indio_dev);
> > + ret = devm_add_action(&spi->dev, ad7280_sw_power_down, st);
> > if (ret)
> What state are we left in if the devm_add_action fails?
>
> Answer: Everything is unwound except the thing we were adding the action
> for. So you need to call ad7280_sw_power_down in the error path here.
OK. I have also moved the devm_add_action call just after spi_setup in v5. So
the action will be also called for fail in: ad7280_chain_setup,
ad7280_channel_init and ad7280_attr_init. I think it is ok to do so if we are
calling this action also when devm_add_action fails.
> > - goto error_free_attr;
> > + return ret;
Thank you for review!
--
Slawomir Stepien
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v4 1/1] staging: iio: adc: ad7280a: use devm_* APIs
@ 2018-10-20 15:18 Slawomir Stepien
0 siblings, 0 replies; 4+ messages in thread
From: Slawomir Stepien @ 2018-10-20 15:18 UTC (permalink / raw)
To: lars, Michael.Hennerich, jic23, knaack.h, pmeerw; +Cc: linux-iio, gregkh
devm_* APIs are device managed and make code simpler.
Signed-off-by: Slawomir Stepien <sst@poczta.fm>
---
Since v3:
* kasprintf -> devm_kasprintf
* move the index calculation out of devm_kasprintf call so it all can fit into
80 lines
Since v2:
* iio_device_register -> devm_iio_device_register
Since v1:
* request_threaded_irq -> devm_request_threaded_irq
---
drivers/staging/iio/adc/ad7280a.c | 77 ++++++++++++-------------------
1 file changed, 30 insertions(+), 47 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index b736275c10f5..7427f7345313 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -8,7 +8,6 @@
#include <linux/device.h>
#include <linux/kernel.h>
-#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/spi/spi.h>
#include <linux/err.h>
@@ -492,8 +491,8 @@ static int ad7280_channel_init(struct ad7280_state *st)
{
int dev, ch, cnt;
- st->channels = kcalloc((st->slave_num + 1) * 12 + 2,
- sizeof(*st->channels), GFP_KERNEL);
+ st->channels = devm_kcalloc(&st->spi->dev, (st->slave_num + 1) * 12 + 2,
+ sizeof(*st->channels), GFP_KERNEL);
if (!st->channels)
return -ENOMEM;
@@ -552,16 +551,18 @@ static int ad7280_channel_init(struct ad7280_state *st)
static int ad7280_attr_init(struct ad7280_state *st)
{
int dev, ch, cnt;
+ unsigned int index;
- st->iio_attr = kcalloc(2, sizeof(*st->iio_attr) *
- (st->slave_num + 1) * AD7280A_CELLS_PER_DEV,
- GFP_KERNEL);
+ st->iio_attr = devm_kcalloc(&st->spi->dev, 2, sizeof(*st->iio_attr) *
+ (st->slave_num + 1) * AD7280A_CELLS_PER_DEV,
+ GFP_KERNEL);
if (!st->iio_attr)
return -ENOMEM;
for (dev = 0, cnt = 0; dev <= st->slave_num; dev++)
for (ch = AD7280A_CELL_VOLTAGE_1; ch <= AD7280A_CELL_VOLTAGE_6;
ch++, cnt++) {
+ index = dev * AD7280A_CELLS_PER_DEV + ch;
st->iio_attr[cnt].address =
ad7280a_devaddr(dev) << 8 | ch;
st->iio_attr[cnt].dev_attr.attr.mode =
@@ -571,10 +572,9 @@ static int ad7280_attr_init(struct ad7280_state *st)
st->iio_attr[cnt].dev_attr.store =
ad7280_store_balance_sw;
st->iio_attr[cnt].dev_attr.attr.name =
- kasprintf(GFP_KERNEL,
- "in%d-in%d_balance_switch_en",
- dev * AD7280A_CELLS_PER_DEV + ch,
- dev * AD7280A_CELLS_PER_DEV + ch + 1);
+ devm_kasprintf(&st->spi->dev, GFP_KERNEL,
+ "in%d-in%d_balance_switch_en",
+ index, index + 1);
ad7280_attributes[cnt] =
&st->iio_attr[cnt].dev_attr.attr;
cnt++;
@@ -588,10 +588,9 @@ static int ad7280_attr_init(struct ad7280_state *st)
st->iio_attr[cnt].dev_attr.store =
ad7280_store_balance_timer;
st->iio_attr[cnt].dev_attr.attr.name =
- kasprintf(GFP_KERNEL,
- "in%d-in%d_balance_timer",
- dev * AD7280A_CELLS_PER_DEV + ch,
- dev * AD7280A_CELLS_PER_DEV + ch + 1);
+ devm_kasprintf(&st->spi->dev, GFP_KERNEL,
+ "in%d-in%d_balance_timer",
+ index, index + 1);
ad7280_attributes[cnt] =
&st->iio_attr[cnt].dev_attr.attr;
}
@@ -692,7 +691,8 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
unsigned int *channels;
int i, ret;
- channels = kcalloc(st->scan_cnt, sizeof(*channels), GFP_KERNEL);
+ channels = devm_kcalloc(&st->spi->dev, st->scan_cnt, sizeof(*channels),
+ GFP_KERNEL);
if (!channels)
return IRQ_HANDLED;
@@ -744,7 +744,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
}
out:
- kfree(channels);
+ devm_kfree(&st->spi->dev, channels);
return IRQ_HANDLED;
}
@@ -909,48 +909,38 @@ static int ad7280_probe(struct spi_device *spi)
ret = ad7280_attr_init(st);
if (ret < 0)
- goto error_free_channels;
+ return ret;
- ret = iio_device_register(indio_dev);
+ ret = devm_iio_device_register(&spi->dev, indio_dev);
if (ret)
- goto error_free_attr;
+ return ret;
if (spi->irq > 0) {
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER,
AD7280A_ALERT, 1,
AD7280A_ALERT_RELAY_SIG_CHAIN_DOWN);
if (ret)
- goto error_unregister;
+ return ret;
ret = ad7280_write(st, ad7280a_devaddr(st->slave_num),
AD7280A_ALERT, 0,
AD7280A_ALERT_GEN_STATIC_HIGH |
(pdata->chain_last_alert_ignore & 0xF));
if (ret)
- goto error_unregister;
-
- ret = request_threaded_irq(spi->irq,
- NULL,
- ad7280_event_handler,
- IRQF_TRIGGER_FALLING |
- IRQF_ONESHOT,
- indio_dev->name,
- indio_dev);
+ return ret;
+
+ ret = devm_request_threaded_irq(&spi->dev, spi->irq,
+ NULL,
+ ad7280_event_handler,
+ IRQF_TRIGGER_FALLING |
+ IRQF_ONESHOT,
+ indio_dev->name,
+ indio_dev);
if (ret)
- goto error_unregister;
+ return ret;
}
return 0;
-error_unregister:
- iio_device_unregister(indio_dev);
-
-error_free_attr:
- kfree(st->iio_attr);
-
-error_free_channels:
- kfree(st->channels);
-
- return ret;
}
static int ad7280_remove(struct spi_device *spi)
@@ -958,16 +948,9 @@ static int ad7280_remove(struct spi_device *spi)
struct iio_dev *indio_dev = spi_get_drvdata(spi);
struct ad7280_state *st = iio_priv(indio_dev);
- if (spi->irq > 0)
- free_irq(spi->irq, indio_dev);
- iio_device_unregister(indio_dev);
-
ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_HB, 1,
AD7280A_CTRL_HB_PWRDN_SW | st->ctrl_hb);
- kfree(st->channels);
- kfree(st->iio_attr);
-
return 0;
}
--
2.19.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-04 20:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-29 16:52 [PATCH v4 1/1] staging: iio: adc: ad7280a: use devm_* APIs Slawomir Stepien
2018-11-03 12:21 ` Jonathan Cameron
2018-11-04 10:48 ` Slawomir Stepien
-- strict thread matches above, loose matches on Subject: below --
2018-10-20 15:18 Slawomir Stepien
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.