Skip to contentSkip to conversation

I2C: Drop I2C_DEVNAME and i2c_clientname

PATCH New Greg KH 1 participant 1 message Sep 5, 2005

Subsystems (3)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 I2C: Drop I2C_DEVNAME and i2c_clientname

[PATCH] I2C: Drop I2C_DEVNAME and i2c_clientname

I2C_DEVNAME and i2c_clientname were introduced in 2.5.68 [1] to help media/video driver authors who wanted their code to be compatible with both Linux 2.4 and 2.6. The cause of the incompatibility has gone since [2], so I think we can get rid of them, as they tend to make the code harder to read and longer to preprocess/compile for no more benefit.

I'd hope nobody seriously attempts to keep media/video driver compatible across Linux trees anymore, BTW.

[1] http://marc.theaimsgroup.com/?l=linux-kernel&m4930186524598&w=2
[2] http://www.linuxhq.com/kernel/v2.6/0-test3/include/linux/i2c.h

---
commit fae91e72b79ba9a21f0ce7551a1fd7e8984c85a6
tree 1db62e590a010d7ece7f170aedbcc72c8f126122
parent 5b5439652af79106b792faf79b2c1e787e143ba0
author Jean Delvare <[email protected]> Mon, 15 Aug 2005 19:57:04 +0200 committer Greg Kroah-Hartman <[email protected]> Mon, 05 Sep 2005 09:14:35 -0700

 drivers/media/video/bt832.c                    |    2 +
 drivers/media/video/bttv-i2c.c                 |    8 ++---
 drivers/media/video/cx88/cx88-i2c.c            |    8 ++---
 drivers/media/video/ir-kbd-i2c.c               |    2 +
 drivers/media/video/msp3400.c                  |    4 +-
 drivers/media/video/ovcamchip/ovcamchip_core.c |    6 ++--
 drivers/media/video/saa7134/saa6752hs.c        |    2 +
 drivers/media/video/saa7134/saa7134-i2c.c      |    6 ++--
 drivers/media/video/tda7432.c                  |    2 +
 drivers/media/video/tda9840.c                  |    2 +
 drivers/media/video/tda9875.c                  |    2 +
 drivers/media/video/tda9887.c                  |    2 +
 drivers/media/video/tea6415c.c                 |    2 +
 drivers/media/video/tea6420.c                  |    2 +
 drivers/media/video/tuner-core.c               |    2 +
 drivers/media/video/tvaudio.c                  |   41 +++++++++++-------------
 drivers/media/video/tvmixer.c                  |    8 ++---
 drivers/media/video/zoran_card.c               |    2 +
 drivers/usb/media/w9968cf.c                    |    8 ++---
 include/linux/i2c.h                            |    7 ----
 20 files changed, 53 insertions(+), 65 deletions(-)
drivers/media/video/bt832.c +1 -1
@@ -241,7 +241,7 @@ static struct i2c_driver driver = {
 };
 static struct i2c_client client_template  {
-	I2C_DEVNAME("bt832"),
+	.name       = "bt832",
 	.flags      = I2C_CLIENT_ALLOW_USE,
         .driver     = &driver,
 };
drivers/media/video/bttv-i2c.c +4 -4
@@ -109,7 +109,7 @@ static struct i2c_adapter bttv_i2c_adap_
 #ifdef I2C_CLASS_TV_ANALOG
 	.class             = I2C_CLASS_TV_ANALOG,
 #endif
-	I2C_DEVNAME("bt848"),
+	.name              = "bt848",
 	.id                = I2C_HW_B_BT848,
 	.client_register   = attach_inform,
 };
@@ -280,7 +280,7 @@ static struct i2c_adapter bttv_i2c_adap_
 #ifdef I2C_CLASS_TV_ANALOG
 	.class         = I2C_CLASS_TV_ANALOG,
 #endif
-	I2C_DEVNAME("bt878"),
+	.name          = "bt878",
 	.id            = I2C_HW_B_BT848 /* FIXME */,
 	.algo          = &bttv_algo,
 	.client_register = attach_inform,
