]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mfd: 88pm80x: Constify read-only regmap structs
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Thu, 4 Jul 2024 17:23:18 +0000 (19:23 +0200)
committerLee Jones <lee@kernel.org>
Fri, 30 Aug 2024 08:40:11 +0000 (09:40 +0100)
`pm800_irq`, `pm805_irq` and `pm805_irq_chip` are not modified and can
be declared as const to move their data to a read-only section.

In order to keep the const modifier for the regmap_irq_chip structures,
the pointer used to reference them must be converted to const as well.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240704-mfd-const-regmap_config-v2-8-0c8785b1331d@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/88pm800.c
drivers/mfd/88pm805.c
include/linux/mfd/88pm80x.h

index 384ecf5301d25de87fa1955bb3d2dbf4a822b252..e9941da58b18b7eabe8836a59ca30ab84a5a74a2 100644 (file)
@@ -391,7 +391,7 @@ static void device_irq_exit_800(struct pm80x_chip *chip)
        regmap_del_irq_chip(chip->irq, chip->irq_data);
 }
 
-static struct regmap_irq_chip pm800_irq_chip = {
+static const struct regmap_irq_chip pm800_irq_chip = {
        .name = "88pm800",
        .irqs = pm800_irqs,
        .num_irqs = ARRAY_SIZE(pm800_irqs),
index 205f0762a9287651348777602727e6bf1f0aa981..f5d6663172eeac80fc1ed321f07eb78e92bd5c57 100644 (file)
@@ -73,7 +73,7 @@ static const struct mfd_cell codec_devs[] = {
         },
 };
 
-static struct regmap_irq pm805_irqs[] = {
+static const struct regmap_irq pm805_irqs[] = {
        /* INT0 */
        [PM805_IRQ_LDO_OFF] = {
                .mask = PM805_INT1_HP1_SHRT,
@@ -163,7 +163,7 @@ static void device_irq_exit_805(struct pm80x_chip *chip)
        regmap_del_irq_chip(chip->irq, chip->irq_data);
 }
 
-static struct regmap_irq_chip pm805_irq_chip = {
+static const struct regmap_irq_chip pm805_irq_chip = {
        .name = "88pm805",
        .irqs = pm805_irqs,
        .num_irqs = ARRAY_SIZE(pm805_irqs),
index def5df6e74bf187aecb256ef89cfd42ca0819763..551ef1c367d65714f87f3b41fd1f1d55703c2e41 100644 (file)
@@ -294,7 +294,7 @@ struct pm80x_chip {
        struct i2c_client *client;
        struct i2c_client *companion;
        struct regmap *regmap;
-       struct regmap_irq_chip *regmap_irq_chip;
+       const struct regmap_irq_chip *regmap_irq_chip;
        struct regmap_irq_chip_data *irq_data;
        int type;
        int irq;