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

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

i2c: Convert remaining new-style drivers to use module aliasing



Update all the remaining new-style i2c drivers to use standard module
aliasing instead of the old driver_name/type driver matching scheme.

Note that the tuner driver is a bit quirky at the moment, as it
overwrites i2c_client.name with arbitrary strings. We write "tuner"
back on remove, to make sure that driver cycling will work properly,
but there may still be troublesome corner cases.

Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 238a871e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -160,10 +160,17 @@ static int cs5345_probe(struct i2c_client *client,

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

static const struct i2c_device_id cs5345_id[] = {
	{ "cs5345", 0 },
	{ }
};
MODULE_DEVICE_TABLE(i2c, cs5345_id);

static struct v4l2_i2c_driver_data v4l2_i2c_data = {
	.name = "cs5345",
	.driverid = I2C_DRIVERID_CS5345,
	.command = cs5345_command,
	.probe = cs5345_probe,
	.id_table = cs5345_id,
};
+9 −1
Original line number Diff line number Diff line
@@ -144,7 +144,8 @@ static int cs53l32a_probe(struct i2c_client *client,
	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
		return -EIO;

	snprintf(client->name, sizeof(client->name) - 1, "cs53l32a");
	if (!id)
		strlcpy(client->name, "cs53l32a", sizeof(client->name));

	v4l_info(client, "chip found @ 0x%x (%s)\n",
			client->addr << 1, client->adapter->name);
@@ -175,10 +176,17 @@ static int cs53l32a_probe(struct i2c_client *client,
	return 0;
}

static const struct i2c_device_id cs53l32a_id[] = {
	{ "cs53l32a", 0 },
	{ }
};
MODULE_DEVICE_TABLE(i2c, cs53l32a_id);

static struct v4l2_i2c_driver_data v4l2_i2c_data = {
	.name = "cs53l32a",
	.driverid = I2C_DRIVERID_CS53L32A,
	.command = cs53l32a_command,
	.probe = cs53l32a_probe,
	.id_table = cs53l32a_id,
};
+4 −5
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ static const u8 hw_bus[] = {
};

/* This array should match the CX18_HW_ defines */
static const char * const hw_drivernames[] = {
static const char * const hw_devicenames[] = {
	"tuner",
	"tveeprom",
	"cs5345",
@@ -95,8 +95,7 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx)
	id = hw_driverids[idx];
	bus = hw_bus[idx];
	memset(&info, 0, sizeof(info));
	strlcpy(info.driver_name, hw_drivernames[idx],
			sizeof(info.driver_name));
	strlcpy(info.type, hw_devicenames[idx], sizeof(info.type));
	info.addr = hw_addrs[idx];
	for (i = 0; i < I2C_CLIENTS_MAX; i++)
		if (cx->i2c_clients[i] == NULL)
@@ -279,7 +278,7 @@ static const char *cx18_i2c_id_name(u32 id)

	for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
		if (hw_driverids[i] == id)
			return hw_drivernames[i];
			return hw_devicenames[i];
	return "unknown device";
}

@@ -290,7 +289,7 @@ static const char *cx18_i2c_hw_name(u32 hw)

	for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
		if (1 << i == hw)
			return hw_drivernames[i];
			return hw_devicenames[i];
	return "unknown device";
}

+7 −0
Original line number Diff line number Diff line
@@ -1284,10 +1284,17 @@ static int cx25840_remove(struct i2c_client *client)
	return 0;
}

static const struct i2c_device_id cx25840_id[] = {
	{ "cx25840", 0 },
	{ }
};
MODULE_DEVICE_TABLE(i2c, cx25840_id);

static struct v4l2_i2c_driver_data v4l2_i2c_data = {
	.name = "cx25840",
	.driverid = I2C_DRIVERID_CX25840,
	.command = cx25840_command,
	.probe = cx25840_probe,
	.remove = cx25840_remove,
	.id_table = cx25840_id,
};
+6 −7
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ static const u8 hw_addrs[] = {
};

/* This array should match the IVTV_HW_ defines */
static const char * const hw_drivernames[] = {
static const char * const hw_devicenames[] = {
	"cx25840",
	"saa7115",
	"saa7127",
@@ -145,7 +145,7 @@ static const char * const hw_drivernames[] = {
	"wm8775",
	"cs53l32a",
	"tveeprom",
	"saa7115",
	"saa7114",
	"upd64031a",
	"upd64083",
	"saa717x",
@@ -167,8 +167,7 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
		return -1;
	id = hw_driverids[idx];
	memset(&info, 0, sizeof(info));
	strlcpy(info.driver_name, hw_drivernames[idx],
			sizeof(info.driver_name));
	strlcpy(info.type, hw_devicenames[idx], sizeof(info.type));
	info.addr = hw_addrs[idx];
	for (i = 0; itv->i2c_clients[i] && i < I2C_CLIENTS_MAX; i++) {}

@@ -657,7 +656,7 @@ static const char *ivtv_i2c_id_name(u32 id)

	for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
		if (hw_driverids[i] == id)
			return hw_drivernames[i];
			return hw_devicenames[i];
	return "unknown device";
}

@@ -668,7 +667,7 @@ static const char *ivtv_i2c_hw_name(u32 hw)

	for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
		if (1 << i == hw)
			return hw_drivernames[i];
			return hw_devicenames[i];
	return "unknown device";
}

@@ -770,7 +769,7 @@ int init_ivtv_i2c(struct ivtv *itv)
	 * same size and GPIO must be the last entry.
	 */
	if (ARRAY_SIZE(hw_driverids) != ARRAY_SIZE(hw_addrs) ||
	    ARRAY_SIZE(hw_drivernames) != ARRAY_SIZE(hw_addrs) ||
	    ARRAY_SIZE(hw_devicenames) != ARRAY_SIZE(hw_addrs) ||
	    IVTV_HW_GPIO != (1 << (ARRAY_SIZE(hw_addrs) - 1)) ||
	    hw_driverids[ARRAY_SIZE(hw_addrs) - 1]) {
		IVTV_ERR("Mismatched I2C hardware arrays\n");
Loading