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] More i2c driver changes for 2.5.65
Date: Fri, 21 Mar 2003 17:04 -0800	[thread overview]
Message-ID: <10482950873871@kroah.com> (raw)
In-Reply-To: <10482950874081@kroah.com>

ChangeSet 1.1194, 2003/03/21 16:26:04-08:00, greg@kroah.com

i2c: actually register the i2c client device with the driver core.

We have to initialize the client structure with 0 to keep the
driver core from oopsing.

Now everything is hooked up enough to start removing the i2c sysctl
and proc crud.


 drivers/i2c/chips/adm1021.c |    2 ++
 drivers/i2c/chips/lm75.c    |    2 ++
 drivers/i2c/i2c-core.c      |   10 ++++++++++
 3 files changed, 14 insertions(+)


diff -Nru a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
--- a/drivers/i2c/chips/adm1021.c	Fri Mar 21 16:52:49 2003
+++ b/drivers/i2c/chips/adm1021.c	Fri Mar 21 16:52:49 2003
@@ -221,6 +221,8 @@
 		err = -ENOMEM;
 		goto error0;
 	}
+	memset(new_client, 0x00, sizeof(struct i2c_client) +
+				 sizeof(struct adm1021_data));
 
 	data = (struct adm1021_data *) (new_client + 1);
 	i2c_set_clientdata(new_client, data);
diff -Nru a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c
--- a/drivers/i2c/chips/lm75.c	Fri Mar 21 16:52:49 2003
+++ b/drivers/i2c/chips/lm75.c	Fri Mar 21 16:52:49 2003
@@ -140,6 +140,8 @@
 		err = -ENOMEM;
 		goto error0;
 	}
+	memset(new_client, 0x00, sizeof(struct i2c_client) +
+				 sizeof(struct lm75_data));
 
 	data = (struct lm75_data *) (new_client + 1);
 	i2c_set_clientdata(new_client, data);
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c	Fri Mar 21 16:52:49 2003
+++ b/drivers/i2c/i2c-core.c	Fri Mar 21 16:52:49 2003
@@ -378,6 +378,15 @@
 
 	if (client->flags & I2C_CLIENT_ALLOW_USE)
 		client->usage_count = 0;
+
+	client->dev.parent = &client->adapter->dev;
+	client->dev.driver = &client->driver->driver;
+	client->dev.bus = &i2c_bus_type;
+	
+	snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), "i2c_dev_%d", i);
+	printk("registering %s\n", client->dev.bus_id);
+	device_register(&client->dev);
+	
 	return 0;
 }
 
@@ -414,6 +423,7 @@
 	res = -ENODEV;
 
  out_unlock:
+	device_unregister(&client->dev);
 	up(&adapter->list);
  out:
 	return res;


  reply	other threads:[~2003-03-22  0:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-22  1:04 [BK PATCH] More i2c driver changes for 2.5.65 Greg KH
2003-03-22  1:04 ` [PATCH] " Greg KH
2003-03-22  1:04   ` Greg KH
2003-03-22  1:04     ` Greg KH
2003-03-22  1:04       ` Greg KH
2003-03-22  1:04         ` Greg KH
2003-03-22  1:04           ` Greg KH
2003-03-22  1:04             ` Greg KH [this message]
2003-03-22  1:04               ` Greg KH
2003-03-22  1:04                 ` Greg KH
2003-03-25  9:35                 ` Pavel Machek
2003-03-25  1:29                   ` Greg KH
2003-03-25  2:04                     ` Dave Jones
2003-03-25  3:34                       ` Greg KH
2003-03-22  2:33     ` Petr Vandrovec
2003-03-23  8:49       ` 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=10482950873871@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