public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, sensors@stimpy.netroedge.com
Subject: Re: [PATCH] I2C update for 2.6.8-rc1
Date: Wed, 14 Jul 2004 17:07:08 -0700	[thread overview]
Message-ID: <10898500281194@kroah.com> (raw)
In-Reply-To: <10898500272030@kroah.com>

ChangeSet 1.1784.13.5, 2004/07/08 16:07:27-07:00, lcapitulino@prefeitura.sp.gov.br

[PATCH] I2C: i2c/i2c-dev.c::i2c_dev_init() cleanup.

 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>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


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


diff -Nru a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
--- a/drivers/i2c/i2c-dev.c	2004-07-14 17:00:12 -07:00
+++ b/drivers/i2c/i2c-dev.c	2004-07-14 17:00:12 -07:00
@@ -518,20 +518,29 @@
 
 	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)


  reply	other threads:[~2004-07-15  0:32 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-15  0:05 [BK PATCH] I2C update for 2.6.8-rc1 Greg KH
2004-07-15  0:07 ` [PATCH] " Greg KH
2004-07-15  0:07   ` Greg KH
2004-07-15  0:07     ` Greg KH
2004-07-15  0:07       ` Greg KH
2004-07-15  0:07         ` Greg KH [this message]
2004-07-15  0:07           ` Greg KH
2004-07-15  0:07             ` Greg KH
2004-07-15  0:07               ` Greg KH
2004-07-15  0:07                 ` Greg KH
2004-07-15  0:07                   ` Greg KH
2004-07-15  0:07                     ` Greg KH
2004-07-15  0:07                       ` Greg KH
2004-07-15  0:07                         ` Greg KH
2004-07-15  0:07                           ` Greg KH
2004-07-15  0:07                             ` Greg KH
2004-07-16 17:07                         ` Pavel Machek
2004-07-16 17:17                           ` Greg KH
2004-07-16 17:39                             ` Bob Riegelmann
2004-07-16 18:19                             ` Adam Kropelin
2004-07-17 14:30 ` Greg (or anyone else) one small i2c question Reinder
2004-07-30  5:40   ` --- " Reinder
2004-07-30  6:30     ` Denis Vlasenko
2004-08-25  6:44   ` Greg " Greg KH
2004-08-24 21:58 ` [BK PATCH] I2C update for 2.6.8-rc1 Alex Williamson
2004-08-24 22:04   ` Greg KH
2004-08-25  0:37     ` Linus Torvalds
2004-08-25  1:38       ` Alex Williamson
2004-08-25  1:42         ` Alex Williamson
2004-08-25  2:02         ` Linus Torvalds
2004-08-25  6:14           ` Greg KH
2004-08-25  6:36             ` Greg KH

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=10898500281194@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sensors@stimpy.netroedge.com \
    /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