Skip to contentSkip to conversation

i2c: Warn on deprecated binding model use

PATCH In review Jean Delvare 2 participants 3 messages Jan 13, 2009 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: Warn on deprecated binding model use

Let the kernel developers know that i2c_attach_client() and i2c_detach_client() are deprecated and should no longer be used. Drivers using these should be converted to the standard device driver binding model (probe and remove methods.)

---
This is only for linux-next for now, in the hope that it will speed up the conversion of the remaining legacy i2c drivers.

 include/linux/i2c.h |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
include/linux/i2c.h +5 -3
@@ -151,7 +151,7 @@ struct i2c_driver {
 	 * has been dynamically allocated by the driver in the function above,
 	 * it must be freed here.  (LEGACY I2C DRIVERS ONLY)
 	 */
-	int (*detach_client)(struct i2c_client *);
+	int (*detach_client)(struct i2c_client *) __deprecated;
 
 	/* Standard driver model interfaces, for "new style" i2c drivers.
 	 * With the driver model, device enumeration is NEVER done by drivers;
@@ -429,8 +429,10 @@ static inline int i2c_add_driver(struct
 	return i2c_register_driver(THIS_MODULE, driver);
 }
 
-extern int i2c_attach_client(struct i2c_client *);
-extern int i2c_detach_client(struct i2c_client *);
+/* These are deprecated, your driver should use the standard .probe()
+ * and .remove() methods instead. */
+extern int __deprecated i2c_attach_client(struct i2c_client *);
+extern int __deprecated i2c_detach_client(struct i2c_client *);
 
 extern struct i2c_client *i2c_use_client(struct i2c_client *client);
 extern void i2c_release_client(struct i2c_client *client);
Signature · 1 line
Jean Delvare

A message that is not in the archive (sent off-list or not yet received): [email protected]

Acked-by
#2 lore raw
Quoted 6 lines · Jean Delvare

Let the kernel developers know that i2c_attach_client() and i2c_detach_client() are deprecated and should no longer be used. Drivers using these should be converted to the standard device driver binding model (probe and remove methods.)

This is a good idea, we should also signal a kernel date when the old probe method will be removed (IMHO, the next merge window).

Quoted 39 lines

---
This is only for linux-next for now, in the hope that it will speed up the conversion of the remaining legacy i2c drivers.

 include/linux/i2c.h |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
include/linux/i2c.h +5 -3
@@ -151,7 +151,7 @@ struct i2c_driver {
 	 * has been dynamically allocated by the driver in the function above,
 	 * it must be freed here.  (LEGACY I2C DRIVERS ONLY)
 	 */
-	int (*detach_client)(struct i2c_client *);
+	int (*detach_client)(struct i2c_client *) __deprecated;
 
 	/* Standard driver model interfaces, for "new style" i2c drivers.
 	 * With the driver model, device enumeration is NEVER done by drivers;
@@ -429,8 +429,10 @@ static inline int i2c_add_driver(struct
 	return i2c_register_driver(THIS_MODULE, driver);
 }
 
-extern int i2c_attach_client(struct i2c_client *);
-extern int i2c_detach_client(struct i2c_client *);
+/* These are deprecated, your driver should use the standard .probe()
+ * and .remove() methods instead. */
+extern int __deprecated i2c_attach_client(struct i2c_client *);
+extern int __deprecated i2c_detach_client(struct i2c_client *);
 
 extern struct i2c_client *i2c_use_client(struct i2c_client *client);
 extern void i2c_release_client(struct i2c_client *client);
Signature · 6 lines
-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi Ben,

Quoted 10 lines · Ben Dooks
Quoted 6 lines · Jean Delvare

Let the kernel developers know that i2c_attach_client() and i2c_detach_client() are deprecated and should no longer be used. Drivers using these should be converted to the standard device driver binding model (probe and remove methods.)

This is a good idea, we should also signal a kernel date when the old probe method will be removed (IMHO, the next merge window).

There's an entry in feature-removal-schedule.txt already:

What:   i2c_attach_client(), i2c_detach_client(), i2c_driver->detach_client()
When:   2.6.29 (ideally) or 2.6.30 (more likely)
Why:    Deprecated by the new (standard) device driver binding model. Use
        i2c_driver->probe() and ->remove() instead.

Who: Jean Delvare <[email protected]>

I'd say this is sufficient?

Quoted 1 line

Thanks,

Signature · 1 line
Jean Delvare