Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2653e92 authored by Jean Delvare's avatar Jean Delvare Committed by Jean Delvare
Browse files

i2c: Add support for device alias names



Based on earlier work by Jon Smirl and Jochen Friedrich.

This patch allows new-style i2c chip drivers to have alias names using
the official kernel aliasing system and MODULE_DEVICE_TABLE(). At this
point, the old i2c driver binding scheme (driver_name/type) is still
supported.

Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Cc: Jochen Friedrich <jochen@scram.de>
Cc: Jon Smirl <jonsmirl@gmail.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
parent ee56d977
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -164,7 +164,8 @@ I2C device drivers using this binding model work just like any other
kind of driver in Linux:  they provide a probe() method to bind to
those devices, and a remove() method to unbind.

	static int foo_probe(struct i2c_client *client);
	static int foo_probe(struct i2c_client *client,
			     const struct i2c_device_id *id);
	static int foo_remove(struct i2c_client *client);

Remember that the i2c_driver does not create those client handles.  The
+2 −1
Original line number Diff line number Diff line
@@ -192,7 +192,8 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios)
	gc->owner = THIS_MODULE;
}

static int __devinit pca953x_probe(struct i2c_client *client)
static int __devinit pca953x_probe(struct i2c_client *client,
				   const struct i2c_device_id *did)
{
	struct pca953x_platform_data *pdata;
	struct pca953x_chip *chip;
+2 −1
Original line number Diff line number Diff line
@@ -142,7 +142,8 @@ static void pcf857x_set16(struct gpio_chip *chip, unsigned offset, int value)

/*-------------------------------------------------------------------------*/

static int pcf857x_probe(struct i2c_client *client)
static int pcf857x_probe(struct i2c_client *client,
			 const struct i2c_device_id *id)
{
	struct pcf857x_platform_data	*pdata;
	struct pcf857x			*gpio;
+5 −3
Original line number Diff line number Diff line
@@ -117,7 +117,8 @@ struct f75375_data {
static int f75375_attach_adapter(struct i2c_adapter *adapter);
static int f75375_detect(struct i2c_adapter *adapter, int address, int kind);
static int f75375_detach_client(struct i2c_client *client);
static int f75375_probe(struct i2c_client *client);
static int f75375_probe(struct i2c_client *client,
			const struct i2c_device_id *id);
static int f75375_remove(struct i2c_client *client);

static struct i2c_driver f75375_legacy_driver = {
@@ -628,7 +629,8 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data,

}

static int f75375_probe(struct i2c_client *client)
static int f75375_probe(struct i2c_client *client,
		const struct i2c_device_id *id)
{
	struct f75375_data *data = i2c_get_clientdata(client);
	struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data;
@@ -748,7 +750,7 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind)
	if ((err = i2c_attach_client(client)))
		goto exit_free;

	if ((err = f75375_probe(client)) < 0)
	if ((err = f75375_probe(client, NULL)) < 0)
		goto exit_detach;

	return 0;
+2 −1
Original line number Diff line number Diff line
@@ -200,7 +200,8 @@ static struct bin_attribute ds1682_eeprom_attr = {
/*
 * Called when a ds1682 device is matched with this driver
 */
static int ds1682_probe(struct i2c_client *client)
static int ds1682_probe(struct i2c_client *client,
			const struct i2c_device_id *id)
{
	int rc;

Loading