All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregkh@suse.de (Greg KH)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH] i2c: Drop i2c_driver.{owner,name}, 1 of 11
Date: Fri, 06 Jan 2006 22:07:34 +0000	[thread overview]
Message-ID: <11365852541748@kroah.com> (raw)

[PATCH] i2c: Drop i2c_driver.{owner,name}, 1 of 11

We should use the i2c_driver.driver's .name and .owner fields
instead of the i2c_driver's ones.

This patch updates the core of the i2c drivers: it removes .name and
.owner fields from the struct i2c_device and modify various
functions to use struct device fields instead.

Signed-off-by: Laurent Riffard <laurent.riffard at free.fr>
Signed-off-by: Jean Delvare <khali at linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>

---
commit 35d8b2e6b8e86b0d5126f36613b5202d4eb978b6
tree 2327c791f10216db39ae5c22235a13a5bc886d1e
parent 482c788ded0aa9710722eaf9cf60886d3b923218
author Laurent Riffard <laurent.riffard at free.fr> Sat, 26 Nov 2005 20:34:05 +0100
committer Greg Kroah-Hartman <gregkh at suse.de> Thu, 05 Jan 2006 22:16:22 -0800

 drivers/i2c/busses/i2c-isa.c |    4 +---
 drivers/i2c/i2c-core.c       |   22 +++++++++++-----------
 drivers/i2c/i2c-dev.c        |    6 ++++--
 include/linux/i2c.h          |    5 +++--
 4 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c
index 03672c9..9f93fb8 100644
--- a/drivers/i2c/busses/i2c-isa.c
+++ b/drivers/i2c/busses/i2c-isa.c
@@ -92,8 +92,6 @@ int i2c_isa_add_driver(struct i2c_driver
 	int res;
 
 	/* Add the driver to the list of i2c drivers in the driver core */
-	driver->driver.name = driver->name;
-	driver->driver.owner = driver->owner;
 	driver->driver.bus = &i2c_bus_type;
 	driver->driver.probe = i2c_isa_device_probe;
 	driver->driver.remove = i2c_isa_device_remove;
@@ -124,7 +122,7 @@ int i2c_isa_del_driver(struct i2c_driver
 		if ((res = driver->detach_client(client))) {
 			dev_err(&isa_adapter.dev, "Failed, driver "
 				"%s not unregistered!\n",
-				driver->name);
+				driver->driver.name);
 			return res;
 		}
 	}
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index a1c5dff..4ce5f0f 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -235,7 +235,8 @@ int i2c_del_adapter(struct i2c_adapter *
 		if (driver->detach_adapter)
 			if ((res = driver->detach_adapter(adap))) {
 				dev_err(&adap->dev, "detach_adapter failed "
-					"for driver [%s]\n", driver->name);
+					"for driver [%s]\n",
+					driver->driver.name);
 				goto out_unlock;
 			}
 	}