@@ -296,7 +296,7 @@ static int attach_inform(struct i2c_clie
 	if (bttv_debug)
 		printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n",
 			btv->c.nr,client->driver->name,client->addr,
-			i2c_clientname(client));
+			client->name);
 	if (!client->driver->command)
 		return 0;
 
@@ -324,7 +324,7 @@ void bttv_call_i2c_clients(struct bttv *
 }
 
 static struct i2c_client bttv_i2c_client_template = {
-	I2C_DEVNAME("bttv internal"),
+	.name	= "bttv internal",
 };
 
 
drivers/media/video/cx88/cx88-i2c.c +4 -4
@@ -95,7 +95,7 @@ static int attach_inform(struct i2c_clie
 	struct cx88_core *core = i2c_get_adapdata(client->adapter);
 
 	dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n",
-		client->driver->name,client->addr,i2c_clientname(client));
+		client->driver->name, client->addr, client->name);
 	if (!client->driver->command)
 		return 0;
 
@@ -128,7 +128,7 @@ static int detach_inform(struct i2c_clie
 {
 	struct cx88_core *core = i2c_get_adapdata(client->adapter);
 
-	dprintk(1, "i2c detach [client=%s]\n", i2c_clientname(client));
+	dprintk(1, "i2c detach [client=%s]\n", client->name);
 	return 0;
 }
 
@@ -152,7 +152,7 @@ static struct i2c_algo_bit_data cx8800_i
 /* ----------------------------------------------------------------------- */
 
 static struct i2c_adapter cx8800_i2c_adap_template = {
-	I2C_DEVNAME("cx2388x"),
+	.name              = "cx2388x",
 	.owner             = THIS_MODULE,
 	.id                = I2C_HW_B_CX2388x,
 	.client_register   = attach_inform,
@@ -160,7 +160,7 @@ static struct i2c_adapter cx8800_i2c_ada
 };
 
 static struct i2c_client cx8800_i2c_client_template = {
-        I2C_DEVNAME("cx88xx internal"),
+        .name	= "cx88xx internal",
 };
 
 static char *i2c_devs[128] = {
drivers/media/video/ir-kbd-i2c.c +1 -1
@@ -308,7 +308,7 @@ static struct i2c_driver driver = {
 
 static struct i2c_client client_template  {
-        I2C_DEVNAME("unset"),
+        .name = "unset",
         .driver = &driver
 };
 
drivers/media/video/msp3400.c +2 -2
@@ -1437,7 +1437,7 @@ static struct i2c_driver driver = {
 
 static struct i2c_client client_template  {
-	I2C_DEVNAME("(unset)"),
+	.name      = "(unset)",
 	.flags     = I2C_CLIENT_ALLOW_USE,
         .driver    = &driver,
 };
@@ -1509,7 +1509,7 @@ static int msp_attach(struct i2c_adapter
 	}
 
 	/* hello world :-) */
-	printk(KERN_INFO "msp34xx: init: chip=%s",i2c_clientname(c));
+	printk(KERN_INFO "msp34xx: init: chip=%s", c->name);
 	if (HAVE_NICAM(msp))
 		printk(" +nicam");
 	if (HAVE_SIMPLE(msp))
drivers/media/video/ovcamchip/ovcamchip_core.c +3 -3
@@ -314,7 +314,7 @@ static int ovcamchip_attach(struct i2c_a
 	}
 	memcpy(c, &client_template, sizeof *c);
 	c->adapter = adap;
-	strcpy(i2c_clientname(c), "OV????");
+	strcpy(c->name, "OV????");
 
 	ov = kmalloc(sizeof *ov, GFP_KERNEL);
 	if (!ov) {
@@ -328,7 +328,7 @@ static int ovcamchip_attach(struct i2c_a
 	if (rc < 0)
 		goto error;
 
-	strcpy(i2c_clientname(c), chip_names[ov->subtype]);
+	strcpy(c->name, chip_names[ov->subtype]);
 
 	PDEBUG(1, "Camera chip detection complete");
 
@@ -421,7 +421,7 @@ static struct i2c_driver driver = {
 };
 
 static struct i2c_client client_template = {
-	I2C_DEVNAME("(unset)"),
+	.name =		"(unset)",
 	.driver =	&driver,
 };
 
drivers/media/video/saa7134/saa6752hs.c +1 -1
@@ -598,7 +598,7 @@ static struct i2c_driver driver = {
 
 static struct i2c_client client_template  {
-	I2C_DEVNAME("saa6752hs"),
+	.name       = "saa6752hs",
 	.flags      = I2C_CLIENT_ALLOW_USE,
         .driver     = &driver,
 };
drivers/media/video/saa7134/saa7134-i2c.c +3 -3
@@ -334,7 +334,7 @@ static int attach_inform(struct i2c_clie
 	struct tuner_setup tun_setup;
 
 	d1printk( "%s i2c attach [addr=0x%x,client=%s]\n",
-		client->driver->name,client->addr,i2c_clientname(client));
+		 client->driver->name, client->addr, client->name);
 
 	if (!client->driver->command)
 		return 0;
@@ -380,14 +380,14 @@ static struct i2c_adapter saa7134_adap_t
 #ifdef I2C_CLASS_TV_ANALOG
 	.class         = I2C_CLASS_TV_ANALOG,
 #endif
-	I2C_DEVNAME("saa7134"),
+	.name          = "saa7134",
 	.id            = I2C_HW_SAA7134,
 	.algo          = &saa7134_algo,
 	.client_register = attach_inform,
 };
 
 static struct i2c_client saa7134_client_template = {
-	I2C_DEVNAME("saa7134 internal"),
+	.name	= "saa7134 internal",
 };
 
 /* ----------------------------------------------------------- */
drivers/media/video/tda7432.c +1 -1
@@ -513,7 +513,7 @@ static struct i2c_driver driver = {
 
 static struct i2c_client client_template  {
-	I2C_DEVNAME("tda7432"),
+	.name       = "tda7432",
 	.driver     = &driver,
 };
 
drivers/media/video/tda9840.c +1 -1
@@ -231,7 +231,7 @@ static struct i2c_driver driver = {
 };
 
 static struct i2c_client client_template = {
-	I2C_DEVNAME("tda9840"),
+	.name = "tda9840",
 	.driver = &driver,
 };
 
drivers/media/video/tda9875.c +1 -1
@@ -384,7 +384,7 @@ static struct i2c_driver driver = {
 
 static struct i2c_client client_template  {
-        I2C_DEVNAME("tda9875"),
+        .name      = "tda9875",
         .driver    = &driver,
 };
 
drivers/media/video/tda9887.c +1 -1
@@ -793,7 +793,7 @@ static struct i2c_driver driver = {
 };
 static struct i2c_client client_template  {
-	I2C_DEVNAME("tda9887"),
+	.name      = "tda9887",
 	.flags     = I2C_CLIENT_ALLOW_USE,
         .driver    = &driver,
 };
drivers/media/video/tea6415c.c +1 -1
@@ -200,7 +200,7 @@ static struct i2c_driver driver = {
 };
 
 static struct i2c_client client_template = {
-	I2C_DEVNAME("tea6415c"),
+	.name = "tea6415c",
 	.driver = &driver,
 };
 
drivers/media/video/tea6420.c +1 -1
@@ -177,7 +177,7 @@ static struct i2c_driver driver = {
 };
 
 static struct i2c_client client_template = {
-	I2C_DEVNAME("tea6420"),
+	.name = "tea6420",
 	.driver = &driver,
 };
 
drivers/media/video/tuner-core.c +1 -1
@@ -709,7 +709,7 @@ static struct i2c_driver driver = {
 		   },
 };
 static struct i2c_client client_template = {
-	I2C_DEVNAME("(tuner unset)"),
+	.name = "(tuner unset)",
 	.flags = I2C_CLIENT_ALLOW_USE,
 	.driver = &driver,
 };
drivers/media/video/tvaudio.c +19 -22

137 lines not on this page · raw message

drivers/media/video/tvmixer.c +4 -4
@@ -91,7 +91,7 @@ static int tvmixer_ioctl(struct inode *i
         if (cmd = SOUND_MIXER_INFO) {
                 mixer_info info;
                 strlcpy(info.id, "tv card", sizeof(info.id));
-                strlcpy(info.name, i2c_clientname(client), sizeof(info.name));
+                strlcpy(info.name, client->name, sizeof(info.name));
                 info.modify_counter = 42 /* FIXME */;
                 if (copy_to_user(argp, &info, sizeof(info)))
                         return -EFAULT;
@@ -100,7 +100,7 @@ static int tvmixer_ioctl(struct inode *i
         if (cmd = SOUND_OLD_MIXER_INFO) {
                 _old_mixer_info info;
                 strlcpy(info.id, "tv card", sizeof(info.id));
-                strlcpy(info.name, i2c_clientname(client), sizeof(info.name));
+                strlcpy(info.name, client->name, sizeof(info.name));
                 if (copy_to_user(argp, &info, sizeof(info)))
                         return -EFAULT;
                 return 0;
@@ -295,7 +295,7 @@ static int tvmixer_clients(struct i2c_cl
 			devices[i].dev = NULL;
 			devices[i].minor = -1;
 			printk("tvmixer: %s unregistered (#1)\n",
-			       i2c_clientname(client));
+			       client->name);
 			return 0;
 		}
 	}
@@ -354,7 +354,7 @@ static void __exit tvmixer_cleanup_modul
 		if (devices[i].minor != -1) {
 			unregister_sound_mixer(devices[i].minor);
 			printk("tvmixer: %s unregistered (#2)\n",
-			       i2c_clientname(devices[i].dev));
+			       devices[i].dev->name);
 		}
 	}
 }
drivers/media/video/zoran_card.c +1 -1
@@ -737,7 +737,7 @@ static struct i2c_algo_bit_data zoran_i2
 };
 
 static struct i2c_adapter zoran_i2c_adapter_template = {
-	I2C_DEVNAME("zr36057"),
+	.name = "zr36057",
 	.id = I2C_HW_B_ZR36067,
 	.algo = NULL,
 	.client_register = zoran_i2c_client_register,
drivers/usb/media/w9968cf.c +3 -5
@@ -1523,7 +1523,6 @@ static u32 w9968cf_i2c_func(struct i2c_a
 static int w9968cf_i2c_attach_inform(struct i2c_client* client)
 {
 	struct w9968cf_device* cam = i2c_get_adapdata(client->adapter);
-	const char* clientname = i2c_clientname(client);
 	int id = client->driver->id, err = 0;
 
 	if (id = I2C_DRIVERID_OVCAMCHIP) {
@@ -1535,12 +1534,12 @@ static int w9968cf_i2c_attach_inform(str
 		}
 	} else {
 		DBG(4, "Rejected client [%s] with driver [%s]", 
-		    clientname, client->driver->name)
+		    client->name, client->driver->name)
 		return -EINVAL;
 	}
 
 	DBG(5, "I2C attach client [%s] with driver [%s]",
-	    clientname, client->driver->name)
+	    client->name, client->driver->name)
 
 	return 0;
 }
@@ -1549,12 +1548,11 @@ static int w9968cf_i2c_attach_inform(str
 static int w9968cf_i2c_detach_inform(struct i2c_client* client)
 {
 	struct w9968cf_device* cam = i2c_get_adapdata(client->adapter);
-	const char* clientname = i2c_clientname(client);
 
 	if (cam->sensor_client = client)
 		cam->sensor_client = NULL;
 
-	DBG(5, "I2C detach client [%s]", clientname)
+	DBG(5, "I2C detach client [%s]", client->name)
 
 	return 0;
 }
include/linux/i2c.h +0 -7
@@ -178,13 +178,6 @@ static inline void i2c_set_clientdata (s
 	dev_set_drvdata (&dev->dev, data);
 }
 
-#define I2C_DEVNAME(str)	.name = str
-
-static inline char *i2c_clientname(struct i2c_client *c)
-{
-	return &c->name[0];
-}
-
 /*
  * The following structs are for those who like to implement new bus drivers:
  * i2c_algorithm is the interface to a class of hardware solutions which can