diff mbox series

[net-next,v3,7/9] net: sunhme: Clean up mac address init

Message ID 20230314003613.3874089-8-seanga2@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: sunhme: Probe/IRQ cleanups | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 29 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Sean Anderson March 14, 2023, 12:36 a.m. UTC
Clean up some oddities suggested during review.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

(no changes since v2)

Changes in v2:
- New

 drivers/net/ethernet/sun/sunhme.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Simon Horman March 18, 2023, 9:03 a.m. UTC | #1
On Mon, Mar 13, 2023 at 08:36:11PM -0400, Sean Anderson wrote:
> Clean up some oddities suggested during review.
> 
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> ---
> 
> (no changes since v2)
> 
> Changes in v2:
> - New
> 
>  drivers/net/ethernet/sun/sunhme.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
> index c2737f26afbe..1f27e99abf17 100644
> --- a/drivers/net/ethernet/sun/sunhme.c
> +++ b/drivers/net/ethernet/sun/sunhme.c
> @@ -2348,9 +2348,7 @@ static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsi
>  		p += 6;
>  
>  		if (index == 0) {
> -			int i;
> -
> -			for (i = 0; i < 6; i++)
> +			for (int i = 0; i < 6; i++)
>  				dev_addr[i] = readb(p + i);
>  			return 1;
>  		}
> @@ -2362,9 +2360,10 @@ static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsi
>  static void __maybe_unused get_hme_mac_nonsparc(struct pci_dev *pdev,
>  						unsigned char *dev_addr)
>  {
> +	void __iomem *p;
>  	size_t size;
> -	void __iomem *p = pci_map_rom(pdev, &size);
>  
> +	p = pci_map_rom(pdev, &size);
>  	if (p) {
>  		int index = 0;
>  		int found;
> @@ -2386,7 +2385,7 @@ static void __maybe_unused get_hme_mac_nonsparc(struct pci_dev *pdev,
>  	dev_addr[2] = 0x20;
>  	get_random_bytes(&dev_addr[3], 3);
>  }
> -#endif /* !(CONFIG_SPARC) */
> +#endif

Hi Sean,

I think this problem was added by patch 6/9,
so perhaps best to squash it into that patch.

Actually, I'd squash all these changes into 6/9.
But I don't feel strongly about it.

So in any case,

Reviewed-by: Simon Horman <simon.horman@corigine.com>

I will pause my review here (again!) because I need to go to a football match.
Sean Anderson March 18, 2023, 3:43 p.m. UTC | #2
On 3/18/23 05:03, Simon Horman wrote:
> On Mon, Mar 13, 2023 at 08:36:11PM -0400, Sean Anderson wrote:
>> Clean up some oddities suggested during review.
>>
>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
>> ---
>>
>> (no changes since v2)
>>
>> Changes in v2:
>> - New
>>
>>   drivers/net/ethernet/sun/sunhme.c | 9 ++++-----
>>   1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
>> index c2737f26afbe..1f27e99abf17 100644
>> --- a/drivers/net/ethernet/sun/sunhme.c
>> +++ b/drivers/net/ethernet/sun/sunhme.c
>> @@ -2348,9 +2348,7 @@ static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsi
>>   		p += 6;
>>   
>>   		if (index == 0) {
>> -			int i;
>> -
>> -			for (i = 0; i < 6; i++)
>> +			for (int i = 0; i < 6; i++)
>>   				dev_addr[i] = readb(p + i);
>>   			return 1;
>>   		}
>> @@ -2362,9 +2360,10 @@ static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsi
>>   static void __maybe_unused get_hme_mac_nonsparc(struct pci_dev *pdev,
>>   						unsigned char *dev_addr)
>>   {
>> +	void __iomem *p;
>>   	size_t size;
>> -	void __iomem *p = pci_map_rom(pdev, &size);
>>   
>> +	p = pci_map_rom(pdev, &size);
>>   	if (p) {
>>   		int index = 0;
>>   		int found;
>> @@ -2386,7 +2385,7 @@ static void __maybe_unused get_hme_mac_nonsparc(struct pci_dev *pdev,
>>   	dev_addr[2] = 0x20;
>>   	get_random_bytes(&dev_addr[3], 3);
>>   }
>> -#endif /* !(CONFIG_SPARC) */
>> +#endif
> 
> Hi Sean,
> 
> I think this problem was added by patch 6/9,
> so perhaps best to squash it into that patch.

> Actually, I'd squash all these changes into 6/9.
> But I don't feel strongly about it.

6/9 just moves code around. I am keeping the modifications for other commits.

--Sean

> So in any case,
> 
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
> 
> I will pause my review here (again!) because I need to go to a football match.
Simon Horman March 21, 2023, 8:01 a.m. UTC | #3
On Sat, Mar 18, 2023 at 11:43:16AM -0400, Sean Anderson wrote:
> On 3/18/23 05:03, Simon Horman wrote:
> > On Mon, Mar 13, 2023 at 08:36:11PM -0400, Sean Anderson wrote:
> > > Clean up some oddities suggested during review.
> > > 
> > > Signed-off-by: Sean Anderson <seanga2@gmail.com>

...

> > > @@ -2386,7 +2385,7 @@ static void __maybe_unused get_hme_mac_nonsparc(struct pci_dev *pdev,
> > >   	dev_addr[2] = 0x20;
> > >   	get_random_bytes(&dev_addr[3], 3);
> > >   }
> > > -#endif /* !(CONFIG_SPARC) */
> > > +#endif
> > 
> > Hi Sean,
> > 
> > I think this problem was added by patch 6/9,
> > so perhaps best to squash it into that patch.
> 
> > Actually, I'd squash all these changes into 6/9.
> > But I don't feel strongly about it.
> 
> 6/9 just moves code around. I am keeping the modifications for other commits.

Ack.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index c2737f26afbe..1f27e99abf17 100644
--- a/drivers/net/ethernet/sun/sunhme.c
+++ b/drivers/net/ethernet/sun/sunhme.c
@@ -2348,9 +2348,7 @@  static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsi
 		p += 6;
 
 		if (index == 0) {
-			int i;
-
-			for (i = 0; i < 6; i++)
+			for (int i = 0; i < 6; i++)
 				dev_addr[i] = readb(p + i);
 			return 1;
 		}
@@ -2362,9 +2360,10 @@  static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsi
 static void __maybe_unused get_hme_mac_nonsparc(struct pci_dev *pdev,
 						unsigned char *dev_addr)
 {
+	void __iomem *p;
 	size_t size;
-	void __iomem *p = pci_map_rom(pdev, &size);
 
+	p = pci_map_rom(pdev, &size);
 	if (p) {
 		int index = 0;
 		int found;
@@ -2386,7 +2385,7 @@  static void __maybe_unused get_hme_mac_nonsparc(struct pci_dev *pdev,
 	dev_addr[2] = 0x20;
 	get_random_bytes(&dev_addr[3], 3);
 }
-#endif /* !(CONFIG_SPARC) */
+#endif
 
 static void happy_meal_addr_init(struct happy_meal *hp,
 				 struct device_node *dp, int qfe_slot)