Skip to content

Commit 5923fc7

Browse files
bijudasalexandrebelloni
authored andcommitted
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: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20230623140948.384762-9-biju.das.jz@bp.renesas.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent fbc06a5 commit 5923fc7

1 file changed

Lines changed: 33 additions & 23 deletions

File tree

drivers/rtc/rtc-isl1208.c

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -68,41 +68,51 @@
6868

6969
static struct i2c_driver isl1208_driver;
7070

71-
/* ISL1208 various variants */
72-
enum isl1208_id {
73-
TYPE_ISL1208 = 0,
74-
TYPE_ISL1209,
75-
TYPE_ISL1218,
76-
TYPE_ISL1219,
77-
ISL_LAST_ID
78-
};
79-
8071
/* Chip capabilities table */
81-
static const struct isl1208_config {
72+
struct isl1208_config {
8273
unsigned int nvmem_length;
8374
unsigned has_tamper:1;
8475
unsigned has_timestamp:1;
85-
} isl1208_configs[] = {
86-
[TYPE_ISL1208] = { 2, false, false },
87-
[TYPE_ISL1209] = { 2, true, false },
88-
[TYPE_ISL1218] = { 8, false, false },
89-
[TYPE_ISL1219] = { 2, true, true },
76+
};
77+
78+
static const struct isl1208_config config_isl1208 = {
79+
.nvmem_length = 2,
80+
.has_tamper = false,
81+
.has_timestamp = false
82+
};
83+
84+
static const struct isl1208_config config_isl1209 = {
85+
.nvmem_length = 2,
86+
.has_tamper = true,
87+
.has_timestamp = false
88+
};
89+
90+
static const struct isl1208_config config_isl1218 = {
91+
.nvmem_length = 8,
92+
.has_tamper = false,
93+
.has_timestamp = false
94+
};
95+
96+
static const struct isl1208_config config_isl1219 = {
97+
.nvmem_length = 2,
98+
.has_tamper = true,
99+
.has_timestamp = true
90100
};
91101

92102
static const struct i2c_device_id isl1208_id[] = {
93-
{ "isl1208", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1208] },
94-
{ "isl1209", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1209] },
95-
{ "isl1218", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1218] },
96-
{ "isl1219", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1219] },
103+
{ "isl1208", .driver_data = (kernel_ulong_t)&config_isl1208 },
104+
{ "isl1209", .driver_data = (kernel_ulong_t)&config_isl1209 },
105+
{ "isl1218", .driver_data = (kernel_ulong_t)&config_isl1218 },
106+
{ "isl1219", .driver_data = (kernel_ulong_t)&config_isl1219 },
97107
{ }
98108
};
99109
MODULE_DEVICE_TABLE(i2c, isl1208_id);
100110

101111
static const __maybe_unused struct of_device_id isl1208_of_match[] = {
102-
{ .compatible = "isil,isl1208", .data = &isl1208_configs[TYPE_ISL1208] },
103-
{ .compatible = "isil,isl1209", .data = &isl1208_configs[TYPE_ISL1209] },
104-
{ .compatible = "isil,isl1218", .data = &isl1208_configs[TYPE_ISL1218] },
105-
{ .compatible = "isil,isl1219", .data = &isl1208_configs[TYPE_ISL1219] },
112+
{ .compatible = "isil,isl1208", .data = &config_isl1208 },
113+
{ .compatible = "isil,isl1209", .data = &config_isl1209 },
114+
{ .compatible = "isil,isl1218", .data = &config_isl1218 },
115+
{ .compatible = "isil,isl1219", .data = &config_isl1219 },
106116
{ }
107117
};
108118
MODULE_DEVICE_TABLE(of, isl1208_of_match);

0 commit comments

Comments
 (0)