aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2011-03-20 09:50:53 -0400
committerJean Delvare <khali@endymion.delvare>2011-03-20 09:50:53 -0400
commitfe6fc25857d293546bd400432cdb77866c797c9b (patch)
tree58fcbe3a5bc3b7ba518c22c544025132cc95ad8d
parent9ea3e941d161f41f920462c50e9b651cc00eccc7 (diff)
i2c: Deprecate i2c_driver.attach_adapter and .detach_adapter
The last legitimate user of i2c_driver.attach_adapter and .detach_adapter is gone, so we can finally deprecate these callbacks. The last few drivers which still use these will have to be updated to make use of standard I2C device instantiation ways instead. Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r--Documentation/feature-removal-schedule.txt9
-rw-r--r--drivers/i2c/Makefile1
-rw-r--r--drivers/i2c/i2c-core.c4
-rw-r--r--include/linux/i2c.h12
4 files changed, 20 insertions, 6 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index f487c6918d78..7ce623bb9637 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -645,3 +645,12 @@ Who: Florian Westphal <fw@strlen.de>
645Files: include/linux/netfilter_ipv4/ipt_addrtype.h 645Files: include/linux/netfilter_ipv4/ipt_addrtype.h
646 646
647---------------------------- 647----------------------------
648
649What: i2c_driver.attach_adapter
650 i2c_driver.detach_adapter
651When: September 2011
652Why: These legacy callbacks should no longer be used as i2c-core offers
653 a variety of preferable alternative ways to instantiate I2C devices.
654Who: Jean Delvare <khali@linux-fr.org>
655
656----------------------------
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index 23ac61e2db39..beee6b2d361d 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_I2C_MUX) += i2c-mux.o
10obj-y += algos/ busses/ muxes/ 10obj-y += algos/ busses/ muxes/
11 11
12ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG 12ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG
13CFLAGS_i2c-core.o := -Wno-deprecated-declarations
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index b9fa1d0320b4..e5f76a0372fd 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -797,6 +797,9 @@ static int i2c_do_add_adapter(struct i2c_driver *driver,
797 797
798 /* Let legacy drivers scan this bus for matching devices */ 798 /* Let legacy drivers scan this bus for matching devices */
799 if (driver->attach_adapter) { 799 if (driver->attach_adapter) {
800 dev_warn(&adap->dev, "attach_adapter method is deprecated\n");
801 dev_warn(&adap->dev, "Please use another way to instantiate "
802 "your i2c_client\n");
800 /* We ignore the return code; if it fails, too bad */ 803 /* We ignore the return code; if it fails, too bad */
801 driver->attach_adapter(adap); 804 driver->attach_adapter(adap);
802 } 805 }
@@ -981,6 +984,7 @@ static int i2c_do_del_adapter(struct i2c_driver *driver,
981 984
982 if (!driver->detach_adapter) 985 if (!driver->detach_adapter)
983 return 0; 986 return 0;
987 dev_warn(&adapter->dev, "detach_adapter method is deprecated\n");
984 res = driver->detach_adapter(adapter); 988 res = driver->detach_adapter(adapter);
985 if (res) 989 if (res)
986 dev_err(&adapter->dev, "detach_adapter failed (%d) " 990 dev_err(&adapter->dev, "detach_adapter failed (%d) "
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 4df12c7e69d7..cd2f75b742ec 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -104,8 +104,8 @@ extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client,
104/** 104/**
105 * struct i2c_driver - represent an I2C device driver 105 * struct i2c_driver - represent an I2C device driver
106 * @class: What kind of i2c device we instantiate (for detect) 106 * @class: What kind of i2c device we instantiate (for detect)
107 * @attach_adapter: Callback for bus addition (for legacy drivers) 107 * @attach_adapter: Callback for bus addition (deprecated)
108 * @detach_adapter: Callback for bus removal (for legacy drivers) 108 * @detach_adapter: Callback for bus removal (deprecated)
109 * @probe: Callback for device binding 109 * @probe: Callback for device binding
110 * @remove: Callback for device unbinding 110 * @remove: Callback for device unbinding
111 * @shutdown: Callback for device shutdown 111 * @shutdown: Callback for device shutdown
@@ -143,11 +143,11 @@ struct i2c_driver {
143 unsigned int class; 143 unsigned int class;
144 144
145 /* Notifies the driver that a new bus has appeared or is about to be 145 /* Notifies the driver that a new bus has appeared or is about to be
146 * removed. You should avoid using this if you can, it will probably 146 * removed. You should avoid using this, it will be removed in a
147 * be removed in a near future. 147 * near future.
148 */ 148 */
149 int (*attach_adapter)(struct i2c_adapter *); 149 int (*attach_adapter)(struct i2c_adapter *) __deprecated;
150 int (*detach_adapter)(struct i2c_adapter *); 150 int (*detach_adapter)(struct i2c_adapter *) __deprecated;
151 151
152 /* Standard driver model interfaces */ 152 /* Standard driver model interfaces */
153 int (*probe)(struct i2c_client *, const struct i2c_device_id *); 153 int (*probe)(struct i2c_client *, const struct i2c_device_id *);