提交 0c176170 编写于 作者: W Wolfram Sang

i2c: add deprecation warning for class based instantiation

Class based instantiation can cause noticeable delays when booting. This
mechanism is used when it is not possible to describe slaves on I2C
busses. As we do have other mechanisms, most embedded I2C will not need
classes and for embedded it is explicitly not recommended to use them. Add
a deprecation warning for drivers which want to disable class based
instantiation in the near future to gain boot-up time, so users relying
on this technique can switch to something better. They really should.
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
上级 624df09f
...@@ -1941,6 +1941,13 @@ static int i2c_detect_address(struct i2c_client *temp_client, ...@@ -1941,6 +1941,13 @@ static int i2c_detect_address(struct i2c_client *temp_client,
struct i2c_client *client; struct i2c_client *client;
/* Detection succeeded, instantiate the device */ /* Detection succeeded, instantiate the device */
if (adapter->class & I2C_CLASS_DEPRECATED)
dev_warn(&adapter->dev,
"This adapter will soon drop class based instantiation of devices. "
"Please make sure client 0x%02x gets instantiated by other means. "
"Check 'Documentation/i2c/instantiating-devices' for details.\n",
info.addr);
dev_dbg(&adapter->dev, "Creating %s at 0x%02x\n", dev_dbg(&adapter->dev, "Creating %s at 0x%02x\n",
info.type, info.addr); info.type, info.addr);
client = i2c_new_device(adapter, &info); client = i2c_new_device(adapter, &info);
......
...@@ -487,6 +487,7 @@ void i2c_unlock_adapter(struct i2c_adapter *); ...@@ -487,6 +487,7 @@ void i2c_unlock_adapter(struct i2c_adapter *);
#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
#define I2C_CLASS_SPD (1<<7) /* Memory modules */ #define I2C_CLASS_SPD (1<<7) /* Memory modules */
#define I2C_CLASS_DEPRECATED (1<<8) /* Warn users that adapter will stop using classes */
/* Internal numbers to terminate lists */ /* Internal numbers to terminate lists */
#define I2C_CLIENT_END 0xfffeU #define I2C_CLIENT_END 0xfffeU
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册