* [PATCH] power: supply: bq2515x: Constify static variables
@ 2020-08-24 23:22 Rikard Falkeborn
2020-08-25 16:05 ` Sebastian Reichel
0 siblings, 1 reply; 2+ messages in thread
From: Rikard Falkeborn @ 2020-08-24 23:22 UTC (permalink / raw)
To: Sebastian Reichel
Cc: linux-pm, linux-kernel, Ricardo Rivera-Matos, Rikard Falkeborn
Constify a number of static variables that are not modified to allow the
compiler to put them in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/power/supply/bq2515x_charger.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/power/supply/bq2515x_charger.c b/drivers/power/supply/bq2515x_charger.c
index 36b0c8c98d40..9dcb61ea4cf2 100644
--- a/drivers/power/supply/bq2515x_charger.c
+++ b/drivers/power/supply/bq2515x_charger.c
@@ -188,7 +188,7 @@ struct bq2515x_device {
struct bq2515x_init_data init_data;
};
-static struct reg_default bq25150_reg_defaults[] = {
+static const struct reg_default bq25150_reg_defaults[] = {
{BQ2515X_FLAG0, 0x0},
{BQ2515X_FLAG1, 0x0},
{BQ2515X_FLAG2, 0x0},
@@ -227,7 +227,7 @@ static struct reg_default bq25150_reg_defaults[] = {
{BQ2515X_DEVICE_ID, 0x20},
};
-static struct reg_default bq25155_reg_defaults[] = {
+static const struct reg_default bq25155_reg_defaults[] = {
{BQ2515X_FLAG0, 0x0},
{BQ2515X_FLAG1, 0x0},
{BQ2515X_FLAG2, 0x0},
@@ -886,14 +886,14 @@ static int bq2515x_battery_get_property(struct power_supply *psy,
return 0;
}
-static enum power_supply_property bq2515x_battery_properties[] = {
+static const enum power_supply_property bq2515x_battery_properties[] = {
POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_CURRENT_NOW,
POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
};
-static enum power_supply_property bq2515x_mains_properties[] = {
+static const enum power_supply_property bq2515x_mains_properties[] = {
POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_HEALTH,
@@ -905,7 +905,7 @@ static enum power_supply_property bq2515x_mains_properties[] = {
POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
};
-static struct power_supply_desc bq2515x_mains_desc = {
+static const struct power_supply_desc bq2515x_mains_desc = {
.name = "bq2515x-mains",
.type = POWER_SUPPLY_TYPE_MAINS,
.get_property = bq2515x_mains_get_property,
@@ -915,7 +915,7 @@ static struct power_supply_desc bq2515x_mains_desc = {
.property_is_writeable = bq2515x_power_supply_property_is_writeable,
};
-static struct power_supply_desc bq2515x_battery_desc = {
+static const struct power_supply_desc bq2515x_battery_desc = {
.name = "bq2515x-battery",
.type = POWER_SUPPLY_TYPE_BATTERY,
.get_property = bq2515x_battery_get_property,
--
2.28.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] power: supply: bq2515x: Constify static variables
2020-08-24 23:22 [PATCH] power: supply: bq2515x: Constify static variables Rikard Falkeborn
@ 2020-08-25 16:05 ` Sebastian Reichel
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2020-08-25 16:05 UTC (permalink / raw)
To: Rikard Falkeborn; +Cc: linux-pm, linux-kernel, Ricardo Rivera-Matos
[-- Attachment #1: Type: text/plain, Size: 2800 bytes --]
Hi,
On Tue, Aug 25, 2020 at 01:22:28AM +0200, Rikard Falkeborn wrote:
> Constify a number of static variables that are not modified to allow the
> compiler to put them in read-only memory.
>
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
> ---
Thanks, queued.
-- Sebastian
> drivers/power/supply/bq2515x_charger.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/power/supply/bq2515x_charger.c b/drivers/power/supply/bq2515x_charger.c
> index 36b0c8c98d40..9dcb61ea4cf2 100644
> --- a/drivers/power/supply/bq2515x_charger.c
> +++ b/drivers/power/supply/bq2515x_charger.c
> @@ -188,7 +188,7 @@ struct bq2515x_device {
> struct bq2515x_init_data init_data;
> };
>
> -static struct reg_default bq25150_reg_defaults[] = {
> +static const struct reg_default bq25150_reg_defaults[] = {
> {BQ2515X_FLAG0, 0x0},
> {BQ2515X_FLAG1, 0x0},
> {BQ2515X_FLAG2, 0x0},
> @@ -227,7 +227,7 @@ static struct reg_default bq25150_reg_defaults[] = {
> {BQ2515X_DEVICE_ID, 0x20},
> };
>
> -static struct reg_default bq25155_reg_defaults[] = {
> +static const struct reg_default bq25155_reg_defaults[] = {
> {BQ2515X_FLAG0, 0x0},
> {BQ2515X_FLAG1, 0x0},
> {BQ2515X_FLAG2, 0x0},
> @@ -886,14 +886,14 @@ static int bq2515x_battery_get_property(struct power_supply *psy,
> return 0;
> }
>
> -static enum power_supply_property bq2515x_battery_properties[] = {
> +static const enum power_supply_property bq2515x_battery_properties[] = {
> POWER_SUPPLY_PROP_VOLTAGE_NOW,
> POWER_SUPPLY_PROP_CURRENT_NOW,
> POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
> POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
> };
>
> -static enum power_supply_property bq2515x_mains_properties[] = {
> +static const enum power_supply_property bq2515x_mains_properties[] = {
> POWER_SUPPLY_PROP_ONLINE,
> POWER_SUPPLY_PROP_STATUS,
> POWER_SUPPLY_PROP_HEALTH,
> @@ -905,7 +905,7 @@ static enum power_supply_property bq2515x_mains_properties[] = {
> POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
> };
>
> -static struct power_supply_desc bq2515x_mains_desc = {
> +static const struct power_supply_desc bq2515x_mains_desc = {
> .name = "bq2515x-mains",
> .type = POWER_SUPPLY_TYPE_MAINS,
> .get_property = bq2515x_mains_get_property,
> @@ -915,7 +915,7 @@ static struct power_supply_desc bq2515x_mains_desc = {
> .property_is_writeable = bq2515x_power_supply_property_is_writeable,
> };
>
> -static struct power_supply_desc bq2515x_battery_desc = {
> +static const struct power_supply_desc bq2515x_battery_desc = {
> .name = "bq2515x-battery",
> .type = POWER_SUPPLY_TYPE_BATTERY,
> .get_property = bq2515x_battery_get_property,
> --
> 2.28.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-25 16:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-24 23:22 [PATCH] power: supply: bq2515x: Constify static variables Rikard Falkeborn
2020-08-25 16:05 ` Sebastian Reichel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).