public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jim Cromie <jim.cromie@gmail.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: [patchset 3/3 -2.6.18-rc1]  pc8736x_gpio:  fix re-modprobe errors - fix/finish cdev-init
Date: Sat, 08 Jul 2006 08:34:42 -0600	[thread overview]
Message-ID: <44AFC282.2060304@gmail.com> (raw)
In-Reply-To: <44AFBCB5.4040409@gmail.com>

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  <jim.cromie@gmail.com>


$ 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:



      parent reply	other threads:[~2006-07-08 14:34 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-06  4:26 Linux v2.6.18-rc1 Linus Torvalds
2006-07-06  9:44 ` Matt Keenan
2006-07-06 12:49   ` Jonathan Corbet
2006-07-06 16:22   ` Linus Torvalds
2006-07-06 12:34 ` Alistair John Strachan
2006-07-07  0:11   ` Andrew Morton
2006-07-06 12:44 ` Nigel Cunningham
2006-07-06 19:44 ` David R
2006-07-06 22:17   ` Greg KH
2006-07-07 21:11     ` David R
2006-07-08  8:14       ` Borislav Petkov
2006-07-08 14:19       ` Kay Sievers
2006-07-08 14:44         ` Andi Kleen
2006-07-08 14:44     ` Andi Kleen
2006-07-08 16:02       ` Greg KH
2006-07-09 23:17         ` Andi Kleen
2006-07-09 23:36           ` Greg KH
2006-07-07  1:05   ` Hervé Fache
2006-07-07 15:41 ` Steve Fox
2006-07-09 10:34   ` Benjamin Herrenschmidt
2006-07-10 13:21     ` Will Schmidt
2006-07-10 14:40       ` Alan Cox
2006-07-10 21:17         ` Benjamin Herrenschmidt
2006-07-11 17:00           ` Steve Fox
2006-07-10 21:16       ` Benjamin Herrenschmidt
2006-07-10 16:38     ` Steve Fox
2006-07-10 18:30       ` Steve Fox
2006-07-07 17:52 ` lost cpufreq (Re: Linux v2.6.18-rc1) Tomasz Torcz
2006-07-07 19:07   ` Dave Jones
2006-07-07 20:27     ` Tomasz Torcz
2006-07-07 20:35       ` Dave Jones
2006-07-10 10:03   ` Takashi Iwai
2006-07-08 14:09 ` [patchset 0/3 -2.6.18-rc1] pc8736x_gpio: fix re-modprobe errors Jim Cromie
2006-07-08 14:16   ` [patchset 1/3 -2.6.18-rc1] pc8736x_gpio: fix re-modprobe errors - define and use constants Jim Cromie
2006-07-08 14:29   ` [patchset 2/3 -2.6.18-rc1] pc8736x_gpio: fix re-modprobe errors - undo region reservation Jim Cromie
2006-07-08 14:34   ` Jim Cromie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44AFC282.2060304@gmail.com \
    --to=jim.cromie@gmail.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox