All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: rn5t618: Constify regulator_desc
@ 2019-03-20 12:10 Axel Lin
  2019-03-23  8:34 ` Stefan Agner
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2019-03-20 12:10 UTC (permalink / raw)
  To: Mark Brown
  Cc: Leonard Crestez, Pierre-Hugues Husson, Stefan Agner,
	Beniamino Galvani, Liam Girdwood, linux-kernel, Axel Lin

The regulator_desc never need to be modified, so define them as const as a
hint to the compiler that they can go into .rodata.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/rn5t618-regulator.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/rn5t618-regulator.c b/drivers/regulator/rn5t618-regulator.c
index 790a4a73ea2c..a79c0c43b9f8 100644
--- a/drivers/regulator/rn5t618-regulator.c
+++ b/drivers/regulator/rn5t618-regulator.c
@@ -46,7 +46,7 @@ static const struct regulator_ops rn5t618_reg_ops = {
 		.vsel_mask	= (vmask),				\
 	}
 
-static struct regulator_desc rn5t567_regulators[] = {
+static const struct regulator_desc rn5t567_regulators[] = {
 	/* DCDC */
 	REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500),
 	REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 600000, 3500000, 12500),
@@ -63,7 +63,7 @@ static struct regulator_desc rn5t567_regulators[] = {
 	REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 900000, 3500000, 25000),
 };
 
-static struct regulator_desc rn5t618_regulators[] = {
+static const struct regulator_desc rn5t618_regulators[] = {
 	/* DCDC */
 	REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500),
 	REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 600000, 3500000, 12500),
@@ -79,7 +79,7 @@ static struct regulator_desc rn5t618_regulators[] = {
 	REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 900000, 3500000, 25000),
 };
 
-static struct regulator_desc rc5t619_regulators[] = {
+static const struct regulator_desc rc5t619_regulators[] = {
 	/* DCDC */
 	REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500),
 	REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 600000, 3500000, 12500),
@@ -107,7 +107,7 @@ static int rn5t618_regulator_probe(struct platform_device *pdev)
 	struct rn5t618 *rn5t618 = dev_get_drvdata(pdev->dev.parent);
 	struct regulator_config config = { };
 	struct regulator_dev *rdev;
-	struct regulator_desc *regulators;
+	const struct regulator_desc *regulators;
 	int i;
 	int num_regulators = 0;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] regulator: rn5t618: Constify regulator_desc
  2019-03-20 12:10 [PATCH] regulator: rn5t618: Constify regulator_desc Axel Lin
@ 2019-03-23  8:34 ` Stefan Agner
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Agner @ 2019-03-23  8:34 UTC (permalink / raw)
  To: Axel Lin
  Cc: Mark Brown, Leonard Crestez, Pierre-Hugues Husson,
	Beniamino Galvani, Liam Girdwood, linux-kernel

On 20.03.2019 13:10, Axel Lin wrote:
> The regulator_desc never need to be modified, so define them as const as a
> hint to the compiler that they can go into .rodata.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Looks good to me.

Reviewed-by: Stefan Agner <stefan@agner.ch>

--
Stefan

> ---
>  drivers/regulator/rn5t618-regulator.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/regulator/rn5t618-regulator.c
> b/drivers/regulator/rn5t618-regulator.c
> index 790a4a73ea2c..a79c0c43b9f8 100644
> --- a/drivers/regulator/rn5t618-regulator.c
> +++ b/drivers/regulator/rn5t618-regulator.c
> @@ -46,7 +46,7 @@ static const struct regulator_ops rn5t618_reg_ops = {
>  		.vsel_mask	= (vmask),				\
>  	}
>  
> -static struct regulator_desc rn5t567_regulators[] = {
> +static const struct regulator_desc rn5t567_regulators[] = {
>  	/* DCDC */
>  	REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500),
>  	REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 600000, 3500000, 12500),
> @@ -63,7 +63,7 @@ static struct regulator_desc rn5t567_regulators[] = {
>  	REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 900000, 3500000, 25000),
>  };
>  
> -static struct regulator_desc rn5t618_regulators[] = {
> +static const struct regulator_desc rn5t618_regulators[] = {
>  	/* DCDC */
>  	REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500),
>  	REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 600000, 3500000, 12500),
> @@ -79,7 +79,7 @@ static struct regulator_desc rn5t618_regulators[] = {
>  	REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 900000, 3500000, 25000),
>  };
>  
> -static struct regulator_desc rc5t619_regulators[] = {
> +static const struct regulator_desc rc5t619_regulators[] = {
>  	/* DCDC */
>  	REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500),
>  	REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 600000, 3500000, 12500),
> @@ -107,7 +107,7 @@ static int rn5t618_regulator_probe(struct
> platform_device *pdev)
>  	struct rn5t618 *rn5t618 = dev_get_drvdata(pdev->dev.parent);
>  	struct regulator_config config = { };
>  	struct regulator_dev *rdev;
> -	struct regulator_desc *regulators;
> +	const struct regulator_desc *regulators;
>  	int i;
>  	int num_regulators = 0;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-23  8:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 12:10 [PATCH] regulator: rn5t618: Constify regulator_desc Axel Lin
2019-03-23  8:34 ` Stefan Agner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.