lkml.org 
[lkml]   [2011]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] PC8736X: Correct dev_dbg() message showing major number.

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
========================================================================

\
 
 \ /
  Last update: 2011-05-04 11:29    [W:0.051 / U:1.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site