All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: iio: adt7316: Switch to the gpio descriptor interface
@ 2018-10-22 17:14 Nishad Kamdar
  2018-10-22 17:52 ` Shreeya Patel
  2018-10-23  5:39 ` Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: Nishad Kamdar @ 2018-10-22 17:14 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Slawomir Stepien, Michael Hennerich, Jonathan Cameron,
	Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman,
	linux-iio, devel, linux-kernel

Use the gpiod interface instead of the deprecated old non-descriptor
interface for ldac_pin.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
---
 drivers/staging/iio/addac/adt7316.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index 3f22d1088713..94f945ba0097 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -8,7 +8,7 @@
  */
 
 #include <linux/interrupt.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/workqueue.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
@@ -177,7 +177,7 @@
 
 struct adt7316_chip_info {
 	struct adt7316_bus	bus;
-	u16			ldac_pin;
+	struct gpio_desc	*ldac_pin;
 	u16			int_mask;	/* 0x2f */
 	u8			config1;
 	u8			config2;
@@ -950,8 +950,8 @@ static ssize_t adt7316_store_update_DAC(struct device *dev,
 		if (ret)
 			return -EIO;
 	} else {
-		gpio_set_value(chip->ldac_pin, 0);
-		gpio_set_value(chip->ldac_pin, 1);
+		gpiod_set_value(chip->ldac_pin, 0);
+		gpiod_set_value(chip->ldac_pin, 1);
 	}
 
 	return len;
@@ -2120,7 +2120,14 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
 	else
 		return -ENODEV;
 
-	chip->ldac_pin = adt7316_platform_data[1];
+	chip->ldac_pin = devm_gpiod_get(dev, "ldac", GPIOD_OUT_HIGH);
+	if (IS_ERR(chip->ldac_pin)) {
+		ret = PTR_ERR(chip->ldac_pin);
+		dev_err(dev, "Failed to request ldac GPIO: %d\n",
+			ret);
+		return ret;
+	}
+
 	if (chip->ldac_pin) {
 		chip->config3 |= ADT7316_DA_EN_VIA_DAC_LDCA;
 		if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: iio: adt7316: Switch to the gpio descriptor interface
  2018-10-22 17:14 [PATCH] staging: iio: adt7316: Switch to the gpio descriptor interface Nishad Kamdar
@ 2018-10-22 17:52 ` Shreeya Patel
  2018-10-24 16:33   ` Nishad Kamdar
  2018-10-23  5:39 ` Dan Carpenter
  1 sibling, 1 reply; 5+ messages in thread
From: Shreeya Patel @ 2018-10-22 17:52 UTC (permalink / raw)
  To: Nishad Kamdar, Lars-Peter Clausen
  Cc: Slawomir Stepien, Michael Hennerich, Jonathan Cameron,
	Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman,
	linux-iio, devel, linux-kernel

On Mon, 2018-10-22 at 22:44 +0530, Nishad Kamdar wrote:
> Use the gpiod interface instead of the deprecated old non-descriptor
> interface for ldac_pin.
> 
> Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
> ---

Hi Nishad,

I have been working on implementing device tree bindings for this
driver and removing platform data from it.

I've sent a series of patches for it to Jonathan. I didn't send it 
on the mailing list as I wanted to confirm from Jonathan if we wants
something more to be done in the series. That series also includes
the change which you are proposing here.
I am really sorry that you didn't know about this.
If you are planning to send any other patches for this driver then
let me know before you start implementing it so that we can
co-ordinate before doing any work.

Thanks


>  drivers/staging/iio/addac/adt7316.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/iio/addac/adt7316.c
> b/drivers/staging/iio/addac/adt7316.c
> index 3f22d1088713..94f945ba0097 100644
> --- a/drivers/staging/iio/addac/adt7316.c
> +++ b/drivers/staging/iio/addac/adt7316.c
> @@ -8,7 +8,7 @@
>   */
>  
>  #include <linux/interrupt.h>
> -#include <linux/gpio.h>
> +#include <linux/gpio/consumer.h>
>  #include <linux/workqueue.h>
>  #include <linux/device.h>
>  #include <linux/kernel.h>
> @@ -177,7 +177,7 @@
>  
>  struct adt7316_chip_info {
>  	struct adt7316_bus	bus;
> -	u16			ldac_pin;
> +	struct gpio_desc	*ldac_pin;
>  	u16			int_mask;	/* 0x2f */
>  	u8			config1;
>  	u8			config2;
> @@ -950,8 +950,8 @@ static ssize_t adt7316_store_update_DAC(struct
> device *dev,
>  		if (ret)
>  			return -EIO;
>  	} else {
> -		gpio_set_value(chip->ldac_pin, 0);
> -		gpio_set_value(chip->ldac_pin, 1);
> +		gpiod_set_value(chip->ldac_pin, 0);
> +		gpiod_set_value(chip->ldac_pin, 1);
>  	}
>  
>  	return len;
> @@ -2120,7 +2120,14 @@ int adt7316_probe(struct device *dev, struct
> adt7316_bus *bus,
>  	else
>  		return -ENODEV;
>  
> -	chip->ldac_pin = adt7316_platform_data[1];
> +	chip->ldac_pin = devm_gpiod_get(dev, "ldac",
> GPIOD_OUT_HIGH);
> +	if (IS_ERR(chip->ldac_pin)) {
> +		ret = PTR_ERR(chip->ldac_pin);
> +		dev_err(dev, "Failed to request ldac GPIO: %d\n",
> +			ret);
> +		return ret;
> +	}
> +
>  	if (chip->ldac_pin) {
>  		chip->config3 |= ADT7316_DA_EN_VIA_DAC_LDCA;
>  		if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: iio: adt7316: Switch to the gpio descriptor interface
  2018-10-22 17:14 [PATCH] staging: iio: adt7316: Switch to the gpio descriptor interface Nishad Kamdar
  2018-10-22 17:52 ` Shreeya Patel
@ 2018-10-23  5:39 ` Dan Carpenter
  1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2018-10-23  5:39 UTC (permalink / raw)
  To: Nishad Kamdar
  Cc: Lars-Peter Clausen, devel, Michael Hennerich, linux-iio,
	Greg Kroah-Hartman, linux-kernel, Peter Meerwald-Stadler,
	Hartmut Knaack, Slawomir Stepien, Jonathan Cameron

On Mon, Oct 22, 2018 at 10:44:22PM +0530, Nishad Kamdar wrote:
> -	chip->ldac_pin = adt7316_platform_data[1];
> +	chip->ldac_pin = devm_gpiod_get(dev, "ldac", GPIOD_OUT_HIGH);
> +	if (IS_ERR(chip->ldac_pin)) {
> +		ret = PTR_ERR(chip->ldac_pin);
> +		dev_err(dev, "Failed to request ldac GPIO: %d\n",
> +			ret);

This can fit on one line:

		dev_err(dev, "Failed to request ldac GPIO: %d\n", ret);

regards,
dan carpenter


> +		return ret;
> +	}


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: iio: adt7316: Switch to the gpio descriptor interface
  2018-10-22 17:52 ` Shreeya Patel
@ 2018-10-24 16:33   ` Nishad Kamdar
  2018-10-28 14:58     ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Nishad Kamdar @ 2018-10-24 16:33 UTC (permalink / raw)
  To: Shreeya Patel
  Cc: Slawomir Stepien, Michael Hennerich, Jonathan Cameron,
	Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman,
	linux-iio, devel,
	linux-kernel@vger.kernel.org Lars-Peter Clausen

On Mon, Oct 22, 2018 at 11:22:15PM +0530, Shreeya Patel wrote:
> On Mon, 2018-10-22 at 22:44 +0530, Nishad Kamdar wrote:
> > Use the gpiod interface instead of the deprecated old non-descriptor
> > interface for ldac_pin.
> > 
> > Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
> > ---
> 
> Hi Nishad,
> 
> I have been working on implementing device tree bindings for this
> driver and removing platform data from it.
> 
> I've sent a series of patches for it to Jonathan. I didn't send it 
> on the mailing list as I wanted to confirm from Jonathan if we wants
> something more to be done in the series. That series also includes
> the change which you are proposing here.
> I am really sorry that you didn't know about this.
> If you are planning to send any other patches for this driver then
> let me know before you start implementing it so that we can
> co-ordinate before doing any work.
> 
> Thanks
> 
> 
> >  drivers/staging/iio/addac/adt7316.c | 17 ++++++++++++-----
> >  1 file changed, 12 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/staging/iio/addac/adt7316.c
> > b/drivers/staging/iio/addac/adt7316.c
> > index 3f22d1088713..94f945ba0097 100644
> > --- a/drivers/staging/iio/addac/adt7316.c
> > +++ b/drivers/staging/iio/addac/adt7316.c
> > @@ -8,7 +8,7 @@
> >   */
> >  
> >  #include <linux/interrupt.h>
> > -#include <linux/gpio.h>
> > +#include <linux/gpio/consumer.h>
> >  #include <linux/workqueue.h>
> >  #include <linux/device.h>
> >  #include <linux/kernel.h>
> > @@ -177,7 +177,7 @@
> >  
> >  struct adt7316_chip_info {
> >  	struct adt7316_bus	bus;
> > -	u16			ldac_pin;
> > +	struct gpio_desc	*ldac_pin;
> >  	u16			int_mask;	/* 0x2f */
> >  	u8			config1;
> >  	u8			config2;
> > @@ -950,8 +950,8 @@ static ssize_t adt7316_store_update_DAC(struct
> > device *dev,
> >  		if (ret)
> >  			return -EIO;
> >  	} else {
> > -		gpio_set_value(chip->ldac_pin, 0);
> > -		gpio_set_value(chip->ldac_pin, 1);
> > +		gpiod_set_value(chip->ldac_pin, 0);
> > +		gpiod_set_value(chip->ldac_pin, 1);
> >  	}
> >  
> >  	return len;
> > @@ -2120,7 +2120,14 @@ int adt7316_probe(struct device *dev, struct
> > adt7316_bus *bus,
> >  	else
> >  		return -ENODEV;
> >  
> > -	chip->ldac_pin = adt7316_platform_data[1];
> > +	chip->ldac_pin = devm_gpiod_get(dev, "ldac",
> > GPIOD_OUT_HIGH);
> > +	if (IS_ERR(chip->ldac_pin)) {
> > +		ret = PTR_ERR(chip->ldac_pin);
> > +		dev_err(dev, "Failed to request ldac GPIO: %d\n",
> > +			ret);
> > +		return ret;
> > +	}
> > +
> >  	if (chip->ldac_pin) {
> >  		chip->config3 |= ADT7316_DA_EN_VIA_DAC_LDCA;
> >  		if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)
Hello Shreeya,

Sure no problem.

Thanks and regards,
Nishad

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: iio: adt7316: Switch to the gpio descriptor interface
  2018-10-24 16:33   ` Nishad Kamdar
@ 2018-10-28 14:58     ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2018-10-28 14:58 UTC (permalink / raw)
  To: Nishad Kamdar
  Cc: Shreeya Patel, Slawomir Stepien, Michael Hennerich,
	Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman,
	linux-iio, devel,
	linux-kernel@vger.kernel.org Lars-Peter Clausen

On Wed, 24 Oct 2018 22:03:54 +0530
Nishad Kamdar <nishadkamdar@gmail.com> wrote:

> On Mon, Oct 22, 2018 at 11:22:15PM +0530, Shreeya Patel wrote:
> > On Mon, 2018-10-22 at 22:44 +0530, Nishad Kamdar wrote:  
> > > Use the gpiod interface instead of the deprecated old non-descriptor
> > > interface for ldac_pin.
> > > 
> > > Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
> > > ---  
> > 
> > Hi Nishad,
> > 
> > I have been working on implementing device tree bindings for this
> > driver and removing platform data from it.
> > 
> > I've sent a series of patches for it to Jonathan. I didn't send it 
> > on the mailing list as I wanted to confirm from Jonathan if we wants
> > something more to be done in the series. That series also includes
> > the change which you are proposing here.
> > I am really sorry that you didn't know about this.
> > If you are planning to send any other patches for this driver then
> > let me know before you start implementing it so that we can
> > co-ordinate before doing any work.
> > 
> > Thanks
> > 
> >   
> > >  drivers/staging/iio/addac/adt7316.c | 17 ++++++++++++-----
> > >  1 file changed, 12 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/drivers/staging/iio/addac/adt7316.c
> > > b/drivers/staging/iio/addac/adt7316.c
> > > index 3f22d1088713..94f945ba0097 100644
> > > --- a/drivers/staging/iio/addac/adt7316.c
> > > +++ b/drivers/staging/iio/addac/adt7316.c
> > > @@ -8,7 +8,7 @@
> > >   */
> > >  
> > >  #include <linux/interrupt.h>
> > > -#include <linux/gpio.h>
> > > +#include <linux/gpio/consumer.h>
> > >  #include <linux/workqueue.h>
> > >  #include <linux/device.h>
> > >  #include <linux/kernel.h>
> > > @@ -177,7 +177,7 @@
> > >  
> > >  struct adt7316_chip_info {
> > >  	struct adt7316_bus	bus;
> > > -	u16			ldac_pin;
> > > +	struct gpio_desc	*ldac_pin;
> > >  	u16			int_mask;	/* 0x2f */
> > >  	u8			config1;
> > >  	u8			config2;
> > > @@ -950,8 +950,8 @@ static ssize_t adt7316_store_update_DAC(struct
> > > device *dev,
> > >  		if (ret)
> > >  			return -EIO;
> > >  	} else {
> > > -		gpio_set_value(chip->ldac_pin, 0);
> > > -		gpio_set_value(chip->ldac_pin, 1);
> > > +		gpiod_set_value(chip->ldac_pin, 0);
> > > +		gpiod_set_value(chip->ldac_pin, 1);
> > >  	}
> > >  
> > >  	return len;
> > > @@ -2120,7 +2120,14 @@ int adt7316_probe(struct device *dev, struct
> > > adt7316_bus *bus,
> > >  	else
> > >  		return -ENODEV;
> > >  
> > > -	chip->ldac_pin = adt7316_platform_data[1];
> > > +	chip->ldac_pin = devm_gpiod_get(dev, "ldac",
> > > GPIOD_OUT_HIGH);
> > > +	if (IS_ERR(chip->ldac_pin)) {
> > > +		ret = PTR_ERR(chip->ldac_pin);
> > > +		dev_err(dev, "Failed to request ldac GPIO: %d\n",
> > > +			ret);
> > > +		return ret;
> > > +	}
> > > +
> > >  	if (chip->ldac_pin) {
> > >  		chip->config3 |= ADT7316_DA_EN_VIA_DAC_LDCA;
> > >  		if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)  
> Hello Shreeya,
> 
> Sure no problem.
> 
> Thanks and regards,
> Nishad

Hi Nishad,

Thanks for being so understanding on this.  I would normally operate
a policy of first to post on the list (assuming they update reasonably
quickly) is the on I apply, but as you are fine with it and this will
save Shreeya a little time (by avoiding a rebase) I'll wait for Shreeya's
public version.

I once discovered I was one of 3 people working on new drivers for a
single camera sensor years ago.  All 3 got posted in the same week
despite the part having been around for years before that.  Sometimes
we get unlucky - the nature of opensource ;)

Jonathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-28 23:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-22 17:14 [PATCH] staging: iio: adt7316: Switch to the gpio descriptor interface Nishad Kamdar
2018-10-22 17:52 ` Shreeya Patel
2018-10-24 16:33   ` Nishad Kamdar
2018-10-28 14:58     ` Jonathan Cameron
2018-10-23  5:39 ` Dan Carpenter

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.