Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-17 Thread Linus Walleij
On Wed, Jan 9, 2013 at 4:04 PM, Russell King - ARM Linux wrote: > So, it seems there's some concensus building here, and it seems that > I've become the chosen victi^wvolunteer for this. So, here's a patch. > It's missing a Guns-supplied-by: tag though. > > From: Russell King > Subject: Mark

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-17 Thread Linus Walleij
On Wed, Jan 9, 2013 at 4:04 PM, Russell King - ARM Linux li...@arm.linux.org.uk wrote: So, it seems there's some concensus building here, and it seems that I've become the chosen victi^wvolunteer for this. So, here's a patch. It's missing a Guns-supplied-by: tag though. From: Russell King

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-10 Thread Thierry Reding
On Wed, Jan 09, 2013 at 11:10:55AM +, Russell King - ARM Linux wrote: [...] > err = gpio_request(en_vdd_1v05, "EN_VDD_1V05"); > if (err) { > pr_err("%s: gpio_request failed: %d\n", __func__, err); > return err; > } > >

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-10 Thread Thierry Reding
On Wed, Jan 09, 2013 at 11:10:55AM +, Russell King - ARM Linux wrote: [...] err = gpio_request(en_vdd_1v05, EN_VDD_1V05); if (err) { pr_err(%s: gpio_request failed: %d\n, __func__, err); return err; }

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Tony Lindgren
* Russell King - ARM Linux [130109 09:15]: > On Wed, Jan 09, 2013 at 04:21:45PM +, Russell King - ARM Linux wrote: > > On Wed, Jan 09, 2013 at 11:09:23AM -0500, Nicolas Pitre wrote: > > > On Wed, 9 Jan 2013, Russell King - ARM Linux wrote: > > > > > > > On Wed, Jan 09, 2013 at 10:27:53AM

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Russell King - ARM Linux
On Wed, Jan 09, 2013 at 04:21:45PM +, Russell King - ARM Linux wrote: > On Wed, Jan 09, 2013 at 11:09:23AM -0500, Nicolas Pitre wrote: > > On Wed, 9 Jan 2013, Russell King - ARM Linux wrote: > > > > > On Wed, Jan 09, 2013 at 10:27:53AM -0500, Nicolas Pitre wrote: > > > > Anyone with good

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Russell King - ARM Linux
On Wed, Jan 09, 2013 at 11:09:23AM -0500, Nicolas Pitre wrote: > On Wed, 9 Jan 2013, Russell King - ARM Linux wrote: > > > On Wed, Jan 09, 2013 at 10:27:53AM -0500, Nicolas Pitre wrote: > > > Anyone with good coccinelle skills around to deal with the users? > > > > I'm not sure that's a

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Nicolas Pitre
On Wed, 9 Jan 2013, Russell King - ARM Linux wrote: > On Wed, Jan 09, 2013 at 10:27:53AM -0500, Nicolas Pitre wrote: > > Anyone with good coccinelle skills around to deal with the users? > > I'm not sure that's a solution. Well, I was thinking that coccinelle could handle the majority of the

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Russell King - ARM Linux
On Wed, Jan 09, 2013 at 10:27:53AM -0500, Nicolas Pitre wrote: > Anyone with good coccinelle skills around to deal with the users? I'm not sure that's a solution. For example: err = gpio_request(en_vdd_1v05, "EN_VDD_1V05"); if (err) { pr_err("%s: gpio_request

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Grant Likely
On Wed, Jan 9, 2013 at 3:04 PM, Russell King - ARM Linux wrote: > So, it seems there's some concensus building here, and it seems that > I've become the chosen victi^wvolunteer for this. So, here's a patch. > It's missing a Guns-supplied-by: tag though. > > From: Russell King > Subject: Mark

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Nicolas Pitre
On Wed, 9 Jan 2013, Russell King - ARM Linux wrote: > So, it seems there's some concensus building here, and it seems that > I've become the chosen victi^wvolunteer for this. So, here's a patch. > It's missing a Guns-supplied-by: tag though. Guns-supplied-by: NRA (obviously) > From: Russell

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Arnd Bergmann
On Wednesday 09 January 2013, Grant Likely wrote: > > Suggested-by: David Howells > > Tape-measuring-service-offered-by: Will Deacon > > Victim-for-firing-sqad: Russell King > > Signed-off-by: Russell King > > Acked-by: Grant Likely Acked-by: Arnd Bergmann -- To unsubscribe from this list:

[PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Russell King - ARM Linux
So, it seems there's some concensus building here, and it seems that I've become the chosen victi^wvolunteer for this. So, here's a patch. It's missing a Guns-supplied-by: tag though. From: Russell King Subject: Mark IS_ERR_OR_NULL() deprecated IS_ERR_OR_NULL() attracts a lot of abuse: people

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-09 Thread Nicolas Pitre
On Wed, 9 Jan 2013, Russell King - ARM Linux wrote: > On Wed, Jan 09, 2013 at 10:44:14AM +, Russell King - ARM Linux wrote: > > On Wed, Jan 09, 2013 at 10:35:22AM +, Arnd Bergmann wrote: > > > On Wednesday 09 January 2013, Alexandre Courbot wrote: > > > > On Tue, Jan 8, 2013 at 9:59 PM,

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-09 Thread Arnd Bergmann
On Wednesday 09 January 2013, Russell King - ARM Linux wrote: > d = debugfs_create_dir("pm_debug", NULL); > if (IS_ERR_OR_NULL(d)) > return PTR_ERR(d); > > Well, covered above. NULL is success here. This one is actually worse, because in case of

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-09 Thread Russell King - ARM Linux
On Wed, Jan 09, 2013 at 10:44:14AM +, Russell King - ARM Linux wrote: > On Wed, Jan 09, 2013 at 10:35:22AM +, Arnd Bergmann wrote: > > On Wednesday 09 January 2013, Alexandre Courbot wrote: > > > On Tue, Jan 8, 2013 at 9:59 PM, Arnd Bergmann wrote: > > > > Please avoid the use of

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-09 Thread Russell King - ARM Linux
On Wed, Jan 09, 2013 at 10:35:22AM +, Arnd Bergmann wrote: > On Wednesday 09 January 2013, Alexandre Courbot wrote: > > On Tue, Jan 8, 2013 at 9:59 PM, Arnd Bergmann wrote: > > > Please avoid the use of IS_ERR_OR_NULL(), especially on interfaces you > > > introduce yourself. AFAICT, gpiod_get

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-09 Thread Arnd Bergmann
On Wednesday 09 January 2013, Alexandre Courbot wrote: > On Tue, Jan 8, 2013 at 9:59 PM, Arnd Bergmann wrote: > > Please avoid the use of IS_ERR_OR_NULL(), especially on interfaces you > > introduce yourself. AFAICT, gpiod_get cannot return NULL, so you > > should not check for that. > > Sure -

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-09 Thread Russell King - ARM Linux
On Wed, Jan 09, 2013 at 10:06:16AM +0900, Alexandre Courbot wrote: > On Tue, Jan 8, 2013 at 9:59 PM, Arnd Bergmann wrote: > > Please avoid the use of IS_ERR_OR_NULL(), especially on interfaces you > > introduce yourself. AFAICT, gpiod_get cannot return NULL, so you > > should not check for that.

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-09 Thread Russell King - ARM Linux
On Wed, Jan 09, 2013 at 10:06:16AM +0900, Alexandre Courbot wrote: On Tue, Jan 8, 2013 at 9:59 PM, Arnd Bergmann a...@arndb.de wrote: Please avoid the use of IS_ERR_OR_NULL(), especially on interfaces you introduce yourself. AFAICT, gpiod_get cannot return NULL, so you should not check for

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-09 Thread Arnd Bergmann
On Wednesday 09 January 2013, Alexandre Courbot wrote: On Tue, Jan 8, 2013 at 9:59 PM, Arnd Bergmann a...@arndb.de wrote: Please avoid the use of IS_ERR_OR_NULL(), especially on interfaces you introduce yourself. AFAICT, gpiod_get cannot return NULL, so you should not check for that.

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-09 Thread Russell King - ARM Linux
On Wed, Jan 09, 2013 at 10:35:22AM +, Arnd Bergmann wrote: On Wednesday 09 January 2013, Alexandre Courbot wrote: On Tue, Jan 8, 2013 at 9:59 PM, Arnd Bergmann a...@arndb.de wrote: Please avoid the use of IS_ERR_OR_NULL(), especially on interfaces you introduce yourself. AFAICT,

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-09 Thread Russell King - ARM Linux
On Wed, Jan 09, 2013 at 10:44:14AM +, Russell King - ARM Linux wrote: On Wed, Jan 09, 2013 at 10:35:22AM +, Arnd Bergmann wrote: On Wednesday 09 January 2013, Alexandre Courbot wrote: On Tue, Jan 8, 2013 at 9:59 PM, Arnd Bergmann a...@arndb.de wrote: Please avoid the use of

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-09 Thread Arnd Bergmann
On Wednesday 09 January 2013, Russell King - ARM Linux wrote: d = debugfs_create_dir(pm_debug, NULL); if (IS_ERR_OR_NULL(d)) return PTR_ERR(d); Well, covered above. NULL is success here. This one is actually worse, because in case of debugfs_create_dir, a

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-09 Thread Nicolas Pitre
On Wed, 9 Jan 2013, Russell King - ARM Linux wrote: On Wed, Jan 09, 2013 at 10:44:14AM +, Russell King - ARM Linux wrote: On Wed, Jan 09, 2013 at 10:35:22AM +, Arnd Bergmann wrote: On Wednesday 09 January 2013, Alexandre Courbot wrote: On Tue, Jan 8, 2013 at 9:59 PM, Arnd

[PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Russell King - ARM Linux
So, it seems there's some concensus building here, and it seems that I've become the chosen victi^wvolunteer for this. So, here's a patch. It's missing a Guns-supplied-by: tag though. From: Russell King rmk+ker...@arm.linux.org.uk Subject: Mark IS_ERR_OR_NULL() deprecated IS_ERR_OR_NULL()

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Arnd Bergmann
On Wednesday 09 January 2013, Grant Likely wrote: Suggested-by: David Howells dhowe...@redhat.com Tape-measuring-service-offered-by: Will Deacon will.dea...@arm.com Victim-for-firing-sqad: Russell King rmk+ker...@arm.linux.org.uk Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Nicolas Pitre
On Wed, 9 Jan 2013, Russell King - ARM Linux wrote: So, it seems there's some concensus building here, and it seems that I've become the chosen victi^wvolunteer for this. So, here's a patch. It's missing a Guns-supplied-by: tag though. Guns-supplied-by: NRA (obviously) From: Russell King

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Grant Likely
On Wed, Jan 9, 2013 at 3:04 PM, Russell King - ARM Linux li...@arm.linux.org.uk wrote: So, it seems there's some concensus building here, and it seems that I've become the chosen victi^wvolunteer for this. So, here's a patch. It's missing a Guns-supplied-by: tag though. From: Russell King

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Russell King - ARM Linux
On Wed, Jan 09, 2013 at 10:27:53AM -0500, Nicolas Pitre wrote: Anyone with good coccinelle skills around to deal with the users? I'm not sure that's a solution. For example: err = gpio_request(en_vdd_1v05, EN_VDD_1V05); if (err) { pr_err(%s: gpio_request failed:

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Nicolas Pitre
On Wed, 9 Jan 2013, Russell King - ARM Linux wrote: On Wed, Jan 09, 2013 at 10:27:53AM -0500, Nicolas Pitre wrote: Anyone with good coccinelle skills around to deal with the users? I'm not sure that's a solution. Well, I was thinking that coccinelle could handle the majority of the 354

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Russell King - ARM Linux
On Wed, Jan 09, 2013 at 11:09:23AM -0500, Nicolas Pitre wrote: On Wed, 9 Jan 2013, Russell King - ARM Linux wrote: On Wed, Jan 09, 2013 at 10:27:53AM -0500, Nicolas Pitre wrote: Anyone with good coccinelle skills around to deal with the users? I'm not sure that's a solution. Well,

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Russell King - ARM Linux
On Wed, Jan 09, 2013 at 04:21:45PM +, Russell King - ARM Linux wrote: On Wed, Jan 09, 2013 at 11:09:23AM -0500, Nicolas Pitre wrote: On Wed, 9 Jan 2013, Russell King - ARM Linux wrote: On Wed, Jan 09, 2013 at 10:27:53AM -0500, Nicolas Pitre wrote: Anyone with good coccinelle

Re: [PATCH] Proposed removal of IS_ERR_OR_NULL() (was: Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface)

2013-01-09 Thread Tony Lindgren
* Russell King - ARM Linux li...@arm.linux.org.uk [130109 09:15]: On Wed, Jan 09, 2013 at 04:21:45PM +, Russell King - ARM Linux wrote: On Wed, Jan 09, 2013 at 11:09:23AM -0500, Nicolas Pitre wrote: On Wed, 9 Jan 2013, Russell King - ARM Linux wrote: On Wed, Jan 09, 2013 at

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-08 Thread Alexandre Courbot
On Tue, Jan 8, 2013 at 9:59 PM, Arnd Bergmann wrote: > Please avoid the use of IS_ERR_OR_NULL(), especially on interfaces you > introduce yourself. AFAICT, gpiod_get cannot return NULL, so you > should not check for that. Sure - you sound like IS_ERR_OR_NULL() is generally considered evil, may I

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-08 Thread Arnd Bergmann
On Tuesday 08 January 2013, Alexandre Courbot wrote: > +struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, > +const char *con_id) > +{ > + struct gpio_desc **dr; > + struct gpio_desc *desc; > + > + dr =

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-08 Thread Arnd Bergmann
On Tuesday 08 January 2013, Alexandre Courbot wrote: +struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, +const char *con_id) +{ + struct gpio_desc **dr; + struct gpio_desc *desc; + + dr =

Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-08 Thread Alexandre Courbot
On Tue, Jan 8, 2013 at 9:59 PM, Arnd Bergmann a...@arndb.de wrote: Please avoid the use of IS_ERR_OR_NULL(), especially on interfaces you introduce yourself. AFAICT, gpiod_get cannot return NULL, so you should not check for that. Sure - you sound like IS_ERR_OR_NULL() is generally considered

[PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-07 Thread Alexandre Courbot
With the current API, GPIOs are represented by a unique integer. This causes problems in terms of security (GPIO numbers can be arbitrarily forged and used without proper allocation) and flexibility (the maximum number of GPIOs that the system can handle is fixed at compilation time and a static

[PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

2013-01-07 Thread Alexandre Courbot
With the current API, GPIOs are represented by a unique integer. This causes problems in terms of security (GPIO numbers can be arbitrarily forged and used without proper allocation) and flexibility (the maximum number of GPIOs that the system can handle is fixed at compilation time and a static