+ pc8736x_gpio-fix-re-modprobe-errors-fix-finish-cdev-init.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     pc8736x_gpio: fix re-modprobe errors: fix/finish cdev-init

has been added to the -mm tree.  Its filename is

     pc8736x_gpio-fix-re-modprobe-errors-fix-finish-cdev-init.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: pc8736x_gpio: fix re-modprobe errors: fix/finish cdev-init
From: Jim Cromie <jim.cromie@xxxxxxxxx>

- 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@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/char/pc8736x_gpio.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff -puN drivers/char/pc8736x_gpio.c~pc8736x_gpio-fix-re-modprobe-errors-fix-finish-cdev-init drivers/char/pc8736x_gpio.c
--- a/drivers/char/pc8736x_gpio.c~pc8736x_gpio-fix-re-modprobe-errors-fix-finish-cdev-init
+++ a/drivers/char/pc8736x_gpio.c
@@ -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:
_

Patches currently in -mm which might be from jim.cromie@xxxxxxxxx are

pc8736x_gpio-fix-re-modprobe-errors.patch
pc8736x_gpio-fix-re-modprobe-errors-undo-region-reservation.patch
pc8736x_gpio-fix-re-modprobe-errors-fix-finish-cdev-init.patch
pc8736x_gpio-fix-re-modprobe-errors-fix-finish-cdev-init-tidy.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux