diff mbox series

[v5,05/15] clk: at91: clk-master: improve readability by using local variables

Message ID 20211011112719.3951784-6-claudiu.beznea@microchip.com (mailing list archive)
State Accepted, archived
Headers show
Series clk: at91: updates for power management and dvfs | expand

Commit Message

Claudiu Beznea Oct. 11, 2021, 11:27 a.m. UTC
Improve readability in clk_sama7g5_master_set() by using local
variables.

Suggested-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clk/at91/clk-master.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Nicolas Ferre Oct. 15, 2021, 7:53 a.m. UTC | #1
On 11/10/2021 at 13:27, Claudiu Beznea wrote:
> Improve readability in clk_sama7g5_master_set() by using local
> variables.
> 
> Suggested-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

So, obviously ;-) :
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Thanks Claudiu!

> ---
>   drivers/clk/at91/clk-master.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c
> index 88f7af1bfff6..9a2c8e64cacf 100644
> --- a/drivers/clk/at91/clk-master.c
> +++ b/drivers/clk/at91/clk-master.c
> @@ -680,6 +680,8 @@ static void clk_sama7g5_master_set(struct clk_master *master,
>   	unsigned long flags;
>   	unsigned int val, cparent;
>   	unsigned int enable = status ? AT91_PMC_MCR_V2_EN : 0;
> +	unsigned int parent = master->parent << PMC_MCR_CSS_SHIFT;
> +	unsigned int div = master->div << MASTER_DIV_SHIFT;
>   
>   	spin_lock_irqsave(master->lock, flags);
>   
> @@ -689,9 +691,7 @@ static void clk_sama7g5_master_set(struct clk_master *master,
>   	regmap_update_bits(master->regmap, AT91_PMC_MCR_V2,
>   			   enable | AT91_PMC_MCR_V2_CSS | AT91_PMC_MCR_V2_DIV |
>   			   AT91_PMC_MCR_V2_CMD | AT91_PMC_MCR_V2_ID_MSK,
> -			   enable | (master->parent << PMC_MCR_CSS_SHIFT) |
> -			   (master->div << MASTER_DIV_SHIFT) |
> -			   AT91_PMC_MCR_V2_CMD |
> +			   enable | parent | div | AT91_PMC_MCR_V2_CMD |
>   			   AT91_PMC_MCR_V2_ID(master->id));
>   
>   	cparent = (val & AT91_PMC_MCR_V2_CSS) >> PMC_MCR_CSS_SHIFT;
>
diff mbox series

Patch

diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c
index 88f7af1bfff6..9a2c8e64cacf 100644
--- a/drivers/clk/at91/clk-master.c
+++ b/drivers/clk/at91/clk-master.c
@@ -680,6 +680,8 @@  static void clk_sama7g5_master_set(struct clk_master *master,
 	unsigned long flags;
 	unsigned int val, cparent;
 	unsigned int enable = status ? AT91_PMC_MCR_V2_EN : 0;
+	unsigned int parent = master->parent << PMC_MCR_CSS_SHIFT;
+	unsigned int div = master->div << MASTER_DIV_SHIFT;
 
 	spin_lock_irqsave(master->lock, flags);
 
@@ -689,9 +691,7 @@  static void clk_sama7g5_master_set(struct clk_master *master,
 	regmap_update_bits(master->regmap, AT91_PMC_MCR_V2,
 			   enable | AT91_PMC_MCR_V2_CSS | AT91_PMC_MCR_V2_DIV |
 			   AT91_PMC_MCR_V2_CMD | AT91_PMC_MCR_V2_ID_MSK,
-			   enable | (master->parent << PMC_MCR_CSS_SHIFT) |
-			   (master->div << MASTER_DIV_SHIFT) |
-			   AT91_PMC_MCR_V2_CMD |
+			   enable | parent | div | AT91_PMC_MCR_V2_CMD |
 			   AT91_PMC_MCR_V2_ID(master->id));
 
 	cparent = (val & AT91_PMC_MCR_V2_CSS) >> PMC_MCR_CSS_SHIFT;