diff mbox series

pwm: atmel-tcb: Make private data variable naming consistent

Message ID 20240709092221.47025-2-u.kleine-koenig@baylibre.com
State Accepted
Headers show
Series pwm: atmel-tcb: Make private data variable naming consistent | expand

Commit Message

Uwe Kleine-König July 9, 2024, 9:22 a.m. UTC
Currently the variables of type struct atmel_tcb_pwm_device
are named "tcbpwm", and variables of type atmel_tcb_pwm_chip are either
named "tcbpwm" (too!) or "tcbpwmc". Rename the chips with device name to
"tcbpwmc" to get a consistent naming.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
 drivers/pwm/pwm-atmel-tcb.c | 90 ++++++++++++++++++-------------------
 1 file changed, 45 insertions(+), 45 deletions(-)


base-commit: 120a528213b6693214e3cbc24a9c3052a4b1024b

Comments

Nicolas Ferre July 10, 2024, 1:20 p.m. UTC | #1
On 09/07/2024 at 11:22, Uwe Kleine-König wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Currently the variables of type struct atmel_tcb_pwm_device
> are named "tcbpwm", and variables of type atmel_tcb_pwm_chip are either
> named "tcbpwm" (too!) or "tcbpwmc". Rename the chips with device name to
> "tcbpwmc" to get a consistent naming.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>

Makes sense: thanks Uwe:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Best regards,
   Nicolas

