Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1372191 > unrolled thread

[PATCH 5/9] iio: accel: mma7455: use regmap to retrieve struct device

Started byAlison Schofield <amsfield22@gmail.com>
First post2016-04-06 07:20 +0200
Last post2016-04-10 16:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 5/9] iio: accel: mma7455: use regmap to retrieve struct device Alison Schofield <amsfield22@gmail.com> - 2016-04-06 07:20 +0200
    Re: [PATCH 5/9] iio: accel: mma7455: use regmap to retrieve struct device Joachim Eastwood <manabian@gmail.com> - 2016-04-06 09:40 +0200
      Re: [PATCH 5/9] iio: accel: mma7455: use regmap to retrieve struct  device Jonathan Cameron <jic23@kernel.org> - 2016-04-10 16:00 +0200

#1372191 — [PATCH 5/9] iio: accel: mma7455: use regmap to retrieve struct device

FromAlison Schofield <amsfield22@gmail.com>
Date2016-04-06 07:20 +0200
Subject[PATCH 5/9] iio: accel: mma7455: use regmap to retrieve struct device
Message-ID<rkO2K-7uk-13@gated-at.bofh.it>
Driver includes struct regmap and struct device in its global data.
Remove the struct device and use regmap API to retrieve device info.

Patch created using Coccinelle plus manual edits.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
---
 drivers/iio/accel/mma7455_core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/accel/mma7455_core.c b/drivers/iio/accel/mma7455_core.c
index c633cc2..c902f54 100644
--- a/drivers/iio/accel/mma7455_core.c
+++ b/drivers/iio/accel/mma7455_core.c
@@ -55,11 +55,11 @@
 
 struct mma7455_data {
 	struct regmap *regmap;
-	struct device *dev;
 };
 
 static int mma7455_drdy(struct mma7455_data *mma7455)
 {
+	struct device *dev = regmap_get_device(mma7455->regmap);
 	unsigned int reg;
 	int tries = 3;
 	int ret;
@@ -75,7 +75,7 @@ static int mma7455_drdy(struct mma7455_data *mma7455)
 		msleep(20);
 	}
 
-	dev_warn(mma7455->dev, "data not ready\n");
+	dev_warn(dev, "data not ready\n");
 
 	return -EIO;
 }
@@ -260,7 +260,6 @@ int mma7455_core_probe(struct device *dev, struct regmap *regmap,
 	dev_set_drvdata(dev, indio_dev);
 	mma7455 = iio_priv(indio_dev);
 	mma7455->regmap = regmap;
-	mma7455->dev = dev;
 
 	indio_dev->info = &mma7455_info;
 	indio_dev->name = name;
-- 
2.1.4

[toc] | [next] | [standalone]


#1372256

FromJoachim Eastwood <manabian@gmail.com>
Date2016-04-06 09:40 +0200
Message-ID<rkQee-sD-3@gated-at.bofh.it>
In reply to#1372191
Hi Alison,

On 6 April 2016 at 07:18, Alison Schofield <amsfield22@gmail.com> wrote:
> Driver includes struct regmap and struct device in its global data.
> Remove the struct device and use regmap API to retrieve device info.
>
> Patch created using Coccinelle plus manual edits.
>
> Signed-off-by: Alison Schofield <amsfield22@gmail.com>
> ---
>  drivers/iio/accel/mma7455_core.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/accel/mma7455_core.c b/drivers/iio/accel/mma7455_core.c
> index c633cc2..c902f54 100644
> --- a/drivers/iio/accel/mma7455_core.c
> +++ b/drivers/iio/accel/mma7455_core.c
> @@ -55,11 +55,11 @@
>
>  struct mma7455_data {
>         struct regmap *regmap;
> -       struct device *dev;
>  };
>
>  static int mma7455_drdy(struct mma7455_data *mma7455)
>  {
> +       struct device *dev = regmap_get_device(mma7455->regmap);

ah, nice!

Acked-by: Joachim Eastwood <manabian@gmail.com>


regards,
Joachim Eastwood

[toc] | [prev] | [next] | [standalone]


#1374780 — Re: [PATCH 5/9] iio: accel: mma7455: use regmap to retrieve struct device

FromJonathan Cameron <jic23@kernel.org>
Date2016-04-10 16:00 +0200
SubjectRe: [PATCH 5/9] iio: accel: mma7455: use regmap to retrieve struct device
Message-ID<rmo4a-5TB-7@gated-at.bofh.it>
In reply to#1372256
On 06/04/16 08:35, Joachim Eastwood wrote:
> Hi Alison,
> 
> On 6 April 2016 at 07:18, Alison Schofield <amsfield22@gmail.com> wrote:
>> Driver includes struct regmap and struct device in its global data.
>> Remove the struct device and use regmap API to retrieve device info.
>>
>> Patch created using Coccinelle plus manual edits.
>>
>> Signed-off-by: Alison Schofield <amsfield22@gmail.com>
>> ---
>>  drivers/iio/accel/mma7455_core.c | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/iio/accel/mma7455_core.c b/drivers/iio/accel/mma7455_core.c
>> index c633cc2..c902f54 100644
>> --- a/drivers/iio/accel/mma7455_core.c
>> +++ b/drivers/iio/accel/mma7455_core.c
>> @@ -55,11 +55,11 @@
>>
>>  struct mma7455_data {
>>         struct regmap *regmap;
>> -       struct device *dev;
>>  };
>>
>>  static int mma7455_drdy(struct mma7455_data *mma7455)
>>  {
>> +       struct device *dev = regmap_get_device(mma7455->regmap);
> 
> ah, nice!
> 
> Acked-by: Joachim Eastwood <manabian@gmail.com>
Applied to the togreg  branch of iio.git - initially pushed out as testing
for the autobuilders to play with it.

This one is a fairly standard case and can be easily chased through to
see that the device pointer is the same one either way.

I'm going to let the rest sit a little longer to see if we get more
feedback on them

Jonathan
> 
> 
> regards,
> Joachim Eastwood
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web