diff mbox series

[net-next,v3,35/47] net: dpaa: Use mac_dev variable in dpaa_netdev_init

Message ID 20220715215954.1449214-36-sean.anderson@seco.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series net: dpaa: Convert to phylink | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count fail Series longer than 15 patches (and no cover letter)
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang fail Errors and warnings before: 10 this patch: 10
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 9 this patch: 9
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 28 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 July 15, 2022, 9:59 p.m. UTC
There are several references to mac_dev in dpaa_netdev_init. Make things a
bit more concise by adding a local variable for it.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

(no changes since v1)

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

Comments

Camelia Alexandra Groza July 21, 2022, 1:15 p.m. UTC | #1
> -----Original Message-----
> From: Sean Anderson <sean.anderson@seco.com>
> Sent: Saturday, July 16, 2022 1:00
> To: David S . Miller <davem@davemloft.net>; Jakub Kicinski
> <kuba@kernel.org>; Madalin Bucur <madalin.bucur@nxp.com>;
> netdev@vger.kernel.org
> Cc: Paolo Abeni <pabeni@redhat.com>; Eric Dumazet
> <edumazet@google.com>; linux-arm-kernel@lists.infradead.org; Russell
> King <linux@armlinux.org.uk>; linux-kernel@vger.kernel.org; Sean Anderson
> <sean.anderson@seco.com>
> Subject: [PATCH net-next v3 35/47] net: dpaa: Use mac_dev variable in
> dpaa_netdev_init
> 
> There are several references to mac_dev in dpaa_netdev_init. Make things a
> bit more concise by adding a local variable for it.
> 
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> ---
> 
> (no changes since v1)
> 
>  drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> index d378247a6d0c..377e5513a414 100644
> --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> @@ -203,6 +203,7 @@ static int dpaa_netdev_init(struct net_device
> *net_dev,
>  {
>  	struct dpaa_priv *priv = netdev_priv(net_dev);
>  	struct device *dev = net_dev->dev.parent;
> +	struct mac_device *mac_dev = priv->mac_dev;
>  	struct dpaa_percpu_priv *percpu_priv;
>  	const u8 *mac_addr;
>  	int i, err;
> @@ -216,10 +217,10 @@ static int dpaa_netdev_init(struct net_device
> *net_dev,
>  	}
> 
>  	net_dev->netdev_ops = dpaa_ops;
> -	mac_addr = priv->mac_dev->addr;
> +	mac_addr = mac_dev->addr;
> 
> -	net_dev->mem_start = (unsigned long)priv->mac_dev->vaddr;
> -	net_dev->mem_end = (unsigned long)priv->mac_dev->vaddr_end;
> +	net_dev->mem_start = (unsigned long)mac_dev->vaddr;
> +	net_dev->mem_end = (unsigned long)mac_dev->vaddr_end;
> 
>  	net_dev->min_mtu = ETH_MIN_MTU;
>  	net_dev->max_mtu = dpaa_get_max_mtu();
> @@ -246,7 +247,7 @@ static int dpaa_netdev_init(struct net_device
> *net_dev,
>  		eth_hw_addr_set(net_dev, mac_addr);
>  	} else {
>  		eth_hw_addr_random(net_dev);
> -		err = priv->mac_dev->change_addr(priv->mac_dev-
> >fman_mac,
> +		err = priv->mac_dev->change_addr(mac_dev->fman_mac,
>  			(const enet_addr_t *)net_dev->dev_addr);

You can replace priv->mac_dev->change_addr with mac_dev->change_addr as well.

>  		if (err) {
>  			dev_err(dev, "Failed to set random MAC address\n");
> --
> 2.35.1.1320.gc452695387.dirty
Sean Anderson July 21, 2022, 3:36 p.m. UTC | #2
On 7/21/22 9:15 AM, Camelia Alexandra Groza wrote:
>> -----Original Message-----
>> From: Sean Anderson <sean.anderson@seco.com>
>> Sent: Saturday, July 16, 2022 1:00
>> To: David S . Miller <davem@davemloft.net>; Jakub Kicinski
>> <kuba@kernel.org>; Madalin Bucur <madalin.bucur@nxp.com>;
>> netdev@vger.kernel.org
>> Cc: Paolo Abeni <pabeni@redhat.com>; Eric Dumazet
>> <edumazet@google.com>; linux-arm-kernel@lists.infradead.org; Russell
>> King <linux@armlinux.org.uk>; linux-kernel@vger.kernel.org; Sean Anderson
>> <sean.anderson@seco.com>
>> Subject: [PATCH net-next v3 35/47] net: dpaa: Use mac_dev variable in
>> dpaa_netdev_init
>> 
>> There are several references to mac_dev in dpaa_netdev_init. Make things a
>> bit more concise by adding a local variable for it.
>> 
>> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
>> ---
>> 
>> (no changes since v1)
>> 
>>  drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>> 
>> diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
>> b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
>> index d378247a6d0c..377e5513a414 100644
>> --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
>> +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
>> @@ -203,6 +203,7 @@ static int dpaa_netdev_init(struct net_device
>> *net_dev,
>>  {
>>  	struct dpaa_priv *priv = netdev_priv(net_dev);
>>  	struct device *dev = net_dev->dev.parent;
>> +	struct mac_device *mac_dev = priv->mac_dev;
>>  	struct dpaa_percpu_priv *percpu_priv;
>>  	const u8 *mac_addr;
>>  	int i, err;
>> @@ -216,10 +217,10 @@ static int dpaa_netdev_init(struct net_device
>> *net_dev,
>>  	}
>> 
>>  	net_dev->netdev_ops = dpaa_ops;
>> -	mac_addr = priv->mac_dev->addr;
>> +	mac_addr = mac_dev->addr;
>> 
>> -	net_dev->mem_start = (unsigned long)priv->mac_dev->vaddr;
>> -	net_dev->mem_end = (unsigned long)priv->mac_dev->vaddr_end;
>> +	net_dev->mem_start = (unsigned long)mac_dev->vaddr;
>> +	net_dev->mem_end = (unsigned long)mac_dev->vaddr_end;
>> 
>>  	net_dev->min_mtu = ETH_MIN_MTU;
>>  	net_dev->max_mtu = dpaa_get_max_mtu();
>> @@ -246,7 +247,7 @@ static int dpaa_netdev_init(struct net_device
>> *net_dev,
>>  		eth_hw_addr_set(net_dev, mac_addr);
>>  	} else {
>>  		eth_hw_addr_random(net_dev);
>> -		err = priv->mac_dev->change_addr(priv->mac_dev-
>> >fman_mac,
>> +		err = priv->mac_dev->change_addr(mac_dev->fman_mac,
>>  			(const enet_addr_t *)net_dev->dev_addr);
> 
> You can replace priv->mac_dev->change_addr with mac_dev->change_addr as well.

OK

>>  		if (err) {
>>  			dev_err(dev, "Failed to set random MAC address\n");
>> --
>> 2.35.1.1320.gc452695387.dirty
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index d378247a6d0c..377e5513a414 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -203,6 +203,7 @@  static int dpaa_netdev_init(struct net_device *net_dev,
 {
 	struct dpaa_priv *priv = netdev_priv(net_dev);
 	struct device *dev = net_dev->dev.parent;
+	struct mac_device *mac_dev = priv->mac_dev;
 	struct dpaa_percpu_priv *percpu_priv;
 	const u8 *mac_addr;
 	int i, err;
@@ -216,10 +217,10 @@  static int dpaa_netdev_init(struct net_device *net_dev,
 	}
 
 	net_dev->netdev_ops = dpaa_ops;
-	mac_addr = priv->mac_dev->addr;
+	mac_addr = mac_dev->addr;
 
-	net_dev->mem_start = (unsigned long)priv->mac_dev->vaddr;
-	net_dev->mem_end = (unsigned long)priv->mac_dev->vaddr_end;
+	net_dev->mem_start = (unsigned long)mac_dev->vaddr;
+	net_dev->mem_end = (unsigned long)mac_dev->vaddr_end;
 
 	net_dev->min_mtu = ETH_MIN_MTU;
 	net_dev->max_mtu = dpaa_get_max_mtu();
@@ -246,7 +247,7 @@  static int dpaa_netdev_init(struct net_device *net_dev,
 		eth_hw_addr_set(net_dev, mac_addr);
 	} else {
 		eth_hw_addr_random(net_dev);
-		err = priv->mac_dev->change_addr(priv->mac_dev->fman_mac,
+		err = priv->mac_dev->change_addr(mac_dev->fman_mac,
 			(const enet_addr_t *)net_dev->dev_addr);
 		if (err) {
 			dev_err(dev, "Failed to set random MAC address\n");