2011-06-10 20:30:15

by Jim Cromie

[permalink] [raw]
Subject: Re: [PATCH] fix bogus use of rc = alloc_chrdev_region()

can someone pick this up,
for this release or next ?

On Thu, Jun 2, 2011 at 11:38 PM, Jim Cromie <[email protected]> wrote:
> Robert P.J. Day noticed a bogus assignment: major = rc, after
> the call to alloc_chrdev_region() in pc8736x_gpio_init().
>
> The code as written expects return-code behavior as for
> register_chrdev(), ie on success: rc = reserved-major when
> requested-major = 0. ?But for alloc_chrdev_region(), this isnt the
> case. ?Since its used for debug printing only, just excise the mess.
>
> Signed-of-by: Jim Cromie <[email protected]>
> Reported-by: Robert P.J. Day <[email protected]>
> cc: Greg KH <[email protected].
> Signed-off-by: Jim Cromie <[email protected]>
> ---
> ?drivers/char/pc8736x_gpio.c | ? ?5 +----
> ?1 files changed, 1 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c
> index b304ec0..30d92fe 100644
> --- a/drivers/char/pc8736x_gpio.c
> +++ b/drivers/char/pc8736x_gpio.c
> @@ -314,10 +314,7 @@ static int __init pc8736x_gpio_init(void)
> ? ? ? ? ? ? ? ?dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc);
> ? ? ? ? ? ? ? ?goto undo_request_region;
> ? ? ? ?}
> - ? ? ? if (!major) {
> - ? ? ? ? ? ? ? major = rc;
> - ? ? ? ? ? ? ? dev_dbg(&pdev->dev, "got dynamic major %d\n", major);
> - ? ? ? }
> + ? ? ? dev_dbg(&pdev->dev, "using chardev major %d\n", major);
>
> ? ? ? ?pc8736x_init_shadow();
>
> --
> 1.7.4.2
>
>


2011-06-10 21:04:59

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] fix bogus use of rc = alloc_chrdev_region()

On Fri, Jun 10, 2011 at 02:29:42PM -0600, Jim Cromie wrote:
> can someone pick this up,
> for this release or next ?

It was rumored that Arnd wanted to take over drivers/char/.

Arnd?


>
> On Thu, Jun 2, 2011 at 11:38 PM, Jim Cromie <[email protected]> wrote:
> > Robert P.J. Day noticed a bogus assignment: major = rc, after
> > the call to alloc_chrdev_region() in pc8736x_gpio_init().
> >
> > The code as written expects return-code behavior as for
> > register_chrdev(), ie on success: rc = reserved-major when
> > requested-major = 0. ?But for alloc_chrdev_region(), this isnt the
> > case. ?Since its used for debug printing only, just excise the mess.
> >
> > Signed-of-by: Jim Cromie <[email protected]>
> > Reported-by: Robert P.J. Day <[email protected]>
> > cc: Greg KH <[email protected].
> > Signed-off-by: Jim Cromie <[email protected]>
> > ---
> > ?drivers/char/pc8736x_gpio.c | ? ?5 +----
> > ?1 files changed, 1 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c
> > index b304ec0..30d92fe 100644
> > --- a/drivers/char/pc8736x_gpio.c
> > +++ b/drivers/char/pc8736x_gpio.c
> > @@ -314,10 +314,7 @@ static int __init pc8736x_gpio_init(void)
> > ? ? ? ? ? ? ? ?dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc);
> > ? ? ? ? ? ? ? ?goto undo_request_region;
> > ? ? ? ?}
> > - ? ? ? if (!major) {
> > - ? ? ? ? ? ? ? major = rc;
> > - ? ? ? ? ? ? ? dev_dbg(&pdev->dev, "got dynamic major %d\n", major);
> > - ? ? ? }
> > + ? ? ? dev_dbg(&pdev->dev, "using chardev major %d\n", major);
> >
> > ? ? ? ?pc8736x_init_shadow();
> >
> > --
> > 1.7.4.2
> >
> >

2011-06-14 14:07:14

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] fix bogus use of rc = alloc_chrdev_region()

On Friday 10 June 2011, Greg KH wrote:
> On Fri, Jun 10, 2011 at 02:29:42PM -0600, Jim Cromie wrote:
> > can someone pick this up,
> > for this release or next ?
>
> It was rumored that Arnd wanted to take over drivers/char/.

That's true. It probably means I should set up a tree now, before we get
too close to the next merge window.

On the topic of drivers/char/{nsc_gpio,pc8736x_gpio,scx200_gpio}, I wonder
if we should move them to drivers/gpio/nsc_gpio despite the fact that they
use a different (older) interface than all the other gpio drivers.

