All of lore.kernel.org
 help / color / mirror / Atom feed
* [Fwd: [PATCH] - i2c/i2c-dev.c::i2c_dev_init() cleanup.]
@ 2005-05-19  6:25 Philip Edelbrock
  2005-05-19  6:25 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Philip Edelbrock @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors


I don't think this ever made it to the list:

-------- Original Message --------
From: - Tue Jul  6 09:36:20 2004
Date: Mon, 5 Jul 2004 17:24:39 -0300
From: Luiz Fernando N. Capitulino <lcapitulino@prefeitura.sp.gov.br>
To: greg@kroah.com
Cc: phil@netroedge.com, Andrew Morton <akpm@osdl.org>
Subject: [PATCH] - i2c/i2c-dev.c::i2c_dev_init() cleanup.
Message-ID: <20040705202439.GA743@lorien.prodam>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


  Hi !

  This patch does the fallowing cleanup for
drivers/i2c/i2c-dev.c::i2c_dev_init():

*) in a error condition, return the error code of register_chrdev()
insted of -EIO;
*) adds missing audit for class_register();
*) in a error condition, only prints "Driver Initialisation Failed",
insted printing the cause. (Note that the error will be printed by
the return of the error code, and the information about what function
caused the problem need to be done by a debug code).

  Only compiled, lack of hardware.

Signed-off-by: Luiz Capitulino <lcapitulino@prefeitura.sp.gov.br>

diffstat:  drivers/i2c/i2c-dev.c |   33 +++++++++++++++++++++------------
  1 files changed, 21 insertions(+), 12 deletions(-)

diff -X dontdiff -Nparu a/drivers/i2c/i2c-dev.c a~/drivers/i2c/i2c-dev.c
--- a/drivers/i2c/i2c-dev.c	2004-06-30 16:34:44.000000000 -0300
+++ a~/drivers/i2c/i2c-dev.c	2004-06-30 17:01:05.000000000 -0300
@@ -518,20 +518,29 @@ static int __init i2c_dev_init(void)

  	printk(KERN_INFO "i2c /dev entries driver\n");

-	if (register_chrdev(I2C_MAJOR,"i2c",&i2cdev_fops)) {
-		printk(KERN_ERR "i2c-dev.o: unable to get major %d for i2c bus\n",
-		       I2C_MAJOR);
-		return -EIO;
-	}
+	res = register_chrdev(I2C_MAJOR, "i2c", &i2cdev_fops);
+	if (res)
+		goto out;
+
+	res = class_register(&i2c_dev_class);
+	if (res)
+		goto out_unreg_chrdev;
+
+	res = i2c_add_driver(&i2cdev_driver);
+	if (res)
+		goto out_unreg_class;
+
  	devfs_mk_dir("i2c");
-	class_register(&i2c_dev_class);
-	if ((res = i2c_add_driver(&i2cdev_driver))) {
-		printk(KERN_ERR "i2c-dev.o: Driver registration failed, module not 
inserted.\n");
-		devfs_remove("i2c");
-		unregister_chrdev(I2C_MAJOR,"i2c");
-		return res;
-	}
+
  	return 0;
+
+out_unreg_class:
+	class_unregister(&i2c_dev_class);
+out_unreg_chrdev:
+	unregister_chrdev(I2C_MAJOR,"i2c");
+out:
+	printk(KERN_ERR "%s: Driver Initialisation failed", __FILE__);
+	return res;
  }

  static void __exit i2c_dev_exit(void)

-- 
Luiz Fernando N. Capitulino
<http://www.telecentros.sp.gov.br>

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

* [Fwd: [PATCH] - i2c/i2c-dev.c::i2c_dev_init() cleanup.]
  2005-05-19  6:25 [Fwd: [PATCH] - i2c/i2c-dev.c::i2c_dev_init() cleanup.] Philip Edelbrock
@ 2005-05-19  6:25 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2005-05-19  6:25 UTC (permalink / raw)
  To: lm-sensors

On Wed, Jul 07, 2004 at 10:23:32AM -0700, Philip Edelbrock wrote:
> 
> I don't think this ever made it to the list:

I got it and applied it to my tree, thanks.

greg k-h

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

end of thread, other threads:[~2005-05-19  6:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-19  6:25 [Fwd: [PATCH] - i2c/i2c-dev.c::i2c_dev_init() cleanup.] Philip Edelbrock
2005-05-19  6:25 ` Greg KH

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.