Commit 5923fc75 authored by Biju Das's avatar Biju Das Committed by Alexandre Belloni
Browse files

rtc: isl1208: Drop enum isl1208_id and split isl1208_configs[]



Drop enum isl1208_id and split the array isl1208_configs[] as individual
variables, and make lines shorter by referring to e.g. &config_isl1219
instead of &isl1208_configs[TYPE_ISL1219].

Signed-off-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20230623140948.384762-9-biju.das.jz@bp.renesas.com


Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent fbc06a53
Loading
Loading
Loading
Loading
+33 −23
Original line number Original line Diff line number Diff line
@@ -68,41 +68,51 @@


static struct i2c_driver isl1208_driver;
static struct i2c_driver isl1208_driver;


/* ISL1208 various variants */
enum isl1208_id {
	TYPE_ISL1208 = 0,
	TYPE_ISL1209,
	TYPE_ISL1218,
	TYPE_ISL1219,
	ISL_LAST_ID
};

/* Chip capabilities table */
/* Chip capabilities table */
static const struct isl1208_config {
struct isl1208_config {
	unsigned int	nvmem_length;
	unsigned int	nvmem_length;
	unsigned	has_tamper:1;
	unsigned	has_tamper:1;
	unsigned	has_timestamp:1;
	unsigned	has_timestamp:1;
} isl1208_configs[] = {
};
	[TYPE_ISL1208] = { 2, false, false },

	[TYPE_ISL1209] = { 2, true,  false },
static const struct isl1208_config config_isl1208 = {
	[TYPE_ISL1218] = { 8, false, false },
	.nvmem_length = 2,
	[TYPE_ISL1219] = { 2, true,  true },
	.has_tamper = false,
	.has_timestamp = false
};

static const struct isl1208_config config_isl1209 = {
	.nvmem_length = 2,
	.has_tamper = true,
	.has_timestamp = false
};

static const struct isl1208_config config_isl1218 = {
	.nvmem_length = 8,
	.has_tamper = false,
	.has_timestamp = false
};

static const struct isl1208_config config_isl1219 = {
	.nvmem_length = 2,
	.has_tamper = true,
	.has_timestamp = true
};
};


static const struct i2c_device_id isl1208_id[] = {
static const struct i2c_device_id isl1208_id[] = {
	{ "isl1208", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1208] },
	{ "isl1208", .driver_data = (kernel_ulong_t)&config_isl1208 },
	{ "isl1209", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1209] },
	{ "isl1209", .driver_data = (kernel_ulong_t)&config_isl1209 },
	{ "isl1218", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1218] },
	{ "isl1218", .driver_data = (kernel_ulong_t)&config_isl1218 },
	{ "isl1219", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1219] },
	{ "isl1219", .driver_data = (kernel_ulong_t)&config_isl1219 },
	{ }
	{ }
};
};
MODULE_DEVICE_TABLE(i2c, isl1208_id);
MODULE_DEVICE_TABLE(i2c, isl1208_id);


static const __maybe_unused struct of_device_id isl1208_of_match[] = {
static const __maybe_unused struct of_device_id isl1208_of_match[] = {
	{ .compatible = "isil,isl1208", .data = &isl1208_configs[TYPE_ISL1208] },
	{ .compatible = "isil,isl1208", .data = &config_isl1208 },
	{ .compatible = "isil,isl1209", .data = &isl1208_configs[TYPE_ISL1209] },
	{ .compatible = "isil,isl1209", .data = &config_isl1209 },
	{ .compatible = "isil,isl1218", .data = &isl1208_configs[TYPE_ISL1218] },
	{ .compatible = "isil,isl1218", .data = &config_isl1218 },
	{ .compatible = "isil,isl1219", .data = &isl1208_configs[TYPE_ISL1219] },
	{ .compatible = "isil,isl1219", .data = &config_isl1219 },
	{ }
	{ }
};
};
MODULE_DEVICE_TABLE(of, isl1208_of_match);
MODULE_DEVICE_TABLE(of, isl1208_of_match);