Skip to contentSkip to conversation

add i2c_clientname()

PATCH In review Gerd Knorr 2 participants 4 messages Apr 2, 2003 – Apr 8, 2003 I2C

lore
Share & tools
lore

Gerd Knorr

author
#0 lore raw

PATCH 1/1 add i2c_clientname()

Hi,

This patch just adds a #define and a inline function to hide the "i2c_client->name" => "i2c_client->dev.name" move introduced by the recent i2c updates. That makes it easier to build i2c drivers on both 2.4 and 2.5 kernels.

Gerd

include/linux/i2c.h +7 -0
diff -u linux-2.5.66/include/linux/i2c.h linux/include/linux/i2c.h
@@ -182,6 +182,13 @@
 	return dev_set_drvdata (&dev->dev, data);
 }
 
+#define I2C_DEVNAME(str)   .dev = { .name = str }
+
+static inline char *i2c_clientname(struct i2c_client *c)
+{
+	return c->dev.name;
+}
+
 /*
  * 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
Signature · 1 line
Michael Moore for president!
#1 lore raw
Quoted 5 lines · Gerd Knorr

This patch just adds a #define and a inline function to hide the "i2c_client->name" => "i2c_client->dev.name" move introduced by the recent i2c updates. That makes it easier to build i2c drivers on both 2.4 and 2.5 kernels.

This is going to be a harder and harder problem as time goes on, and as the i2c core changes over time. I would just give up now :)

Quoted 1 line

+#define I2C_DEVNAME(str) .dev = { .name = str }

Why this macro? You don't use it in your driver, right?

thanks,

greg k-h

author
#2 lore raw
Quoted 7 lines
Quoted 4 lines

This patch just adds a #define and a inline function to hide the "i2c_client->name" => "i2c_client->dev.name" move introduced by the recent i2c updates. That makes it easier to build i2c drivers on both 2.4 and 2.5 kernels.

This is going to be a harder and harder problem as time goes on, and as the i2c core changes over time. I would just give up now :)

I don't, interfacing with the i2c core is not that much code in most drivers.

Quoted 3 lines
Quoted 1 line

+#define I2C_DEVNAME(str) .dev = { .name = str }

Why this macro? You don't use it in your driver, right?

I use it in my current driver code (patches are at
http://bytesex.org/patches/wip/). Submitting those patches doesn't make sense before that patch is in because I would get flooded with "bttv doesn't compile any more" style mails ...

Gerd

Signature · 1 line
Michael Moore for president!
#3 lore raw
In reply to Gerd Knorr
Quoted 6 lines · Gerd Knorr

Hi,

This patch just adds a #define and a inline function to hide the "i2c_client->name" => "i2c_client->dev.name" move introduced by the recent i2c updates. That makes it easier to build i2c drivers on both 2.4 and 2.5 kernels.

Thanks, I've applied this patch and will send it on soon.

greg k-h