3 - pc-init-fix-chrdev-region-rollup
- Switch from register_chrdev() to (register|alloc)_chrdev_region().
- use a cdev. This was intended for original patchset, but was
overlooked.
We use a single cdev for all pins (minor device-numbers), as gleaned
from cs5535_gpio,
and in contrast to whats currently done in scx200_gpio (which I'll fix
soon)
Signed-off-by: Jim Cromie <[email protected]>
$ diffstat pc-init-fix-chrdev-region-rollup
pc8736x_gpio.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletion(-)
---
diff -ruNp -X dontdiff -X exclude-diffs x4k-2/drivers/char/pc8736x_gpio.c x4k-3/drivers/char/pc8736x_gpio.c
--- x4k-2/drivers/char/pc8736x_gpio.c 2006-07-07 20:09:38.000000000 -0600
+++ x4k-3/drivers/char/pc8736x_gpio.c 2006-07-07 20:12:05.000000000 -0600
@@ -260,6 +260,7 @@ static struct cdev pc8736x_gpio_cdev;
static int __init pc8736x_gpio_init(void)
{
int rc = 0;
+ dev_t devid;
pdev = platform_device_alloc(DEVNAME, 0);
if (!pdev)
@@ -307,7 +308,14 @@ static int __init pc8736x_gpio_init(void
}
dev_info(&pdev->dev, "GPIO ioport %x reserved\n", pc8736x_gpio_base);
- rc = register_chrdev(major, DEVNAME, &pc8736x_gpio_fops);
+ 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;
@@ -318,6 +326,11 @@ static int __init pc8736x_gpio_init(void
}
pc8736x_init_shadow();
+
+ /* ignore minor errs, and succeed */
+ cdev_init(&pc8736x_gpio_cdev, &pc8736x_gpio_fops);
+ cdev_add(&pc8736x_gpio_cdev, devid, PC8736X_GPIO_CT);
+
return 0;
undo_request_region:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]