Commit dfa9e708 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Mark Brown

regulator: da9055: Constify static data

Driver does not modify static data with regulators description (struct
da9055_regulator_info), so make it const for code safety.
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240909-regulator-const-v1-2-8934704a5787@linaro.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9653007e
...@@ -73,7 +73,7 @@ struct da9055_regulator_info { ...@@ -73,7 +73,7 @@ struct da9055_regulator_info {
struct da9055_regulator { struct da9055_regulator {
struct da9055 *da9055; struct da9055 *da9055;
struct da9055_regulator_info *info; const struct da9055_regulator_info *info;
struct regulator_dev *rdev; struct regulator_dev *rdev;
enum gpio_select reg_rselect; enum gpio_select reg_rselect;
}; };
...@@ -81,7 +81,7 @@ struct da9055_regulator { ...@@ -81,7 +81,7 @@ struct da9055_regulator {
static unsigned int da9055_buck_get_mode(struct regulator_dev *rdev) static unsigned int da9055_buck_get_mode(struct regulator_dev *rdev)
{ {
struct da9055_regulator *regulator = rdev_get_drvdata(rdev); struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
struct da9055_regulator_info *info = regulator->info; const struct da9055_regulator_info *info = regulator->info;
int ret, mode = 0; int ret, mode = 0;
ret = da9055_reg_read(regulator->da9055, info->mode.reg); ret = da9055_reg_read(regulator->da9055, info->mode.reg);
...@@ -107,7 +107,7 @@ static int da9055_buck_set_mode(struct regulator_dev *rdev, ...@@ -107,7 +107,7 @@ static int da9055_buck_set_mode(struct regulator_dev *rdev,
unsigned int mode) unsigned int mode)
{ {
struct da9055_regulator *regulator = rdev_get_drvdata(rdev); struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
struct da9055_regulator_info *info = regulator->info; const struct da9055_regulator_info *info = regulator->info;
int val = 0; int val = 0;
switch (mode) { switch (mode) {
...@@ -129,7 +129,7 @@ static int da9055_buck_set_mode(struct regulator_dev *rdev, ...@@ -129,7 +129,7 @@ static int da9055_buck_set_mode(struct regulator_dev *rdev,
static unsigned int da9055_ldo_get_mode(struct regulator_dev *rdev) static unsigned int da9055_ldo_get_mode(struct regulator_dev *rdev)
{ {
struct da9055_regulator *regulator = rdev_get_drvdata(rdev); struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
struct da9055_regulator_info *info = regulator->info; const struct da9055_regulator_info *info = regulator->info;
int ret; int ret;
ret = da9055_reg_read(regulator->da9055, info->volt.reg_b); ret = da9055_reg_read(regulator->da9055, info->volt.reg_b);
...@@ -145,7 +145,7 @@ static unsigned int da9055_ldo_get_mode(struct regulator_dev *rdev) ...@@ -145,7 +145,7 @@ static unsigned int da9055_ldo_get_mode(struct regulator_dev *rdev)
static int da9055_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode) static int da9055_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode)
{ {
struct da9055_regulator *regulator = rdev_get_drvdata(rdev); struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
struct da9055_regulator_info *info = regulator->info; const struct da9055_regulator_info *info = regulator->info;
struct da9055_volt_reg volt = info->volt; struct da9055_volt_reg volt = info->volt;
int val = 0; int val = 0;
...@@ -167,7 +167,7 @@ static int da9055_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode) ...@@ -167,7 +167,7 @@ static int da9055_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode)
static int da9055_regulator_get_voltage_sel(struct regulator_dev *rdev) static int da9055_regulator_get_voltage_sel(struct regulator_dev *rdev)
{ {
struct da9055_regulator *regulator = rdev_get_drvdata(rdev); struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
struct da9055_regulator_info *info = regulator->info; const struct da9055_regulator_info *info = regulator->info;
struct da9055_volt_reg volt = info->volt; struct da9055_volt_reg volt = info->volt;
int ret, sel; int ret, sel;
...@@ -199,7 +199,7 @@ static int da9055_regulator_set_voltage_sel(struct regulator_dev *rdev, ...@@ -199,7 +199,7 @@ static int da9055_regulator_set_voltage_sel(struct regulator_dev *rdev,
unsigned int selector) unsigned int selector)
{ {
struct da9055_regulator *regulator = rdev_get_drvdata(rdev); struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
struct da9055_regulator_info *info = regulator->info; const struct da9055_regulator_info *info = regulator->info;
int ret; int ret;
/* /*
...@@ -242,7 +242,7 @@ static int da9055_regulator_set_suspend_voltage(struct regulator_dev *rdev, ...@@ -242,7 +242,7 @@ static int da9055_regulator_set_suspend_voltage(struct regulator_dev *rdev,
int uV) int uV)
{ {
struct da9055_regulator *regulator = rdev_get_drvdata(rdev); struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
struct da9055_regulator_info *info = regulator->info; const struct da9055_regulator_info *info = regulator->info;
int ret; int ret;
/* Select register set B for suspend voltage ramping. */ /* Select register set B for suspend voltage ramping. */
...@@ -264,7 +264,7 @@ static int da9055_regulator_set_suspend_voltage(struct regulator_dev *rdev, ...@@ -264,7 +264,7 @@ static int da9055_regulator_set_suspend_voltage(struct regulator_dev *rdev,
static int da9055_suspend_enable(struct regulator_dev *rdev) static int da9055_suspend_enable(struct regulator_dev *rdev)
{ {
struct da9055_regulator *regulator = rdev_get_drvdata(rdev); struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
struct da9055_regulator_info *info = regulator->info; const struct da9055_regulator_info *info = regulator->info;
/* Select register set B for voltage ramping. */ /* Select register set B for voltage ramping. */
if (regulator->reg_rselect == NO_GPIO) if (regulator->reg_rselect == NO_GPIO)
...@@ -277,7 +277,7 @@ static int da9055_suspend_enable(struct regulator_dev *rdev) ...@@ -277,7 +277,7 @@ static int da9055_suspend_enable(struct regulator_dev *rdev)
static int da9055_suspend_disable(struct regulator_dev *rdev) static int da9055_suspend_disable(struct regulator_dev *rdev)
{ {
struct da9055_regulator *regulator = rdev_get_drvdata(rdev); struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
struct da9055_regulator_info *info = regulator->info; const struct da9055_regulator_info *info = regulator->info;
/* Diselect register set B. */ /* Diselect register set B. */
if (regulator->reg_rselect == NO_GPIO) if (regulator->reg_rselect == NO_GPIO)
...@@ -396,7 +396,7 @@ static const struct regulator_ops da9055_ldo_ops = { ...@@ -396,7 +396,7 @@ static const struct regulator_ops da9055_ldo_ops = {
},\ },\
} }
static struct da9055_regulator_info da9055_regulator_info[] = { static const struct da9055_regulator_info da9055_regulator_info[] = {
DA9055_BUCK(BUCK1, 25, 725, 2075, 6, 9, 0xc, 2), DA9055_BUCK(BUCK1, 25, 725, 2075, 6, 9, 0xc, 2),
DA9055_BUCK(BUCK2, 25, 925, 2500, 6, 0, 3, 0), DA9055_BUCK(BUCK2, 25, 925, 2500, 6, 0, 3, 0),
DA9055_LDO(LDO1, 50, 900, 3300, 6, 2), DA9055_LDO(LDO1, 50, 900, 3300, 6, 2),
...@@ -417,7 +417,7 @@ static int da9055_gpio_init(struct device *dev, ...@@ -417,7 +417,7 @@ static int da9055_gpio_init(struct device *dev,
struct regulator_config *config, struct regulator_config *config,
struct da9055_pdata *pdata, int id) struct da9055_pdata *pdata, int id)
{ {
struct da9055_regulator_info *info = regulator->info; const struct da9055_regulator_info *info = regulator->info;
struct gpio_desc *ren; struct gpio_desc *ren;
struct gpio_desc *ena; struct gpio_desc *ena;
struct gpio_desc *rsel; struct gpio_desc *rsel;
...@@ -491,9 +491,9 @@ static irqreturn_t da9055_ldo5_6_oc_irq(int irq, void *data) ...@@ -491,9 +491,9 @@ static irqreturn_t da9055_ldo5_6_oc_irq(int irq, void *data)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static inline struct da9055_regulator_info *find_regulator_info(int id) static inline const struct da9055_regulator_info *find_regulator_info(int id)
{ {
struct da9055_regulator_info *info; const struct da9055_regulator_info *info;
int i; int i;
for (i = 0; i < ARRAY_SIZE(da9055_regulator_info); i++) { for (i = 0; i < ARRAY_SIZE(da9055_regulator_info); i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment