diff mbox

usb: pegasus: cleanup a couple conditions

Message ID 20111223104436.GA8592@elgon.mountain
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Dan Carpenter Dec. 23, 2011, 10:44 a.m. UTC
We recently made loopback a bool type instead of an int, so the bitwise
AND is redundent.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Petko Manolov Dec. 23, 2011, 4:15 p.m. UTC | #1
Once i thought 'loopback' may have other significant bits.  Since it 
doesn't look likely anymore i guess the patch is OK.


cheers,
Petko



On Fri, 23 Dec 2011, Dan Carpenter wrote:

> We recently made loopback a bool type instead of an int, so the bitwise
> AND is redundent.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
> index 908b427..5d99b8c 100644
> --- a/drivers/net/usb/pegasus.c
> +++ b/drivers/net/usb/pegasus.c
> @@ -517,7 +517,7 @@ static inline int reset_mac(pegasus_t *pegasus)
> 	for (i = 0; i < REG_TIMEOUT; i++) {
> 		get_registers(pegasus, EthCtrl1, 1, &data);
> 		if (~data & 0x08) {
> -			if (loopback & 1)
> +			if (loopback)
> 				break;
> 			if (mii_mode && (pegasus->features & HAS_HOME_PNA))
> 				set_register(pegasus, Gpio1, 0x34);
> @@ -561,7 +561,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
> 		data[1] |= 0x10;	/* set 100 Mbps */
> 	if (mii_mode)
> 		data[1] = 0;
> -	data[2] = (loopback & 1) ? 0x09 : 0x01;
> +	data[2] = loopback ? 0x09 : 0x01;
>
> 	memcpy(pegasus->eth_regs, data, sizeof(data));
> 	ret = set_registers(pegasus, EthCtrl0, 3, data);
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Dec. 23, 2011, 9:52 p.m. UTC | #2
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 23 Dec 2011 13:44:36 +0300

> We recently made loopback a bool type instead of an int, so the bitwise
> AND is redundent.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 908b427..5d99b8c 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -517,7 +517,7 @@  static inline int reset_mac(pegasus_t *pegasus)
 	for (i = 0; i < REG_TIMEOUT; i++) {
 		get_registers(pegasus, EthCtrl1, 1, &data);
 		if (~data & 0x08) {
-			if (loopback & 1)
+			if (loopback)
 				break;
 			if (mii_mode && (pegasus->features & HAS_HOME_PNA))
 				set_register(pegasus, Gpio1, 0x34);
@@ -561,7 +561,7 @@  static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
 		data[1] |= 0x10;	/* set 100 Mbps */
 	if (mii_mode)
 		data[1] = 0;
-	data[2] = (loopback & 1) ? 0x09 : 0x01;
+	data[2] = loopback ? 0x09 : 0x01;
 
 	memcpy(pegasus->eth_regs, data, sizeof(data));
 	ret = set_registers(pegasus, EthCtrl0, 3, data);