They have seen only a single non-janitor patch in the last five years,
so I don't think they will be a burden, but it might be nice to have them
in a place where people would actually look for them, with a comment that
they should be converted to the new API in order to be more useful.

Arnd

2011-06-14 16:24:12

by Grant Likely

[permalink] [raw]
Subject: Re: [PATCH] fix bogus use of rc = alloc_chrdev_region()

On Tue, Jun 14, 2011 at 8:07 AM, Arnd Bergmann <[email protected]> wrote:
> On Friday 10 June 2011, Greg KH wrote:
>> On Fri, Jun 10, 2011 at 02:29:42PM -0600, Jim Cromie wrote:
>> > can someone pick this up,
>> > for this release or next ?
>>
>> It was rumored that Arnd wanted to take over drivers/char/.
>
> That's true. It probably means I should set up a tree now, before we get
> too close to the next merge window.
>
> On the topic of drivers/char/{nsc_gpio,pc8736x_gpio,scx200_gpio}, I wonder
> if we should move them to drivers/gpio/nsc_gpio despite the fact that they
> use a different (older) interface than all the other gpio drivers.

I have no problem with moving them into drivers/gpio. When you do,
please rename then drivers/gpio/gpio-*.c

g.

2011-06-14 18:18:04

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] fix bogus use of rc = alloc_chrdev_region()

On Tuesday 14 June 2011 18:23:50 Grant Likely wrote:
> On Tue, Jun 14, 2011 at 8:07 AM, Arnd Bergmann <[email protected]> wrote:
>
> > On the topic of drivers/char/{nsc_gpio,pc8736x_gpio,scx200_gpio}, I wonder
> > if we should move them to drivers/gpio/nsc_gpio despite the fact that they
> > use a different (older) interface than all the other gpio drivers.
>
> I have no problem with moving them into drivers/gpio. When you do,
> please rename then drivers/gpio/gpio-*.c

Ok. Should they be in a subdirectory drivers/gpio/nsc_gpio/gpio_* for the
nonstandard API or do you prefer them to live amongst the regular ones?

Arnd

2011-06-14 18:23:57

by Jim Cromie

[permalink] [raw]
Subject: Re: [PATCH] fix bogus use of rc = alloc_chrdev_region()

On Tue, Jun 14, 2011 at 12:17 PM, Arnd Bergmann <[email protected]> wrote:
> On Tuesday 14 June 2011 18:23:50 Grant Likely wrote:
>> On Tue, Jun 14, 2011 at 8:07 AM, Arnd Bergmann <[email protected]> wrote:
>>
>> > On the topic of drivers/char/{nsc_gpio,pc8736x_gpio,scx200_gpio}, I wonder
>> > if we should move them to drivers/gpio/nsc_gpio despite the fact that they
>> > use a different (older) interface than all the other gpio drivers.
>>
>> I have no problem with moving them into drivers/gpio. ?When you do,
>> please rename then drivers/gpio/gpio-*.c
>
> Ok. Should they be in a subdirectory drivers/gpio/nsc_gpio/gpio_* for the
> nonstandard API or do you prefer them to live amongst the regular ones?
>

converting these to gpiolib has been on my list for a while, but
pretty far down.
Moving them is an easy 1st step.
Once theyre converted, I guess they belong with the others,
but its easy to move them again when the convert is done.
preference ?

> ? ? ? ?Arnd
>

2011-06-14 19:19:29

by Grant Likely

[permalink] [raw]
Subject: Re: [PATCH] fix bogus use of rc = alloc_chrdev_region()

On Tue, Jun 14, 2011 at 12:17 PM, Arnd Bergmann <[email protected]> wrote:
> On Tuesday 14 June 2011 18:23:50 Grant Likely wrote:
>> On Tue, Jun 14, 2011 at 8:07 AM, Arnd Bergmann <[email protected]> wrote:
>>
>> > On the topic of drivers/char/{nsc_gpio,pc8736x_gpio,scx200_gpio}, I wonder
>> > if we should move them to drivers/gpio/nsc_gpio despite the fact that they
>> > use a different (older) interface than all the other gpio drivers.
>>
>> I have no problem with moving them into drivers/gpio. ?When you do,
>> please rename then drivers/gpio/gpio-*.c
>
> Ok. Should they be in a subdirectory drivers/gpio/nsc_gpio/gpio_* for the
> nonstandard API or do you prefer them to live amongst the regular ones?'

I only see one files per non-standard driver. I wouldn't bother with
subdirectories. Just put them in with the general population.

g.