aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJim Cromie <jim.cromie@gmail.com>2006-07-10 07:45:37 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-10 16:24:26 -0400
commitbabcfade47371eea81fd7f24d892b5ff5b1786ea (patch)
treea0b5f1ce6d0ab758f78a35a1e8fd0ce07c8572f3 /drivers
parent27385085f19a9bc9b147905554e6e2509fdaceb2 (diff)
[PATCH] pc8736x_gpio: fix re-modprobe errors: fix/finish cdev-init
- 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 <jim.cromie@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/pc8736x_gpio.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c
index bfc45e0cc60..11bd78c8062 100644
--- a/drivers/char/pc8736x_gpio.c
+++ b/drivers/char/pc8736x_gpio.c
@@ -259,7 +259,8 @@ static struct cdev pc8736x_gpio_cdev;
259 259
260static int __init pc8736x_gpio_init(void) 260static int __init pc8736x_gpio_init(void)
261{ 261{
262 int rc = 0; 262 int rc;
263 dev_t devid;
263 264
264 pdev = platform_device_alloc(DEVNAME, 0); 265 pdev = platform_device_alloc(DEVNAME, 0);
265 if (!pdev) 266 if (!pdev)
@@ -307,7 +308,14 @@ static int __init pc8736x_gpio_init(void)
307 } 308 }
308 dev_info(&pdev->dev, "GPIO ioport %x reserved\n", pc8736x_gpio_base); 309 dev_info(&pdev->dev, "GPIO ioport %x reserved\n", pc8736x_gpio_base);
309 310
310 rc = register_chrdev(major, DEVNAME, &pc8736x_gpio_fops); 311 if (major) {
312 devid = MKDEV(major, 0);
313 rc = register_chrdev_region(devid, PC8736X_GPIO_CT, DEVNAME);
314 } else {
315 rc = alloc_chrdev_region(&devid, 0, PC8736X_GPIO_CT, DEVNAME);
316 major = MAJOR(devid);
317 }
318
311 if (rc < 0) { 319 if (rc < 0) {
312 dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc); 320 dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc);
313 goto undo_request_region; 321 goto undo_request_region;
@@ -318,6 +326,11 @@ static int __init pc8736x_gpio_init(void)
318 } 326 }
319 327
320 pc8736x_init_shadow(); 328 pc8736x_init_shadow();
329
330 /* ignore minor errs, and succeed */
331 cdev_init(&pc8736x_gpio_cdev, &pc8736x_gpio_fops);
332 cdev_add(&pc8736x_gpio_cdev, devid, PC8736X_GPIO_CT);
333
321 return 0; 334 return 0;
322 335
323undo_request_region: 336undo_request_region: