Skip to content

Commit 5789837

Browse files
bijudasalexandrebelloni
authored andcommitted
rtc: pcf85063: Drop enum pcf85063_type and split pcf85063_cfg[]
Drop enum pcf85063_type and split the array pcf85063_cfg[] as individual variables, and make lines shorter by referring to e.g. &pcf85063_cfg instead of &pcf85063_cfg[PCF85063]. Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230717124059.196244-3-biju.das.jz@bp.renesas.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 68c624f commit 5789837

1 file changed

Lines changed: 38 additions & 45 deletions

File tree

drivers/rtc/rtc-pcf85063.c

Lines changed: 38 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -514,46 +514,39 @@ static struct clk *pcf85063_clkout_register_clk(struct pcf85063 *pcf85063)
514514
}
515515
#endif
516516

517-
enum pcf85063_type {
518-
PCF85063,
519-
PCF85063TP,
520-
PCF85063A,
521-
RV8263,
522-
PCF85063_LAST_ID
517+
static const struct pcf85063_config config_pcf85063 = {
518+
.regmap = {
519+
.reg_bits = 8,
520+
.val_bits = 8,
521+
.max_register = 0x0a,
522+
},
523523
};
524524

525-
static struct pcf85063_config pcf85063_cfg[] = {
526-
[PCF85063] = {
527-
.regmap = {
528-
.reg_bits = 8,
529-
.val_bits = 8,
530-
.max_register = 0x0a,
531-
},
532-
},
533-
[PCF85063TP] = {
534-
.regmap = {
535-
.reg_bits = 8,
536-
.val_bits = 8,
537-
.max_register = 0x0a,
538-
},
525+
static const struct pcf85063_config config_pcf85063tp = {
526+
.regmap = {
527+
.reg_bits = 8,
528+
.val_bits = 8,
529+
.max_register = 0x0a,
539530
},
540-
[PCF85063A] = {
541-
.regmap = {
542-
.reg_bits = 8,
543-
.val_bits = 8,
544-
.max_register = 0x11,
545-
},
546-
.has_alarms = 1,
531+
};
532+
533+
static const struct pcf85063_config config_pcf85063a = {
534+
.regmap = {
535+
.reg_bits = 8,
536+
.val_bits = 8,
537+
.max_register = 0x11,
547538
},
548-
[RV8263] = {
549-
.regmap = {
550-
.reg_bits = 8,
551-
.val_bits = 8,
552-
.max_register = 0x11,
553-
},
554-
.has_alarms = 1,
555-
.force_cap_7000 = 1,
539+
.has_alarms = 1,
540+
};
541+
542+
static const struct pcf85063_config config_rv8263 = {
543+
.regmap = {
544+
.reg_bits = 8,
545+
.val_bits = 8,
546+
.max_register = 0x11,
556547
},
548+
.has_alarms = 1,
549+
.force_cap_7000 = 1,
557550
};
558551

559552
static int pcf85063_probe(struct i2c_client *client)
@@ -645,22 +638,22 @@ static int pcf85063_probe(struct i2c_client *client)
645638
}
646639

647640
static const struct i2c_device_id pcf85063_ids[] = {
648-
{ "pca85073a", .driver_data = (kernel_ulong_t)&pcf85063_cfg[PCF85063A] },
649-
{ "pcf85063", .driver_data = (kernel_ulong_t)&pcf85063_cfg[PCF85063] },
650-
{ "pcf85063tp", .driver_data = (kernel_ulong_t)&pcf85063_cfg[PCF85063TP] },
651-
{ "pcf85063a", .driver_data = (kernel_ulong_t)&pcf85063_cfg[PCF85063A] },
652-
{ "rv8263", .driver_data = (kernel_ulong_t)&pcf85063_cfg[RV8263] },
641+
{ "pca85073a", .driver_data = (kernel_ulong_t)&config_pcf85063a },
642+
{ "pcf85063", .driver_data = (kernel_ulong_t)&config_pcf85063 },
643+
{ "pcf85063tp", .driver_data = (kernel_ulong_t)&config_pcf85063tp },
644+
{ "pcf85063a", .driver_data = (kernel_ulong_t)&config_pcf85063a },
645+
{ "rv8263", .driver_data = (kernel_ulong_t)&config_rv8263 },
653646
{}
654647
};
655648
MODULE_DEVICE_TABLE(i2c, pcf85063_ids);
656649

657650
#ifdef CONFIG_OF
658651
static const struct of_device_id pcf85063_of_match[] = {
659-
{ .compatible = "nxp,pca85073a", .data = &pcf85063_cfg[PCF85063A] },
660-
{ .compatible = "nxp,pcf85063", .data = &pcf85063_cfg[PCF85063] },
661-
{ .compatible = "nxp,pcf85063tp", .data = &pcf85063_cfg[PCF85063TP] },
662-
{ .compatible = "nxp,pcf85063a", .data = &pcf85063_cfg[PCF85063A] },
663-
{ .compatible = "microcrystal,rv8263", .data = &pcf85063_cfg[RV8263] },
652+
{ .compatible = "nxp,pca85073a", .data = &config_pcf85063a },
653+
{ .compatible = "nxp,pcf85063", .data = &config_pcf85063 },
654+
{ .compatible = "nxp,pcf85063tp", .data = &config_pcf85063tp },
655+
{ .compatible = "nxp,pcf85063a", .data = &config_pcf85063a },
656+
{ .compatible = "microcrystal,rv8263", .data = &config_rv8263 },
664657
{}
665658
};
666659
MODULE_DEVICE_TABLE(of, pcf85063_of_match);

0 commit comments

Comments
 (0)