public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]drivers/char/cs5535_gpio.c:call cdev_del during module_exit to unmap kobject references and other cleanups.
@ 2006-04-19  6:52 Thayumanavar Sachithanantham
  2006-04-19  7:15 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Thayumanavar Sachithanantham @ 2006-04-19  6:52 UTC (permalink / raw)
  To: akpm, info-linux, linux-kernel, rdunlap

During module unloading, cdev_del be called to unmap cdev related
kobject references and other cleanups(such as inode->i_cdev being set
to NULL) which prevents the OOPS upon subsequent loading ,usage and
unloading of modules(as
seen in the mail thread
http://marc.theaimsgroup.com/?l=linux-kernel&m=114533640609018&w=2).
Patch against 2.6.17-rc1

Signed-off-by: Thayumanavar Sachithanantham <thayumk@gmail.com>

--- linux-2.6/drivers/char/cs5535_gpio.c.orig   2006-04-17
21:37:25.000000000 -0700
+++ linux-2.6/drivers/char/cs5535_gpio.c        2006-04-17
21:38:24.000000000 -0700
@@ -241,6 +241,7 @@ static int __init cs5535_gpio_init(void)
 static void __exit cs5535_gpio_cleanup(void)
 {
        dev_t dev_id = MKDEV(major, 0);
+        cdev_del(&cs5535_gpio_cdev);
        unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
        if (gpio_base != 0)
                release_region(gpio_base, CS5535_GPIO_SIZE);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]drivers/char/cs5535_gpio.c:call cdev_del during module_exit to unmap kobject references and other cleanups.
  2006-04-19  6:52 [PATCH]drivers/char/cs5535_gpio.c:call cdev_del during module_exit to unmap kobject references and other cleanups Thayumanavar Sachithanantham
@ 2006-04-19  7:15 ` Andrew Morton
  2006-04-19  7:51   ` Thayumanavar Sachithanantham
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2006-04-19  7:15 UTC (permalink / raw)
  To: Thayumanavar Sachithanantham; +Cc: info-linux, linux-kernel, rdunlap

"Thayumanavar Sachithanantham" <thayumk@gmail.com> wrote:
>
> During module unloading, cdev_del be called to unmap cdev related
> kobject references and other cleanups(such as inode->i_cdev being set
> to NULL) which prevents the OOPS upon subsequent loading ,usage and
> unloading of modules(as
> seen in the mail thread
> http://marc.theaimsgroup.com/?l=linux-kernel&m=114533640609018&w=2).
> Patch against 2.6.17-rc1
> 
> Signed-off-by: Thayumanavar Sachithanantham <thayumk@gmail.com>
> 
> --- linux-2.6/drivers/char/cs5535_gpio.c.orig   2006-04-17
> 21:37:25.000000000 -0700
> +++ linux-2.6/drivers/char/cs5535_gpio.c        2006-04-17
> 21:38:24.000000000 -0700
> @@ -241,6 +241,7 @@ static int __init cs5535_gpio_init(void)
>  static void __exit cs5535_gpio_cleanup(void)
>  {
>         dev_t dev_id = MKDEV(major, 0);
> +        cdev_del(&cs5535_gpio_cdev);
>         unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);

Fair enough.  Please note that your patch was wordwrapped and had its tabs
replaced with spaces.


>         if (gpio_base != 0)
>                 release_region(gpio_base, CS5535_GPIO_SIZE);

>From my reading, this test of gpio_base is unneeded and wrong, btw. 
Probably it can't be zero anyway...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]drivers/char/cs5535_gpio.c:call cdev_del during module_exit to unmap kobject references and other cleanups.
  2006-04-19  7:15 ` Andrew Morton
@ 2006-04-19  7:51   ` Thayumanavar Sachithanantham
  2006-04-19  9:35     ` Jiri Slaby
  0 siblings, 1 reply; 4+ messages in thread
From: Thayumanavar Sachithanantham @ 2006-04-19  7:51 UTC (permalink / raw)
  To: Andrew Morton; +Cc: info-linux, linux-kernel, rdunlap

During module unloading, cdev_del be called to unmap cdev related
kobject references and other cleanups(such as inode->i_cdev being set
to NULL) which prevents the OOPS upon subsequent loading ,usage and
unloading of modules(as seen in the mail thread:
http://marc.theaimsgroup.com/?l=linux-kernel&m=114533640609018&w=2).

Removed test of gpio_base as it is unneeded and will not be zero at
module unload time.

Signed-off-by: Thayumanavar Sachithanantham <thayumk@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>

--- linux-2.6/drivers/char/cs5535_gpio.c.orig	2006-04-17
21:37:25.000000000 -0700
+++ linux-2.6/drivers/char/cs5535_gpio.c	2006-04-17 23:05:49.000000000 -0700
@@ -241,9 +241,9 @@ static int __init cs5535_gpio_init(void)
 static void __exit cs5535_gpio_cleanup(void)
 {
 	dev_t dev_id = MKDEV(major, 0);
+        cdev_del(&cs5535_gpio_cdev);
 	unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
-	if (gpio_base != 0)
-		release_region(gpio_base, CS5535_GPIO_SIZE);
+	release_region(gpio_base, CS5535_GPIO_SIZE);
 }

 module_init(cs5535_gpio_init);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]drivers/char/cs5535_gpio.c:call cdev_del during module_exit to unmap kobject references and other cleanups.
  2006-04-19  7:51   ` Thayumanavar Sachithanantham
@ 2006-04-19  9:35     ` Jiri Slaby
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2006-04-19  9:35 UTC (permalink / raw)
  To: Thayumanavar Sachithanantham
  Cc: Andrew Morton, info-linux, linux-kernel, rdunlap

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thayumanavar Sachithanantham napsal(a):
> During module unloading, cdev_del be called to unmap cdev related
> kobject references and other cleanups(such as inode->i_cdev being set
> to NULL) which prevents the OOPS upon subsequent loading ,usage and
> unloading of modules(as seen in the mail thread:
> http://marc.theaimsgroup.com/?l=linux-kernel&m=114533640609018&w=2).
> 
> Removed test of gpio_base as it is unneeded and will not be zero at
> module unload time.
> 
> Signed-off-by: Thayumanavar Sachithanantham <thayumk@gmail.com>
> Signed-off-by: Andrew Morton <akpm@osdl.org>
> 
> --- linux-2.6/drivers/char/cs5535_gpio.c.orig	2006-04-17
> 21:37:25.000000000 -0700
> +++ linux-2.6/drivers/char/cs5535_gpio.c	2006-04-17 23:05:49.000000000 -0700
> @@ -241,9 +241,9 @@ static int __init cs5535_gpio_init(void)
>  static void __exit cs5535_gpio_cleanup(void)
>  {
>  	dev_t dev_id = MKDEV(major, 0);
> +        cdev_del(&cs5535_gpio_cdev);
Spaces, again.

regards,
- --
Jiri Slaby         www.fi.muni.cz/~xslaby
~\-/~      jirislaby@gmail.com      ~\-/~
B67499670407CE62ACC8 22A032CC55C339D47A7E
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFERgReMsxVwznUen4RArG+AKCBJTe9mOLLXXHPyrzpt3Fm52ZA2gCcCcL3
duNa3zAPb2D0u/z8oWvvh+8=
=atPm
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-04-19  9:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-19  6:52 [PATCH]drivers/char/cs5535_gpio.c:call cdev_del during module_exit to unmap kobject references and other cleanups Thayumanavar Sachithanantham
2006-04-19  7:15 ` Andrew Morton
2006-04-19  7:51   ` Thayumanavar Sachithanantham
2006-04-19  9:35     ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox