Skip to contentSkip to conversation

drivers/i2c/i2c-core.c: make code static

PATCH In review Adrian Bunk 3 participants 3 messages Jul 29, 2007 – Aug 9, 2007 I2C

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/i2c/i2c-core.c: make code static

After the i2c-isa removal some code can become static.

---

 drivers/i2c/i2c-core.c |    7 +++----
 include/linux/i2c.h    |    2 --
 2 files changed, 3 insertions(+), 6 deletions(-)
include/linux/i2c.h renamed from include/linux/i2c.h.old +0 -2
@@ -35,8 +35,6 @@
 #include <linux/sched.h>	/* for completion */
 #include <linux/mutex.h>
 
-extern struct bus_type i2c_bus_type;
-
 /* --- General options ------------------------------------------------	*/
 
 struct i2c_msg;
drivers/i2c/i2c-core.c renamed from drivers/i2c/i2c-core.c.old +3 -4
@@ -190,7 +190,7 @@
 	{ },
 };
 
-struct bus_type i2c_bus_type = {
+static struct bus_type i2c_bus_type = {
 	.name		= "i2c",
 	.dev_attrs	= i2c_dev_attrs,
 	.match		= i2c_device_match,
@@ -201,7 +201,6 @@
 	.suspend	= i2c_device_suspend,
 	.resume		= i2c_device_resume,
 };
-EXPORT_SYMBOL_GPL(i2c_bus_type);
 
 /**
  * i2c_new_device - instantiate an i2c device for use with a new style driver
@@ -285,7 +284,7 @@
 
 /* I2C bus adapters -- one roots each I2C or SMBUS segment */
 
-void i2c_adapter_dev_release(struct device *dev)
+static void i2c_adapter_dev_release(struct device *dev)
 {
 	struct i2c_adapter *adap = to_i2c_adapter(dev);
 	complete(&adap->dev_released);
@@ -303,7 +302,7 @@
 	{ },
 };
 
-struct class i2c_adapter_class = {
+static struct class i2c_adapter_class = {
 	.owner			= THIS_MODULE,
 	.name			= "i2c-adapter",
 	.dev_attrs		= i2c_adapter_attrs,
#1 lore raw

Hi Adrian,

Quoted 33 lines · Adrian Bunk

After the i2c-isa removal some code can become static.

---

 drivers/i2c/i2c-core.c |    7 +++----
 include/linux/i2c.h    |    2 --
 2 files changed, 3 insertions(+), 6 deletions(-)
include/linux/i2c.h renamed from include/linux/i2c.h.old +0 -2
@@ -35,8 +35,6 @@
 #include <linux/sched.h>	/* for completion */
 #include <linux/mutex.h>
 
-extern struct bus_type i2c_bus_type;
-
 /* --- General options ------------------------------------------------	*/
 
 struct i2c_msg;
drivers/i2c/i2c-core.c renamed from drivers/i2c/i2c-core.c.old +1 -1
@@ -190,7 +190,7 @@
 	{ },
 };
 
-struct bus_type i2c_bus_type = {
+static struct bus_type i2c_bus_type = {
 	.name		= "i2c",
 	.dev_attrs	= i2c_dev_attrs,
 	.match		= i2c_device_match,

drivers/i2c/i2c-core.c line 204

Quoted 4 lines
drivers/i2c/i2c-core.c renamed from drivers/i2c/i2c-core.c.old +0 -1
@@ -201,7 +201,6 @@
 	.suspend	= i2c_device_suspend,
 	.resume		= i2c_device_resume,
 };
-EXPORT_SYMBOL_GPL(i2c_bus_type);

This one was left exported on request by David Brownell. See this discussion thread:
http://lists.lm-sensors.org/pipermail/i2c/2007-March/000924.html

I am personally fine with removing this export, as it can always be added later if needed. But if others share David's point of view, I am also fine leaving the export as is.

Quoted 13 lines
drivers/i2c/i2c-core.c renamed from drivers/i2c/i2c-core.c.old +1 -1
 /**
  * i2c_new_device - instantiate an i2c device for use with a new style driver
@@ -285,7 +284,7 @@
 
 /* I2C bus adapters -- one roots each I2C or SMBUS segment */
 
-void i2c_adapter_dev_release(struct device *dev)
+static void i2c_adapter_dev_release(struct device *dev)
 {
 	struct i2c_adapter *adap = to_i2c_adapter(dev);
 	complete(&adap->dev_released);

drivers/i2c/i2c-core.c line 308

Quoted 8 lines
drivers/i2c/i2c-core.c renamed from drivers/i2c/i2c-core.c.old +1 -1
@@ -303,7 +302,7 @@
 	{ },
 };
 
-struct class i2c_adapter_class = {
+static struct class i2c_adapter_class = {
 	.owner			= THIS_MODULE,
 	.name			= "i2c-adapter",
 	.dev_attrs		= i2c_adapter_attrs,

These ones are unquestionably correct, good catch, thanks.

Signature · 1 line
Jean Delvare
#2 lore raw
Quoted 5 lines · Jean Delvare
Quoted 1 line

-EXPORT_SYMBOL_GPL(i2c_bus_type);

This one was left exported on request by David Brownell. See this discussion thread:
http://lists.lm-sensors.org/pipermail/i2c/2007-March/000924.html

Actually, that wasn't a request; it was me answering why I didn't put a particular comment there, as part of moving an existing export declaration up next to the symbol's definition.

Quoted 2 lines

I am personally fine with removing this export, as it can always be added later if needed.

Right, that's what various other busses do.