diff mbox series

[02/11] pinctrl: single: fix the loop counter variable type

Message ID 20210123182711.7177-3-dariobin@libero.it
State Superseded
Delegated to: Lokesh Vutla
Headers show
Series Add support for pinmux status command on beaglebone | expand

Commit Message

Dario Binacchi Jan. 23, 2021, 6:27 p.m. UTC
The patch changes the variable 'n' type from phys_addr_t to int.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
---

 drivers/pinctrl/pinctrl-single.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Simon Glass Jan. 24, 2021, 2:03 a.m. UTC | #1
On Sat, 23 Jan 2021 at 11:27, Dario Binacchi <dariobin@libero.it> wrote:
>
> The patch changes the variable 'n' type from phys_addr_t to int.

s/The patch changes/Change/

>
> Signed-off-by: Dario Binacchi <dariobin@libero.it>
> ---
>
>  drivers/pinctrl/pinctrl-single.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-sing

Reviewed-by: Simon Glass <sjg@chromium.org>
Pratyush Yadav Jan. 25, 2021, 4:53 p.m. UTC | #2
Hi Dario,

On 23/01/21 07:27PM, Dario Binacchi wrote:
> The patch changes the variable 'n' type from phys_addr_t to int.

This information can very easily be obtained by reading the diff. The 
commit message should also explain _why_ the change is made. For example 
here it would be a good idea to add something like:

  n is used as a loop counter, not as a physical address, and is used in 
  a comparison with an int. So it makes sense to set its type to int.
 
Other than that,

Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
 
> Signed-off-by: Dario Binacchi <dariobin@libero.it>
> ---
> 
>  drivers/pinctrl/pinctrl-single.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
> index c9a6c272bf..49ed15211d 100644
> --- a/drivers/pinctrl/pinctrl-single.c
> +++ b/drivers/pinctrl/pinctrl-single.c
> @@ -75,8 +75,8 @@ static int single_configure_pins(struct udevice *dev,
>  				 int size)
>  {
>  	struct single_pdata *pdata = dev_get_plat(dev);
> -	int count = size / sizeof(struct single_fdt_pin_cfg);
> -	phys_addr_t n, reg;
> +	int n, count = size / sizeof(struct single_fdt_pin_cfg);
> +	phys_addr_t reg;
>  	u32 val;
>  
>  	for (n = 0; n < count; n++, pins++) {
> @@ -109,8 +109,8 @@ static int single_configure_bits(struct udevice *dev,
>  				 int size)
>  {
>  	struct single_pdata *pdata = dev_get_plat(dev);
> -	int count = size / sizeof(struct single_fdt_bits_cfg);
> -	phys_addr_t n, reg;
> +	int n, count = size / sizeof(struct single_fdt_bits_cfg);
> +	phys_addr_t reg;
>  	u32 val, mask;
>  
>  	for (n = 0; n < count; n++, pins++) {
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index c9a6c272bf..49ed15211d 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -75,8 +75,8 @@  static int single_configure_pins(struct udevice *dev,
 				 int size)
 {
 	struct single_pdata *pdata = dev_get_plat(dev);
-	int count = size / sizeof(struct single_fdt_pin_cfg);
-	phys_addr_t n, reg;
+	int n, count = size / sizeof(struct single_fdt_pin_cfg);
+	phys_addr_t reg;
 	u32 val;
 
 	for (n = 0; n < count; n++, pins++) {
@@ -109,8 +109,8 @@  static int single_configure_bits(struct udevice *dev,
 				 int size)
 {
 	struct single_pdata *pdata = dev_get_plat(dev);
-	int count = size / sizeof(struct single_fdt_bits_cfg);
-	phys_addr_t n, reg;
+	int n, count = size / sizeof(struct single_fdt_bits_cfg);
+	phys_addr_t reg;
 	u32 val, mask;
 
 	for (n = 0; n < count; n++, pins++) {