Skip to contentSkip to conversation

fix bogus use of rc = alloc_chrdev_region()

PATCH Jim Cromie 4 participants 7 messages Jun 10, 2011 – Jun 14, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Jim Cromie

author
#1 lore raw

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

Quoted 36 lines · Jim Cromie

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.

---
 drivers/char/pc8736x_gpio.c |    5 +----

 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/char/pc8736x_gpio.c +1 -5
index b304ec0..30d92fe 100644
@@ -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

#2 lore raw
Quoted 2 lines · Jim Cromie

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

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

Arnd?

Quoted 38 lines · Jim Cromie
Quoted 36 lines

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.

---
 drivers/char/pc8736x_gpio.c |    5 +----

 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/char/pc8736x_gpio.c +1 -5
index b304ec0..30d92fe 100644
@@ -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

#3 lore raw
Quoted 5 lines · Greg KH
Quoted 2 lines · Jim Cromie

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

#4 lore raw
Quoted 5 lines · Arnd Bergmann
Quoted 4 lines · Greg KH
Quoted 2 lines · Jim Cromie

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

Quoted 8 lines
Quoted 1 line

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.

#5 lore raw
Quoted 8 lines · On Tuesday 14 June 2011 18:23:50 Grant Likely wrote:
Quoted 3 lines · Arnd Bergmann

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

author
#6 lore raw
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · On Tuesday 14 June 2011 18:23:50 Grant Likely wrote:
Quoted 3 lines · Arnd Bergmann

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.

Quoted 6 lines
Quoted 2 lines

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 ?

Quoted 2 lines

       Arnd

#7 lore raw
In reply to Arnd Bergmann
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · On Tuesday 14 June 2011 18:23:50 Grant Likely wrote:
Quoted 3 lines · Arnd Bergmann

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.

Quoted 5 lines
Quoted 2 lines

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.