Commit 81ff8554 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'i2c-for-6.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c updates from Wolfram Sang:
 "This marks the end of a transition to let I2C have the same probe
  semantics as other subsystems. Uwe took care that no drivers in the
  current tree nor in -next use the deprecated .probe call. So, it is a
  good time to switch to the new, standard semantics now.

  There is also a regression fix:

   - regression fix for the notifier handling of the I2C core

   - final coversions of drivers away from deprecated .probe

   - make .probe_new the standard probe and convert I2C core to use it

* tag 'i2c-for-6.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: dev: Fix bus callback return values
  i2c: Convert drivers to new .probe() callback
  i2c: mux: Convert all drivers to new .probe() callback
  i2c: Switch .probe() to not take an id parameter
  media: i2c: ov2685: convert to i2c's .probe_new()
  media: i2c: ov5695: convert to i2c's .probe_new()
  w1: ds2482: Convert to i2c's .probe_new()
  serial: sc16is7xx: Convert to i2c's .probe_new()
  mtd: maps: pismo: Convert to i2c's .probe_new()
  misc: ad525x_dpot-i2c: Convert to i2c's .probe_new()
parents e25c54d1 9e5f81f9
...@@ -561,15 +561,8 @@ static int i2c_device_probe(struct device *dev) ...@@ -561,15 +561,8 @@ static int i2c_device_probe(struct device *dev)
goto err_detach_pm_domain; goto err_detach_pm_domain;
} }
/* if (driver->probe)
* When there are no more users of probe(), status = driver->probe(client);
* rename probe_new to probe.
*/
if (driver->probe_new)
status = driver->probe_new(client);
else if (driver->probe)
status = driver->probe(client,
i2c_match_id(driver->id_table, client));
else else
status = -EINVAL; status = -EINVAL;
...@@ -1057,7 +1050,7 @@ static int dummy_probe(struct i2c_client *client) ...@@ -1057,7 +1050,7 @@ static int dummy_probe(struct i2c_client *client)
static struct i2c_driver dummy_driver = { static struct i2c_driver dummy_driver = {
.driver.name = "dummy", .driver.name = "dummy",
.probe_new = dummy_probe, .probe = dummy_probe,
.id_table = dummy_id, .id_table = dummy_id,
}; };
......
...@@ -646,7 +646,7 @@ static void i2cdev_dev_release(struct device *dev) ...@@ -646,7 +646,7 @@ static void i2cdev_dev_release(struct device *dev)
kfree(i2c_dev); kfree(i2c_dev);
} }
static int i2cdev_attach_adapter(struct device *dev, void *dummy) static int i2cdev_attach_adapter(struct device *dev)
{ {
struct i2c_adapter *adap; struct i2c_adapter *adap;
struct i2c_dev *i2c_dev; struct i2c_dev *i2c_dev;
...@@ -685,7 +685,7 @@ static int i2cdev_attach_adapter(struct device *dev, void *dummy) ...@@ -685,7 +685,7 @@ static int i2cdev_attach_adapter(struct device *dev, void *dummy)
return NOTIFY_DONE; return NOTIFY_DONE;
} }
static int i2cdev_detach_adapter(struct device *dev, void *dummy) static int i2cdev_detach_adapter(struct device *dev)
{ {
struct i2c_adapter *adap; struct i2c_adapter *adap;
struct i2c_dev *i2c_dev; struct i2c_dev *i2c_dev;
...@@ -711,9 +711,9 @@ static int i2cdev_notifier_call(struct notifier_block *nb, unsigned long action, ...@@ -711,9 +711,9 @@ static int i2cdev_notifier_call(struct notifier_block *nb, unsigned long action,
switch (action) { switch (action) {
case BUS_NOTIFY_ADD_DEVICE: case BUS_NOTIFY_ADD_DEVICE:
return i2cdev_attach_adapter(dev, NULL); return i2cdev_attach_adapter(dev);
case BUS_NOTIFY_DEL_DEVICE: case BUS_NOTIFY_DEL_DEVICE:
return i2cdev_detach_adapter(dev, NULL); return i2cdev_detach_adapter(dev);
} }
return NOTIFY_DONE; return NOTIFY_DONE;
...@@ -725,6 +725,18 @@ static struct notifier_block i2cdev_notifier = { ...@@ -725,6 +725,18 @@ static struct notifier_block i2cdev_notifier = {
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
static int __init i2c_dev_attach_adapter(struct device *dev, void *dummy)
{
i2cdev_attach_adapter(dev);
return 0;
}
static int __exit i2c_dev_detach_adapter(struct device *dev, void *dummy)
{
i2cdev_detach_adapter(dev);
return 0;
}
/* /*
* module load/unload record keeping * module load/unload record keeping
*/ */
...@@ -752,7 +764,7 @@ static int __init i2c_dev_init(void) ...@@ -752,7 +764,7 @@ static int __init i2c_dev_init(void)
goto out_unreg_class; goto out_unreg_class;
/* Bind to already existing adapters right away */ /* Bind to already existing adapters right away */
i2c_for_each_dev(NULL, i2cdev_attach_adapter); i2c_for_each_dev(NULL, i2c_dev_attach_adapter);
return 0; return 0;
...@@ -768,7 +780,7 @@ static int __init i2c_dev_init(void) ...@@ -768,7 +780,7 @@ static int __init i2c_dev_init(void)
static void __exit i2c_dev_exit(void) static void __exit i2c_dev_exit(void)
{ {
bus_unregister_notifier(&i2c_bus_type, &i2cdev_notifier); bus_unregister_notifier(&i2c_bus_type, &i2cdev_notifier);
i2c_for_each_dev(NULL, i2cdev_detach_adapter); i2c_for_each_dev(NULL, i2c_dev_detach_adapter);
class_destroy(i2c_dev_class); class_destroy(i2c_dev_class);
unregister_chrdev_region(MKDEV(I2C_MAJOR, 0), I2C_MINORS); unregister_chrdev_region(MKDEV(I2C_MAJOR, 0), I2C_MINORS);
} }
......
...@@ -207,7 +207,7 @@ static struct i2c_driver i2c_slave_eeprom_driver = { ...@@ -207,7 +207,7 @@ static struct i2c_driver i2c_slave_eeprom_driver = {
.driver = { .driver = {
.name = "i2c-slave-eeprom", .name = "i2c-slave-eeprom",
}, },
.probe_new = i2c_slave_eeprom_probe, .probe = i2c_slave_eeprom_probe,
.remove = i2c_slave_eeprom_remove, .remove = i2c_slave_eeprom_remove,
.id_table = i2c_slave_eeprom_id, .id_table = i2c_slave_eeprom_id,
}; };
......
...@@ -171,7 +171,7 @@ static struct i2c_driver i2c_slave_testunit_driver = { ...@@ -171,7 +171,7 @@ static struct i2c_driver i2c_slave_testunit_driver = {
.driver = { .driver = {
.name = "i2c-slave-testunit", .name = "i2c-slave-testunit",
}, },
.probe_new = i2c_slave_testunit_probe, .probe = i2c_slave_testunit_probe,
.remove = i2c_slave_testunit_remove, .remove = i2c_slave_testunit_remove,
.id_table = i2c_slave_testunit_id, .id_table = i2c_slave_testunit_id,
}; };
......
...@@ -169,7 +169,7 @@ static struct i2c_driver smbalert_driver = { ...@@ -169,7 +169,7 @@ static struct i2c_driver smbalert_driver = {
.driver = { .driver = {
.name = "smbus_alert", .name = "smbus_alert",
}, },
.probe_new = smbalert_probe, .probe = smbalert_probe,
.remove = smbalert_remove, .remove = smbalert_remove,
.id_table = smbalert_ids, .id_table = smbalert_ids,
}; };
......
...@@ -306,7 +306,7 @@ static struct i2c_driver ltc4306_driver = { ...@@ -306,7 +306,7 @@ static struct i2c_driver ltc4306_driver = {
.name = "ltc4306", .name = "ltc4306",
.of_match_table = of_match_ptr(ltc4306_of_match), .of_match_table = of_match_ptr(ltc4306_of_match),
}, },
.probe_new = ltc4306_probe, .probe = ltc4306_probe,
.remove = ltc4306_remove, .remove = ltc4306_remove,
.id_table = ltc4306_id, .id_table = ltc4306_id,
}; };
......
...@@ -336,7 +336,7 @@ static struct i2c_driver pca9541_driver = { ...@@ -336,7 +336,7 @@ static struct i2c_driver pca9541_driver = {
.name = "pca9541", .name = "pca9541",
.of_match_table = of_match_ptr(pca9541_of_match), .of_match_table = of_match_ptr(pca9541_of_match),
}, },
.probe_new = pca9541_probe, .probe = pca9541_probe,
.remove = pca9541_remove, .remove = pca9541_remove,
.id_table = pca9541_id, .id_table = pca9541_id,
}; };
......
...@@ -554,7 +554,7 @@ static struct i2c_driver pca954x_driver = { ...@@ -554,7 +554,7 @@ static struct i2c_driver pca954x_driver = {
.pm = &pca954x_pm, .pm = &pca954x_pm,
.of_match_table = pca954x_of_match, .of_match_table = pca954x_of_match,
}, },
.probe_new = pca954x_probe, .probe = pca954x_probe,
.remove = pca954x_remove, .remove = pca954x_remove,
.id_table = pca954x_id, .id_table = pca954x_id,
}; };
......
...@@ -707,8 +707,7 @@ static int ov2685_configure_regulators(struct ov2685 *ov2685) ...@@ -707,8 +707,7 @@ static int ov2685_configure_regulators(struct ov2685 *ov2685)
ov2685->supplies); ov2685->supplies);
} }
static int ov2685_probe(struct i2c_client *client, static int ov2685_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct device *dev = &client->dev; struct device *dev = &client->dev;
struct ov2685 *ov2685; struct ov2685 *ov2685;
...@@ -830,7 +829,7 @@ static struct i2c_driver ov2685_i2c_driver = { ...@@ -830,7 +829,7 @@ static struct i2c_driver ov2685_i2c_driver = {
.pm = &ov2685_pm_ops, .pm = &ov2685_pm_ops,
.of_match_table = of_match_ptr(ov2685_of_match), .of_match_table = of_match_ptr(ov2685_of_match),
}, },
.probe = &ov2685_probe, .probe_new = &ov2685_probe,
.remove = &ov2685_remove, .remove = &ov2685_remove,
}; };
......
...@@ -1267,8 +1267,7 @@ static int ov5695_configure_regulators(struct ov5695 *ov5695) ...@@ -1267,8 +1267,7 @@ static int ov5695_configure_regulators(struct ov5695 *ov5695)
ov5695->supplies); ov5695->supplies);
} }
static int ov5695_probe(struct i2c_client *client, static int ov5695_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct device *dev = &client->dev; struct device *dev = &client->dev;
struct ov5695 *ov5695; struct ov5695 *ov5695;
...@@ -1393,7 +1392,7 @@ static struct i2c_driver ov5695_i2c_driver = { ...@@ -1393,7 +1392,7 @@ static struct i2c_driver ov5695_i2c_driver = {
.pm = &ov5695_pm_ops, .pm = &ov5695_pm_ops,
.of_match_table = of_match_ptr(ov5695_of_match), .of_match_table = of_match_ptr(ov5695_of_match),
}, },
.probe = &ov5695_probe, .probe_new = &ov5695_probe,
.remove = &ov5695_remove, .remove = &ov5695_remove,
}; };
......
...@@ -50,9 +50,9 @@ static const struct ad_dpot_bus_ops bops = { ...@@ -50,9 +50,9 @@ static const struct ad_dpot_bus_ops bops = {
.write_r8d16 = write_r8d16, .write_r8d16 = write_r8d16,
}; };
static int ad_dpot_i2c_probe(struct i2c_client *client, static int ad_dpot_i2c_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct ad_dpot_bus_data bdata = { struct ad_dpot_bus_data bdata = {
.client = client, .client = client,
.bops = &bops, .bops = &bops,
...@@ -106,7 +106,7 @@ static struct i2c_driver ad_dpot_i2c_driver = { ...@@ -106,7 +106,7 @@ static struct i2c_driver ad_dpot_i2c_driver = {
.driver = { .driver = {
.name = "ad_dpot", .name = "ad_dpot",
}, },
.probe = ad_dpot_i2c_probe, .probe_new = ad_dpot_i2c_probe,
.remove = ad_dpot_i2c_remove, .remove = ad_dpot_i2c_remove,
.id_table = ad_dpot_id, .id_table = ad_dpot_id,
}; };
......
...@@ -206,8 +206,7 @@ static void pismo_remove(struct i2c_client *client) ...@@ -206,8 +206,7 @@ static void pismo_remove(struct i2c_client *client)
kfree(pismo); kfree(pismo);
} }
static int pismo_probe(struct i2c_client *client, static int pismo_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct pismo_pdata *pdata = client->dev.platform_data; struct pismo_pdata *pdata = client->dev.platform_data;
struct pismo_eeprom eeprom; struct pismo_eeprom eeprom;
...@@ -260,7 +259,7 @@ static struct i2c_driver pismo_driver = { ...@@ -260,7 +259,7 @@ static struct i2c_driver pismo_driver = {
.driver = { .driver = {
.name = "pismo", .name = "pismo",
}, },
.probe = pismo_probe, .probe_new = pismo_probe,
.remove = pismo_remove, .remove = pismo_remove,
.id_table = pismo_id, .id_table = pismo_id,
}; };
......
...@@ -1666,9 +1666,9 @@ MODULE_ALIAS("spi:sc16is7xx"); ...@@ -1666,9 +1666,9 @@ MODULE_ALIAS("spi:sc16is7xx");
#endif #endif
#ifdef CONFIG_SERIAL_SC16IS7XX_I2C #ifdef CONFIG_SERIAL_SC16IS7XX_I2C
static int sc16is7xx_i2c_probe(struct i2c_client *i2c, static int sc16is7xx_i2c_probe(struct i2c_client *i2c)
const struct i2c_device_id *id)
{ {
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
const struct sc16is7xx_devtype *devtype; const struct sc16is7xx_devtype *devtype;
struct regmap *regmap; struct regmap *regmap;
...@@ -1709,7 +1709,7 @@ static struct i2c_driver sc16is7xx_i2c_uart_driver = { ...@@ -1709,7 +1709,7 @@ static struct i2c_driver sc16is7xx_i2c_uart_driver = {
.name = SC16IS7XX_NAME, .name = SC16IS7XX_NAME,
.of_match_table = sc16is7xx_dt_ids, .of_match_table = sc16is7xx_dt_ids,
}, },
.probe = sc16is7xx_i2c_probe, .probe_new = sc16is7xx_i2c_probe,
.remove = sc16is7xx_i2c_remove, .remove = sc16is7xx_i2c_remove,
.id_table = sc16is7xx_i2c_id_table, .id_table = sc16is7xx_i2c_id_table,
}; };
......
...@@ -442,8 +442,7 @@ static u8 ds2482_w1_set_pullup(void *data, int delay) ...@@ -442,8 +442,7 @@ static u8 ds2482_w1_set_pullup(void *data, int delay)
} }
static int ds2482_probe(struct i2c_client *client, static int ds2482_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct ds2482_data *data; struct ds2482_data *data;
int err = -ENODEV; int err = -ENODEV;
...@@ -553,7 +552,7 @@ static struct i2c_driver ds2482_driver = { ...@@ -553,7 +552,7 @@ static struct i2c_driver ds2482_driver = {
.driver = { .driver = {
.name = "ds2482", .name = "ds2482",
}, },
.probe = ds2482_probe, .probe_new = ds2482_probe,
.remove = ds2482_remove, .remove = ds2482_remove,
.id_table = ds2482_id, .id_table = ds2482_id,
}; };
......
...@@ -236,8 +236,8 @@ enum i2c_driver_flags { ...@@ -236,8 +236,8 @@ enum i2c_driver_flags {
/** /**
* struct i2c_driver - represent an I2C device driver * struct i2c_driver - represent an I2C device driver
* @class: What kind of i2c device we instantiate (for detect) * @class: What kind of i2c device we instantiate (for detect)
* @probe: Callback for device binding - soon to be deprecated * @probe: Callback for device binding
* @probe_new: New callback for device binding * @probe_new: Transitional callback for device binding - do not use
* @remove: Callback for device unbinding * @remove: Callback for device unbinding
* @shutdown: Callback for device shutdown * @shutdown: Callback for device shutdown
* @alert: Alert callback, for example for the SMBus alert protocol * @alert: Alert callback, for example for the SMBus alert protocol
...@@ -272,14 +272,18 @@ enum i2c_driver_flags { ...@@ -272,14 +272,18 @@ enum i2c_driver_flags {
struct i2c_driver { struct i2c_driver {
unsigned int class; unsigned int class;
union {
/* Standard driver model interfaces */ /* Standard driver model interfaces */
int (*probe)(struct i2c_client *client, const struct i2c_device_id *id); int (*probe)(struct i2c_client *client);
/*
* Legacy callback that was part of a conversion of .probe().
* Today it has the same semantic as .probe(). Don't use for new
* code.
*/
int (*probe_new)(struct i2c_client *client);
};
void (*remove)(struct i2c_client *client); void (*remove)(struct i2c_client *client);
/* New driver model interface to aid the seamless removal of the
* current probe()'s, more commonly unused than used second parameter.
*/
int (*probe_new)(struct i2c_client *client);
/* driver model interfaces that don't relate to enumeration */ /* driver model interfaces that don't relate to enumeration */
void (*shutdown)(struct i2c_client *client); void (*shutdown)(struct i2c_client *client);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment