* [PATCH v1 1/1] iio: gyro: mpu3050: Make use of device properties
@ 2022-04-13 16:30 Andy Shevchenko
2022-04-16 11:18 ` Jonathan Cameron
2022-04-17 13:51 ` Linus Walleij
0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-04-13 16:30 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio, linux-kernel
Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Andy Shevchenko
Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.
While at it, reuse temporary device pointer in the same function.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/iio/gyro/mpu3050-core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
index ea387efab62d..a2dafdb64692 100644
--- a/drivers/iio/gyro/mpu3050-core.c
+++ b/drivers/iio/gyro/mpu3050-core.c
@@ -26,6 +26,7 @@
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
+#include <linux/property.h>
#include <linux/random.h>
#include <linux/slab.h>
@@ -1050,6 +1051,7 @@ static const struct iio_trigger_ops mpu3050_trigger_ops = {
static int mpu3050_trigger_probe(struct iio_dev *indio_dev, int irq)
{
struct mpu3050 *mpu3050 = iio_priv(indio_dev);
+ struct device *dev = mpu3050->dev;
unsigned long irq_trig;
int ret;
@@ -1061,8 +1063,7 @@ static int mpu3050_trigger_probe(struct iio_dev *indio_dev, int irq)
return -ENOMEM;
/* Check if IRQ is open drain */
- if (of_property_read_bool(mpu3050->dev->of_node, "drive-open-drain"))
- mpu3050->irq_opendrain = true;
+ mpu3050->irq_opendrain = device_property_read_bool(dev, "drive-open-drain");
irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq));
/*
@@ -1118,13 +1119,12 @@ static int mpu3050_trigger_probe(struct iio_dev *indio_dev, int irq)
mpu3050->trig->name,
mpu3050->trig);
if (ret) {
- dev_err(mpu3050->dev,
- "can't get IRQ %d, error %d\n", irq, ret);
+ dev_err(dev, "can't get IRQ %d, error %d\n", irq, ret);
return ret;
}
mpu3050->irq = irq;
- mpu3050->trig->dev.parent = mpu3050->dev;
+ mpu3050->trig->dev.parent = dev;
mpu3050->trig->ops = &mpu3050_trigger_ops;
iio_trigger_set_drvdata(mpu3050->trig, indio_dev);
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] iio: gyro: mpu3050: Make use of device properties
2022-04-13 16:30 [PATCH v1 1/1] iio: gyro: mpu3050: Make use of device properties Andy Shevchenko
@ 2022-04-16 11:18 ` Jonathan Cameron
2022-04-17 13:51 ` Linus Walleij
1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2022-04-16 11:18 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, linux-iio, linux-kernel, Linus Walleij,
Lars-Peter Clausen
On Wed, 13 Apr 2022 19:30:04 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> Convert the module to be property provider agnostic and allow
> it to be used on non-OF platforms.
>
> While at it, reuse temporary device pointer in the same function.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied. Thanks,
Jonathan
> ---
> drivers/iio/gyro/mpu3050-core.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
> index ea387efab62d..a2dafdb64692 100644
> --- a/drivers/iio/gyro/mpu3050-core.c
> +++ b/drivers/iio/gyro/mpu3050-core.c
> @@ -26,6 +26,7 @@
> #include <linux/interrupt.h>
> #include <linux/module.h>
> #include <linux/pm_runtime.h>
> +#include <linux/property.h>
> #include <linux/random.h>
> #include <linux/slab.h>
>
> @@ -1050,6 +1051,7 @@ static const struct iio_trigger_ops mpu3050_trigger_ops = {
> static int mpu3050_trigger_probe(struct iio_dev *indio_dev, int irq)
> {
> struct mpu3050 *mpu3050 = iio_priv(indio_dev);
> + struct device *dev = mpu3050->dev;
> unsigned long irq_trig;
> int ret;
>
> @@ -1061,8 +1063,7 @@ static int mpu3050_trigger_probe(struct iio_dev *indio_dev, int irq)
> return -ENOMEM;
>
> /* Check if IRQ is open drain */
> - if (of_property_read_bool(mpu3050->dev->of_node, "drive-open-drain"))
> - mpu3050->irq_opendrain = true;
> + mpu3050->irq_opendrain = device_property_read_bool(dev, "drive-open-drain");
>
> irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq));
> /*
> @@ -1118,13 +1119,12 @@ static int mpu3050_trigger_probe(struct iio_dev *indio_dev, int irq)
> mpu3050->trig->name,
> mpu3050->trig);
> if (ret) {
> - dev_err(mpu3050->dev,
> - "can't get IRQ %d, error %d\n", irq, ret);
> + dev_err(dev, "can't get IRQ %d, error %d\n", irq, ret);
> return ret;
> }
>
> mpu3050->irq = irq;
> - mpu3050->trig->dev.parent = mpu3050->dev;
> + mpu3050->trig->dev.parent = dev;
> mpu3050->trig->ops = &mpu3050_trigger_ops;
> iio_trigger_set_drvdata(mpu3050->trig, indio_dev);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] iio: gyro: mpu3050: Make use of device properties
2022-04-13 16:30 [PATCH v1 1/1] iio: gyro: mpu3050: Make use of device properties Andy Shevchenko
2022-04-16 11:18 ` Jonathan Cameron
@ 2022-04-17 13:51 ` Linus Walleij
2022-04-24 17:24 ` Jonathan Cameron
1 sibling, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2022-04-17 13:51 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, linux-iio, linux-kernel, Jonathan Cameron,
Lars-Peter Clausen
On Wed, Apr 13, 2022 at 6:30 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Convert the module to be property provider agnostic and allow
> it to be used on non-OF platforms.
>
> While at it, reuse temporary device pointer in the same function.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Too late because Jonathan is trigger happy (which is good!) but FWIW:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] iio: gyro: mpu3050: Make use of device properties
2022-04-17 13:51 ` Linus Walleij
@ 2022-04-24 17:24 ` Jonathan Cameron
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2022-04-24 17:24 UTC (permalink / raw)
To: Linus Walleij
Cc: Andy Shevchenko, Jonathan Cameron, linux-iio, linux-kernel,
Lars-Peter Clausen
On Sun, 17 Apr 2022 15:51:46 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:
> On Wed, Apr 13, 2022 at 6:30 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
>
> > Convert the module to be property provider agnostic and allow
> > it to be used on non-OF platforms.
> >
> > While at it, reuse temporary device pointer in the same function.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Too late because Jonathan is trigger happy (which is good!) but FWIW:
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
By the power of git rebase -i and the fact I'd only pushed out for 0-day
to test it so could still rebase. Added your RB :)
Jonathan
>
> Yours,
> Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-24 17:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13 16:30 [PATCH v1 1/1] iio: gyro: mpu3050: Make use of device properties Andy Shevchenko
2022-04-16 11:18 ` Jonathan Cameron
2022-04-17 13:51 ` Linus Walleij
2022-04-24 17:24 ` Jonathan Cameron
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.