@@ -295,8 +296,6 @@ int i2c_add_driver(struct i2c_driver *dr
 	down(&core_lists);
 
 	/* add the driver to the list of i2c drivers in the driver core */
-	driver->driver.owner = driver->owner;
-	driver->driver.name = driver->name;
 	driver->driver.bus = &i2c_bus_type;
 	driver->driver.probe = i2c_device_probe;
 	driver->driver.remove = i2c_device_remove;
@@ -306,7 +305,7 @@ int i2c_add_driver(struct i2c_driver *dr
 		goto out_unlock;
 	
 	list_add_tail(&driver->list,&drivers);
-	pr_debug("i2c-core: driver [%s] registered\n", driver->name);
+	pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name);
 
 	/* now look for instances of driver on our adapters */
 	if (driver->attach_adapter) {
@@ -344,7 +343,8 @@ int i2c_del_driver(struct i2c_driver *dr
 		if (driver->detach_adapter) {
 			if ((res = driver->detach_adapter(adap))) {
 				dev_err(&adap->dev, "detach_adapter failed "
-					"for driver [%s]\n", driver->name);
+					"for driver [%s]\n",
+					driver->driver.name);
 				goto out_unlock;
 			}
 		} else {
@@ -368,7 +368,7 @@ int i2c_del_driver(struct i2c_driver *dr
 
 	driver_unregister(&driver->driver);
 	list_del(&driver->list);
-	pr_debug("i2c-core: driver [%s] unregistered\n", driver->name);
+	pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name);
 
  out_unlock:
 	up(&core_lists);
@@ -473,10 +473,10 @@ int i2c_detach_client(struct i2c_client 
 static int i2c_inc_use_client(struct i2c_client *client)
 {
 
-	if (!try_module_get(client->driver->owner))
+	if (!try_module_get(client->driver->driver.owner))
 		return -ENODEV;
 	if (!try_module_get(client->adapter->owner)) {
-		module_put(client->driver->owner);
+		module_put(client->driver->driver.owner);
 		return -ENODEV;
 	}
 
@@ -485,7 +485,7 @@ static int i2c_inc_use_client(struct i2c
 
 static void i2c_dec_use_client(struct i2c_client *client)
 {
-	module_put(client->driver->owner);
+	module_put(client->driver->driver.owner);
 	module_put(client->adapter->owner);
 }
 
@@ -524,14 +524,14 @@ void i2c_clients_command(struct i2c_adap
 	down(&adap->clist_lock);
 	list_for_each(item,&adap->clients) {
 		client = list_entry(item, struct i2c_client, list);
-		if (!try_module_get(client->driver->owner))
+		if (!try_module_get(client->driver->driver.owner))
 			continue;
 		if (NULL != client->driver->command) {
 			up(&adap->clist_lock);
 			client->driver->command(client,cmd,arg);
 			down(&adap->clist_lock);
 		}
-		module_put(client->driver->owner);
+		module_put(client->driver->driver.owner);
        }
        up(&adap->clist_lock);
 }
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 9da51eb..9715217 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -481,8 +481,10 @@ static int i2cdev_command(struct i2c_cli
 }
 
 static struct i2c_driver i2cdev_driver = {
-	.owner		= THIS_MODULE,
-	.name		= "dev_driver",
+	.driver = {
+		.owner	= THIS_MODULE,
+		.name	= "dev_driver",
+	},
 	.id		= I2C_DRIVERID_I2CDEV,
 	.attach_adapter	= i2cdev_attach_adapter,
 	.detach_adapter	= i2cdev_detach_adapter,
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index a9cea62..75aa18e 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -105,11 +105,12 @@ extern s32 i2c_smbus_read_i2c_block_data
  * A driver is capable of handling one or more physical devices present on
  * I2C adapters. This information is used to inform the driver of adapter
  * events.
+ *
+ * The driver.owner field should be set to the module owner of this driver.
+ * The driver.name field should be set to the name of this driver.
  */
 
 struct i2c_driver {
-	struct module *owner;
-	char name[32];
 	int id;
 	unsigned int class;
 



             reply	other threads:[~2006-01-06 22:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-06 22:07 Greg KH [this message]
2006-01-06 22:07 ` [lm-sensors] [PATCH] i2c: Drop i2c_driver.{owner,name}, 5 of 11 Greg KH
2006-01-06 22:07 ` [lm-sensors] [PATCH] i2c: Drop i2c_driver.{owner,name}, 2 " Greg KH
2006-01-06 22:07 ` [lm-sensors] [PATCH] i2c: Drop i2c_driver.{owner,name}, 4 " Greg KH
2006-01-06 22:07 ` [lm-sensors] [PATCH] i2c: Drop i2c_driver.{owner,name}, 9 " Greg KH
2006-01-06 22:07 ` [lm-sensors] [PATCH] i2c: Drop i2c_driver.{owner,name}, 11 " Greg KH
2006-01-06 22:07 ` [lm-sensors] [PATCH] i2c: Drop i2c_driver.{owner,name}, 7 " Greg KH
2006-01-06 22:07 ` [lm-sensors] [PATCH] i2c: Drop i2c_driver.{owner,name}, 10 " Greg KH
2006-01-06 22:07 ` [lm-sensors] [PATCH] i2c: Drop i2c_driver.{owner,name}, 6 " Greg KH
2006-01-06 22:07 ` [lm-sensors] [PATCH] i2c: Drop i2c_driver.{owner,name}, 3 " Greg KH
2006-01-06 22:07 ` [lm-sensors] [PATCH] i2c: Drop i2c_driver.{owner,name}, 8 " 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=11365852541748@kroah.com \
    --to=gregkh@suse.de \
    --cc=lm-sensors@vger.kernel.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.