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 2/3 -2.6.18-rc1] pc8736x_gpio: fix re-modprobe errors - undo region reservation
Date: Sat, 08 Jul 2006 08:29:46 -0600 [thread overview]
Message-ID: <44AFC15A.1060003@gmail.com> (raw)
In-Reply-To: <44AFBCB5.4040409@gmail.com>
2 - pc-init-fix-undo-region-rollup
this patch fixes module-init-func by repairing usage of
platform_device_del/put in module-exit-func.
IOW, it imitates Ingo's 'mishaps' patch, which fixed the
module-init-func's undo handling.
Also fixes lack of release_region to undo the earlier registration.
Also starts to 'use a cdev' which was originally intended (its present
in scx200_gpio).
Code compiles and runs, exhibits a lesser error than previously.
(re-register-chrdev fails)
Since I had to add "include <linux/cdev.h>", I went ahead and made 2
tweaks that fell into diff-context-window:
- remove include <linux/config.h> everyone's doing it
- copyright updates - current date is 'wrong'
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
$ diffstat fxd1/pc-init-fix-undo-region-rollup
pc8736x_gpio.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
[jimc@harpo gpio-stuff]$
---
diff -ruNp -X dontdiff -X exclude-diffs x4h-1/drivers/char/pc8736x_gpio.c x4h-2/drivers/char/pc8736x_gpio.c
--- x4h-1/drivers/char/pc8736x_gpio.c 2006-07-07 16:59:14.000000000 -0600
+++ x4h-2/drivers/char/pc8736x_gpio.c 2006-07-07 17:02:17.000000000 -0600
@@ -3,18 +3,18 @@
National Semiconductor PC8736x GPIO driver. Allows a user space
process to play with the GPIO pins.
- Copyright (c) 2005 Jim Cromie <jim.cromie@gmail.com>
+ Copyright (c) 2005,2006 Jim Cromie <jim.cromie@gmail.com>
adapted from linux/drivers/char/scx200_gpio.c
Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>,
*/
-#include <linux/config.h>
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/cdev.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/mutex.h>
@@ -255,6 +255,8 @@ static void __init pc8736x_init_shadow(v
}
+static struct cdev pc8736x_gpio_cdev;
+
static int __init pc8736x_gpio_init(void)
{
int rc = 0;
@@ -308,7 +310,7 @@ static int __init pc8736x_gpio_init(void
rc = register_chrdev(major, DEVNAME, &pc8736x_gpio_fops);
if (rc < 0) {
dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc);
- goto undo_platform_dev_add;
+ goto undo_request_region;
}
if (!major) {
major = rc;
@@ -318,6 +320,8 @@ static int __init pc8736x_gpio_init(void
pc8736x_init_shadow();
return 0;
+undo_request_region:
+ release_region(pc8736x_gpio_base, PC8736X_GPIO_RANGE);
undo_platform_dev_add:
platform_device_del(pdev);
undo_platform_dev_alloc:
@@ -328,11 +332,14 @@ undo_platform_dev_alloc:
static void __exit pc8736x_gpio_cleanup(void)
{
- dev_dbg(&pdev->dev, " cleanup\n");
+ dev_dbg(&pdev->dev, "cleanup\n");
- release_region(pc8736x_gpio_base, 16);
+ cdev_del(&pc8736x_gpio_cdev);
+ unregister_chrdev_region(MKDEV(major,0), PC8736X_GPIO_CT);
+ release_region(pc8736x_gpio_base, PC8736X_GPIO_RANGE);
- unregister_chrdev(major, DEVNAME);
+ platform_device_del(pdev);
+ platform_device_put(pdev);
}
EXPORT_SYMBOL(pc8736x_access);
next prev parent reply other threads:[~2006-07-08 14:29 UTC|newest]
Thread overview: 40+ 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-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 14:40 ` Alan Cox
2006-07-10 21:17 ` Benjamin Herrenschmidt
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-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 ` Jim Cromie [this message]
2006-07-08 14:34 ` [patchset 3/3 -2.6.18-rc1] pc8736x_gpio: fix re-modprobe errors - fix/finish cdev-init Jim Cromie
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=44AFC15A.1060003@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.