> ---
>   drivers/pwm/pwm-atmel-tcb.c | 90 ++++++++++++++++++-------------------
>   1 file changed, 45 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
> index 528e54c5999d..9470811e195c 100644
> --- a/drivers/pwm/pwm-atmel-tcb.c
> +++ b/drivers/pwm/pwm-atmel-tcb.c
> @@ -389,17 +389,17 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
>   {
>          struct pwm_chip *chip;
>          const struct of_device_id *match;
> -       struct atmel_tcb_pwm_chip *tcbpwm;
> +       struct atmel_tcb_pwm_chip *tcbpwmc;
>          const struct atmel_tcb_config *config;
>          struct device_node *np = pdev->dev.of_node;
>          char clk_name[] = "t0_clk";
>          int err;
>          int channel;
> 
> -       chip = devm_pwmchip_alloc(&pdev->dev, NPWM, sizeof(*tcbpwm));
> +       chip = devm_pwmchip_alloc(&pdev->dev, NPWM, sizeof(*tcbpwmc));
>          if (IS_ERR(chip))
>                  return PTR_ERR(chip);
> -       tcbpwm = to_tcb_chip(chip);
> +       tcbpwmc = to_tcb_chip(chip);
> 
>          err = of_property_read_u32(np, "reg", &channel);
>          if (err < 0) {
> @@ -409,20 +409,20 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
>                  return err;
>          }
> 
> -       tcbpwm->regmap = syscon_node_to_regmap(np->parent);
> -       if (IS_ERR(tcbpwm->regmap))
> -               return PTR_ERR(tcbpwm->regmap);
> +       tcbpwmc->regmap = syscon_node_to_regmap(np->parent);
> +       if (IS_ERR(tcbpwmc->regmap))
> +               return PTR_ERR(tcbpwmc->regmap);
> 
> -       tcbpwm->slow_clk = of_clk_get_by_name(np->parent, "slow_clk");
> -       if (IS_ERR(tcbpwm->slow_clk))
> -               return PTR_ERR(tcbpwm->slow_clk);
> +       tcbpwmc->slow_clk = of_clk_get_by_name(np->parent, "slow_clk");
> +       if (IS_ERR(tcbpwmc->slow_clk))
> +               return PTR_ERR(tcbpwmc->slow_clk);
> 
>          clk_name[1] += channel;
> -       tcbpwm->clk = of_clk_get_by_name(np->parent, clk_name);
> -       if (IS_ERR(tcbpwm->clk))
> -               tcbpwm->clk = of_clk_get_by_name(np->parent, "t0_clk");
> -       if (IS_ERR(tcbpwm->clk)) {
> -               err = PTR_ERR(tcbpwm->clk);
> +       tcbpwmc->clk = of_clk_get_by_name(np->parent, clk_name);
> +       if (IS_ERR(tcbpwmc->clk))
> +               tcbpwmc->clk = of_clk_get_by_name(np->parent, "t0_clk");
> +       if (IS_ERR(tcbpwmc->clk)) {
> +               err = PTR_ERR(tcbpwmc->clk);
>                  goto err_slow_clk;
>          }
> 
> @@ -430,22 +430,22 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
>          config = match->data;
> 
>          if (config->has_gclk) {
> -               tcbpwm->gclk = of_clk_get_by_name(np->parent, "gclk");
> -               if (IS_ERR(tcbpwm->gclk)) {
> -                       err = PTR_ERR(tcbpwm->gclk);
> +               tcbpwmc->gclk = of_clk_get_by_name(np->parent, "gclk");
> +               if (IS_ERR(tcbpwmc->gclk)) {
> +                       err = PTR_ERR(tcbpwmc->gclk);
>                          goto err_clk;
>                  }
>          }
> 
>          chip->ops = &atmel_tcb_pwm_ops;
> -       tcbpwm->channel = channel;
> -       tcbpwm->width = config->counter_width;
> +       tcbpwmc->channel = channel;
> +       tcbpwmc->width = config->counter_width;
> 
> -       err = clk_prepare_enable(tcbpwm->slow_clk);
> +       err = clk_prepare_enable(tcbpwmc->slow_clk);
>          if (err)
>                  goto err_gclk;
> 
> -       spin_lock_init(&tcbpwm->lock);
> +       spin_lock_init(&tcbpwmc->lock);
> 
>          err = pwmchip_add(chip);
>          if (err < 0)
> @@ -456,16 +456,16 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
>          return 0;
> 
>   err_disable_clk:
> -       clk_disable_unprepare(tcbpwm->slow_clk);
> +       clk_disable_unprepare(tcbpwmc->slow_clk);
> 
>   err_gclk:
> -       clk_put(tcbpwm->gclk);
> +       clk_put(tcbpwmc->gclk);
> 
>   err_clk:
> -       clk_put(tcbpwm->clk);
> +       clk_put(tcbpwmc->clk);
> 
>   err_slow_clk:
> -       clk_put(tcbpwm->slow_clk);
> +       clk_put(tcbpwmc->slow_clk);
> 
>          return err;
>   }
> @@ -473,14 +473,14 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
>   static void atmel_tcb_pwm_remove(struct platform_device *pdev)
>   {
>          struct pwm_chip *chip = platform_get_drvdata(pdev);
> -       struct atmel_tcb_pwm_chip *tcbpwm = to_tcb_chip(chip);
> +       struct atmel_tcb_pwm_chip *tcbpwmc = to_tcb_chip(chip);
> 
>          pwmchip_remove(chip);
> 
> -       clk_disable_unprepare(tcbpwm->slow_clk);
> -       clk_put(tcbpwm->gclk);
> -       clk_put(tcbpwm->clk);
> -       clk_put(tcbpwm->slow_clk);
> +       clk_disable_unprepare(tcbpwmc->slow_clk);
> +       clk_put(tcbpwmc->gclk);
> +       clk_put(tcbpwmc->clk);
> +       clk_put(tcbpwmc->slow_clk);
>   }
> 
>   static const struct of_device_id atmel_tcb_pwm_dt_ids[] = {
> @@ -492,14 +492,14 @@ MODULE_DEVICE_TABLE(of, atmel_tcb_pwm_dt_ids);
>   static int atmel_tcb_pwm_suspend(struct device *dev)
>   {
>          struct pwm_chip *chip = dev_get_drvdata(dev);
> -       struct atmel_tcb_pwm_chip *tcbpwm = to_tcb_chip(chip);
> -       struct atmel_tcb_channel *chan = &tcbpwm->bkup;
> -       unsigned int channel = tcbpwm->channel;
> +       struct atmel_tcb_pwm_chip *tcbpwmc = to_tcb_chip(chip);
> +       struct atmel_tcb_channel *chan = &tcbpwmc->bkup;
> +       unsigned int channel = tcbpwmc->channel;
> 
> -       regmap_read(tcbpwm->regmap, ATMEL_TC_REG(channel, CMR), &chan->cmr);
> -       regmap_read(tcbpwm->regmap, ATMEL_TC_REG(channel, RA), &chan->ra);
> -       regmap_read(tcbpwm->regmap, ATMEL_TC_REG(channel, RB), &chan->rb);
> -       regmap_read(tcbpwm->regmap, ATMEL_TC_REG(channel, RC), &chan->rc);
> +       regmap_read(tcbpwmc->regmap, ATMEL_TC_REG(channel, CMR), &chan->cmr);
> +       regmap_read(tcbpwmc->regmap, ATMEL_TC_REG(channel, RA), &chan->ra);
> +       regmap_read(tcbpwmc->regmap, ATMEL_TC_REG(channel, RB), &chan->rb);
> +       regmap_read(tcbpwmc->regmap, ATMEL_TC_REG(channel, RC), &chan->rc);
> 
>          return 0;
>   }
> @@ -507,17 +507,17 @@ static int atmel_tcb_pwm_suspend(struct device *dev)
>   static int atmel_tcb_pwm_resume(struct device *dev)
>   {
>          struct pwm_chip *chip = dev_get_drvdata(dev);
> -       struct atmel_tcb_pwm_chip *tcbpwm = to_tcb_chip(chip);
> -       struct atmel_tcb_channel *chan = &tcbpwm->bkup;
> -       unsigned int channel = tcbpwm->channel;
> +       struct atmel_tcb_pwm_chip *tcbpwmc = to_tcb_chip(chip);
> +       struct atmel_tcb_channel *chan = &tcbpwmc->bkup;
> +       unsigned int channel = tcbpwmc->channel;
> 
> -       regmap_write(tcbpwm->regmap, ATMEL_TC_REG(channel, CMR), chan->cmr);
> -       regmap_write(tcbpwm->regmap, ATMEL_TC_REG(channel, RA), chan->ra);
> -       regmap_write(tcbpwm->regmap, ATMEL_TC_REG(channel, RB), chan->rb);
> -       regmap_write(tcbpwm->regmap, ATMEL_TC_REG(channel, RC), chan->rc);
> +       regmap_write(tcbpwmc->regmap, ATMEL_TC_REG(channel, CMR), chan->cmr);
> +       regmap_write(tcbpwmc->regmap, ATMEL_TC_REG(channel, RA), chan->ra);
> +       regmap_write(tcbpwmc->regmap, ATMEL_TC_REG(channel, RB), chan->rb);
> +       regmap_write(tcbpwmc->regmap, ATMEL_TC_REG(channel, RC), chan->rc);
> 
>          if (chan->enabled)
> -               regmap_write(tcbpwm->regmap,
> +               regmap_write(tcbpwmc->regmap,
>                               ATMEL_TC_CLKEN | ATMEL_TC_SWTRG,
>                               ATMEL_TC_REG(channel, CCR));
> 
> 
> base-commit: 120a528213b6693214e3cbc24a9c3052a4b1024b
> --
> 2.43.0
>
Uwe Kleine-König July 10, 2024, 3:58 p.m. UTC | #2
On Wed, Jul 10, 2024 at 03:20:00PM +0200, Nicolas Ferre wrote:
> On 09/07/2024 at 11:22, Uwe Kleine-König wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > Currently the variables of type struct atmel_tcb_pwm_device
> > are named "tcbpwm", and variables of type atmel_tcb_pwm_chip are either
> > named "tcbpwm" (too!) or "tcbpwmc". Rename the chips with device name to
> > "tcbpwmc" to get a consistent naming.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> 
> Makes sense: thanks Uwe:
> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Thanks, I applied the patch with your ack to my pwm/for-next branch.

Best regards
Uwe
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
index 528e54c5999d..9470811e195c 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -389,17 +389,17 @@  static int atmel_tcb_pwm_probe(struct platform_device *pdev)
 {
 	struct pwm_chip *chip;
 	const struct of_device_id *match;
-	struct atmel_tcb_pwm_chip *tcbpwm;
+	struct atmel_tcb_pwm_chip *tcbpwmc;
 	const struct atmel_tcb_config *config;
 	struct device_node *np = pdev->dev.of_node;
 	char clk_name[] = "t0_clk";
 	int err;
 	int channel;
 
-	chip = devm_pwmchip_alloc(&pdev->dev, NPWM, sizeof(*tcbpwm));
+	chip = devm_pwmchip_alloc(&pdev->dev, NPWM, sizeof(*tcbpwmc));
 	if (IS_ERR(chip))
 		return PTR_ERR(chip);
-	tcbpwm = to_tcb_chip(chip);
+	tcbpwmc = to_tcb_chip(chip);
 
 	err = of_property_read_u32(np, "reg", &channel);
 	if (err < 0) {
@@ -409,20 +409,20 @@  static int atmel_tcb_pwm_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	tcbpwm->regmap = syscon_node_to_regmap(np->parent);
-	if (IS_ERR(tcbpwm->regmap))
-		return PTR_ERR(tcbpwm->regmap);
+	tcbpwmc->regmap = syscon_node_to_regmap(np->parent);
+	if (IS_ERR(tcbpwmc->regmap))
+		return PTR_ERR(tcbpwmc->regmap);
 
-	tcbpwm->slow_clk = of_clk_get_by_name(np->parent, "slow_clk");
-	if (IS_ERR(tcbpwm->slow_clk))
-		return PTR_ERR(tcbpwm->slow_clk);
+	tcbpwmc->slow_clk = of_clk_get_by_name(np->parent, "slow_clk");
+	if (IS_ERR(tcbpwmc->slow_clk))
+		return PTR_ERR(tcbpwmc->slow_clk);
 
 	clk_name[1] += channel;
-	tcbpwm->clk = of_clk_get_by_name(np->parent, clk_name);
-	if (IS_ERR(tcbpwm->clk))
-		tcbpwm->clk = of_clk_get_by_name(np->parent, "t0_clk");
-	if (IS_ERR(tcbpwm->clk)) {
-		err = PTR_ERR(tcbpwm->clk);
+	tcbpwmc->clk = of_clk_get_by_name(np->parent, clk_name);
+	if (IS_ERR(tcbpwmc->clk))
+		tcbpwmc->clk = of_clk_get_by_name(np->parent, "t0_clk");
+	if (IS_ERR(tcbpwmc->clk)) {
+		err = PTR_ERR(tcbpwmc->clk);
 		goto err_slow_clk;
 	}
 
@@ -430,22 +430,22 @@  static int atmel_tcb_pwm_probe(struct platform_device *pdev)
 	config = match->data;
 
 	if (config->has_gclk) {
-		tcbpwm->gclk = of_clk_get_by_name(np->parent, "gclk");
-		if (IS_ERR(tcbpwm->gclk)) {
-			err = PTR_ERR(tcbpwm->gclk);
+		tcbpwmc->gclk = of_clk_get_by_name(np->parent, "gclk");
+		if (IS_ERR(tcbpwmc->gclk)) {
+			err = PTR_ERR(tcbpwmc->gclk);
 			goto err_clk;
 		}
 	}
 
 	chip->ops = &atmel_tcb_pwm_ops;
-	tcbpwm->channel = channel;
-	tcbpwm->width = config->counter_width;
+	tcbpwmc->channel = channel;
+	tcbpwmc->width = config->counter_width;
 
-	err = clk_prepare_enable(tcbpwm->slow_clk);
+	err = clk_prepare_enable(tcbpwmc->slow_clk);
 	if (err)
 		goto err_gclk;
 
-	spin_lock_init(&tcbpwm->lock);
+	spin_lock_init(&tcbpwmc->lock);
 
 	err = pwmchip_add(chip);
 	if (err < 0)
@@ -456,16 +456,16 @@  static int atmel_tcb_pwm_probe(struct platform_device *pdev)
 	return 0;
 
 err_disable_clk:
-	clk_disable_unprepare(tcbpwm->slow_clk);
+	clk_disable_unprepare(tcbpwmc->slow_clk);
 
 err_gclk:
-	clk_put(tcbpwm->gclk);
+	clk_put(tcbpwmc->gclk);
 
 err_clk:
-	clk_put(tcbpwm->clk);
+	clk_put(tcbpwmc->clk);
 
 err_slow_clk:
-	clk_put(tcbpwm->slow_clk);
+	clk_put(tcbpwmc->slow_clk);
 
 	return err;
 }
@@ -473,14 +473,14 @@  static int atmel_tcb_pwm_probe(struct platform_device *pdev)
 static void atmel_tcb_pwm_remove(struct platform_device *pdev)
 {
 	struct pwm_chip *chip = platform_get_drvdata(pdev);
-	struct atmel_tcb_pwm_chip *tcbpwm = to_tcb_chip(chip);
+	struct atmel_tcb_pwm_chip *tcbpwmc = to_tcb_chip(chip);
 
 	pwmchip_remove(chip);
 
-	clk_disable_unprepare(tcbpwm->slow_clk);
-	clk_put(tcbpwm->gclk);
-	clk_put(tcbpwm->clk);
-	clk_put(tcbpwm->slow_clk);
+	clk_disable_unprepare(tcbpwmc->slow_clk);
+	clk_put(tcbpwmc->gclk);
+	clk_put(tcbpwmc->clk);
+	clk_put(tcbpwmc->slow_clk);
 }
 
 static const struct of_device_id atmel_tcb_pwm_dt_ids[] = {
@@ -492,14 +492,14 @@  MODULE_DEVICE_TABLE(of, atmel_tcb_pwm_dt_ids);
 static int atmel_tcb_pwm_suspend(struct device *dev)
 {
 	struct pwm_chip *chip = dev_get_drvdata(dev);
-	struct atmel_tcb_pwm_chip *tcbpwm = to_tcb_chip(chip);
-	struct atmel_tcb_channel *chan = &tcbpwm->bkup;
-	unsigned int channel = tcbpwm->channel;
+	struct atmel_tcb_pwm_chip *tcbpwmc = to_tcb_chip(chip);
+	struct atmel_tcb_channel *chan = &tcbpwmc->bkup;
+	unsigned int channel = tcbpwmc->channel;
 
-	regmap_read(tcbpwm->regmap, ATMEL_TC_REG(channel, CMR), &chan->cmr);
-	regmap_read(tcbpwm->regmap, ATMEL_TC_REG(channel, RA), &chan->ra);
-	regmap_read(tcbpwm->regmap, ATMEL_TC_REG(channel, RB), &chan->rb);
-	regmap_read(tcbpwm->regmap, ATMEL_TC_REG(channel, RC), &chan->rc);
+	regmap_read(tcbpwmc->regmap, ATMEL_TC_REG(channel, CMR), &chan->cmr);
+	regmap_read(tcbpwmc->regmap, ATMEL_TC_REG(channel, RA), &chan->ra);
+	regmap_read(tcbpwmc->regmap, ATMEL_TC_REG(channel, RB), &chan->rb);
+	regmap_read(tcbpwmc->regmap, ATMEL_TC_REG(channel, RC), &chan->rc);
 
 	return 0;
 }
@@ -507,17 +507,17 @@  static int atmel_tcb_pwm_suspend(struct device *dev)
 static int atmel_tcb_pwm_resume(struct device *dev)
 {
 	struct pwm_chip *chip = dev_get_drvdata(dev);
-	struct atmel_tcb_pwm_chip *tcbpwm = to_tcb_chip(chip);
-	struct atmel_tcb_channel *chan = &tcbpwm->bkup;
-	unsigned int channel = tcbpwm->channel;
+	struct atmel_tcb_pwm_chip *tcbpwmc = to_tcb_chip(chip);
+	struct atmel_tcb_channel *chan = &tcbpwmc->bkup;
+	unsigned int channel = tcbpwmc->channel;
 
-	regmap_write(tcbpwm->regmap, ATMEL_TC_REG(channel, CMR), chan->cmr);
-	regmap_write(tcbpwm->regmap, ATMEL_TC_REG(channel, RA), chan->ra);
-	regmap_write(tcbpwm->regmap, ATMEL_TC_REG(channel, RB), chan->rb);
-	regmap_write(tcbpwm->regmap, ATMEL_TC_REG(channel, RC), chan->rc);
+	regmap_write(tcbpwmc->regmap, ATMEL_TC_REG(channel, CMR), chan->cmr);
+	regmap_write(tcbpwmc->regmap, ATMEL_TC_REG(channel, RA), chan->ra);
+	regmap_write(tcbpwmc->regmap, ATMEL_TC_REG(channel, RB), chan->rb);
+	regmap_write(tcbpwmc->regmap, ATMEL_TC_REG(channel, RC), chan->rc);
 
 	if (chan->enabled)
-		regmap_write(tcbpwm->regmap,
+		regmap_write(tcbpwmc->regmap,
 			     ATMEL_TC_CLKEN | ATMEL_TC_SWTRG,
 			     ATMEL_TC_REG(channel, CCR));