Re: [2/2] net/usb/ax88179_178a: Delete three unnecessary variables in ax88179_chk_eee()

2018-03-13 Thread Oliver Neukum
Am Dienstag, den 13.03.2018, 08:24 +0100 schrieb SF Markus Elfring:
> > 
> > > 
> > > Use three values directly for a condition check without assigning them
> > > to intermediate variables.
> > 
> > Hi,
> > 
> > what is the benefit of this?
> 
> I proposed a small source code reduction.
> 
> Other software design directions might become more interesting for this use 
> case.

Yes and doing so you killed three meaningful names that tell
us what these checks actually test for. That is not an improvement.

Regards
Oliver



Re: [2/2] net/usb/ax88179_178a: Delete three unnecessary variables in ax88179_chk_eee()

2018-03-13 Thread Oliver Neukum
Am Dienstag, den 13.03.2018, 08:24 +0100 schrieb SF Markus Elfring:
> > 
> > > 
> > > Use three values directly for a condition check without assigning them
> > > to intermediate variables.
> > 
> > Hi,
> > 
> > what is the benefit of this?
> 
> I proposed a small source code reduction.
> 
> Other software design directions might become more interesting for this use 
> case.

Yes and doing so you killed three meaningful names that tell
us what these checks actually test for. That is not an improvement.

Regards
Oliver



Re: [2/2] net/usb/ax88179_178a: Delete three unnecessary variables in ax88179_chk_eee()

2018-03-13 Thread SF Markus Elfring
>> Use three values directly for a condition check without assigning them
>> to intermediate variables.
> 
> Hi,
> 
> what is the benefit of this?

I proposed a small source code reduction.

Other software design directions might become more interesting for this use 
case.

Regards,
Markus


Re: [2/2] net/usb/ax88179_178a: Delete three unnecessary variables in ax88179_chk_eee()

2018-03-13 Thread SF Markus Elfring
>> Use three values directly for a condition check without assigning them
>> to intermediate variables.
> 
> Hi,
> 
> what is the benefit of this?

I proposed a small source code reduction.

Other software design directions might become more interesting for this use 
case.

Regards,
Markus


Re: [PATCH 2/2] net/usb/ax88179_178a: Delete three unnecessary variables in ax88179_chk_eee()

2018-03-12 Thread Oliver Neukum
Am Samstag, den 10.03.2018, 19:26 +0100 schrieb SF Markus Elfring:
> From: Markus Elfring 
> Date: Sat, 10 Mar 2018 18:53:28 +0100
> 
> Use three values directly for a condition check without assigning them
> to intermediate variables.

Hi,

what is the benefit of this? It looks like needless code churn to me.

Regards
Oliver



Re: [PATCH 2/2] net/usb/ax88179_178a: Delete three unnecessary variables in ax88179_chk_eee()

2018-03-12 Thread Oliver Neukum
Am Samstag, den 10.03.2018, 19:26 +0100 schrieb SF Markus Elfring:
> From: Markus Elfring 
> Date: Sat, 10 Mar 2018 18:53:28 +0100
> 
> Use three values directly for a condition check without assigning them
> to intermediate variables.

Hi,

what is the benefit of this? It looks like needless code churn to me.

Regards
Oliver



[PATCH 2/2] net/usb/ax88179_178a: Delete three unnecessary variables in ax88179_chk_eee()

2018-03-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Mar 2018 18:53:28 +0100

Use three values directly for a condition check without assigning them
to intermediate variables.

Signed-off-by: Markus Elfring 
---
 drivers/net/usb/ax88179_178a.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index e4b0baa98e9a..3e83be232504 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -684,7 +684,7 @@ static int ax88179_chk_eee(struct usbnet *dev)
 
if (ecmd.duplex & DUPLEX_FULL) {
int eee_lp, eee_cap, eee_adv;
-   u32 lp, cap, adv, supported = 0;
+   u32 cap;
 
eee_cap = ax88179_phy_read_mmd_indirect(dev,
MDIO_PCS_EEE_ABLE,
@@ -708,12 +708,11 @@ static int ax88179_chk_eee(struct usbnet *dev)
if (eee_adv < 0)
goto set_inactive;
 
-   adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv);
-   lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp);
-   supported = (ecmd.speed == SPEED_1000) ?
-SUPPORTED_1000baseT_Full :
-SUPPORTED_100baseT_Full;
-   if (!(lp & adv & supported))
+   if (!(mmd_eee_adv_to_ethtool_adv_t(eee_lp) &
+ mmd_eee_adv_to_ethtool_adv_t(eee_adv) &
+ ((ecmd.speed == SPEED_1000)
+  ? SUPPORTED_1000baseT_Full
+  : SUPPORTED_100baseT_Full)))
goto set_inactive;
 
priv->eee_active = 1;
-- 
2.16.2



[PATCH 2/2] net/usb/ax88179_178a: Delete three unnecessary variables in ax88179_chk_eee()

2018-03-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Mar 2018 18:53:28 +0100

Use three values directly for a condition check without assigning them
to intermediate variables.

Signed-off-by: Markus Elfring 
---
 drivers/net/usb/ax88179_178a.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index e4b0baa98e9a..3e83be232504 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -684,7 +684,7 @@ static int ax88179_chk_eee(struct usbnet *dev)
 
if (ecmd.duplex & DUPLEX_FULL) {
int eee_lp, eee_cap, eee_adv;
-   u32 lp, cap, adv, supported = 0;
+   u32 cap;
 
eee_cap = ax88179_phy_read_mmd_indirect(dev,
MDIO_PCS_EEE_ABLE,
@@ -708,12 +708,11 @@ static int ax88179_chk_eee(struct usbnet *dev)
if (eee_adv < 0)
goto set_inactive;
 
-   adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv);
-   lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp);
-   supported = (ecmd.speed == SPEED_1000) ?
-SUPPORTED_1000baseT_Full :
-SUPPORTED_100baseT_Full;
-   if (!(lp & adv & supported))
+   if (!(mmd_eee_adv_to_ethtool_adv_t(eee_lp) &
+ mmd_eee_adv_to_ethtool_adv_t(eee_adv) &
+ ((ecmd.speed == SPEED_1000)
+  ? SUPPORTED_1000baseT_Full
+  : SUPPORTED_100baseT_Full)))
goto set_inactive;
 
priv->eee_active = 1;
-- 
2.16.2