[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1105040522250.4503@localhost6.localdomain6>
Date: Wed, 4 May 2011 05:26:43 -0400 (EDT)
From: "Robert P. J. Day" <rpjday@...shcourse.ca>
To: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
cc: jim.cromie@...il.com
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@...shcourse.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
========================================================================
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists