* [PATCH] PC8736X: Correct dev_dbg() message showing major number.
@ 2011-05-04 9:26 Robert P. J. Day
2011-05-14 19:41 ` Jim Cromie
0 siblings, 1 reply; 2+ messages in thread
From: Robert P. J. Day @ 2011-05-04 9:26 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: jim.cromie
Currently, the debugging info is incorrect, as a successful call to
either register_chrdev_region() or alloc_chrdev_region() returns
simply zero, which appears to be what the following code would print.
Skip the checking, just print the value of "major", which should be
correct.
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
---
here's the current code in context, so you can see what i mean:
if (major) {
devid = MKDEV(major, 0);
rc = register_chrdev_region(devid, PC8736X_GPIO_CT, DEVNAME);
} else {
rc = alloc_chrdev_region(&devid, 0, PC8736X_GPIO_CT, DEVNAME);
major = MAJOR(devid);
}
if (rc < 0) {
dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc);
goto undo_request_region;
}
dev_dbg(&pdev->dev, "got dynamic major %d\n", major);
diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c
index b304ec0..a23d6bf 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, "got dynamic major %d\n", major);
pc8736x_init_shadow();
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] PC8736X: Correct dev_dbg() message showing major number.
2011-05-04 9:26 [PATCH] PC8736X: Correct dev_dbg() message showing major number Robert P. J. Day
@ 2011-05-14 19:41 ` Jim Cromie
0 siblings, 0 replies; 2+ messages in thread
From: Jim Cromie @ 2011-05-14 19:41 UTC (permalink / raw)
To: Robert P. J. Day; +Cc: Linux Kernel Mailing List
On Wed, May 4, 2011 at 3:26 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
>
> Currently, the debugging info is incorrect, as a successful call to
> either register_chrdev_region() or alloc_chrdev_region() returns
> simply zero, which appears to be what the following code would print.
> Skip the checking, just print the value of "major", which should be
> correct.
>
> Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
>
> ---
NAK. 'dynamic' is not always correct
> + dev_dbg(&pdev->dev, "got dynamic major %d\n", major);
Ive got patches to replace register|alloc _chrdev_region
which may require merge conflict resolution.
Id prefer to hold off til theyre reviewed, accepted.
Actually, shouldnt conflict - rc<0 code is in between.
If you want to rework it, I'll ack it.
thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-05-14 19:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04 9:26 [PATCH] PC8736X: Correct dev_dbg() message showing major number Robert P. J. Day
2011-05-14 19:41 ` Jim Cromie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®