Patchwork cs89x0 : packet reception not working

login
register
mail settings
Submitter Jaccon Bastiaansen
Date Aug. 26, 2012, 9:39 p.m.
Message ID <1346017146-28248-1-git-send-email-jaccon.bastiaansen@gmail.com>
Download mbox | patch
Permalink /patch/180093/
State Superseded
Delegated to: David Miller
Headers show

Comments

Jaccon Bastiaansen - Aug. 26, 2012, 9:39 p.m.
The RxCFG register of the CS89x0 could be configured incorrectly
(because of misplaced parentheses), resulting in the disabling
of packet reception.

Signed-off-by: Jaccon Bastiaansen <jaccon.bastiaansen@gmail.com>
---
 drivers/net/ethernet/cirrus/cs89x0.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Joe Perches - Aug. 26, 2012, 10:26 p.m.
On Sun, 2012-08-26 at 23:39 +0200, Jaccon Bastiaansen wrote:
> The RxCFG register of the CS89x0 could be configured incorrectly
> (because of misplaced parentheses), resulting in the disabling
> of packet reception.

Thanks.

> diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c
[]
> @@ -1261,10 +1261,10 @@ static void set_multicast_list(struct net_device *dev)
>  	 * so we have to enable interrupts on them also
>  	 */
>  	writereg(dev, PP_RxCFG,
> -		 (lp->curr_rx_cfg |
> -		  (lp->rx_mode == RX_ALL_ACCEPT)
> -		  ? (RX_CRC_ERROR_ENBL | RX_RUNT_ENBL | RX_EXTRA_DATA_ENBL)
> -		  : 0));
> +		 lp->curr_rx_cfg |
> +		 (lp->rx_mode == RX_ALL_ACCEPT
> +		 ? (RX_CRC_ERROR_ENBL | RX_RUNT_ENBL | RX_EXTRA_DATA_ENBL)
> +		 : 0));
>  	spin_unlock_irqrestore(&lp->lock, flags);
>  }

Perhaps it would be better to use something like:

	int cfg = lp->curr_rx_cfg;

	if (lp->rx_mode == RX_ALL_ACCEPT)
		cfg |= RX_CRC_ERROR_ENBL | RX_RUNT_ENBL | RX_EXTRA_DATA_ENBL;

	writereg(dev, PP_RxCFG, cfg);

--
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

Patch

diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c
index 845b202..ea521fa 100644
--- a/drivers/net/ethernet/cirrus/cs89x0.c
+++ b/drivers/net/ethernet/cirrus/cs89x0.c
@@ -1261,10 +1261,10 @@  static void set_multicast_list(struct net_device *dev)
 	 * so we have to enable interrupts on them also
 	 */
 	writereg(dev, PP_RxCFG,
-		 (lp->curr_rx_cfg |
-		  (lp->rx_mode == RX_ALL_ACCEPT)
-		  ? (RX_CRC_ERROR_ENBL | RX_RUNT_ENBL | RX_EXTRA_DATA_ENBL)
-		  : 0));
+		 lp->curr_rx_cfg |
+		 (lp->rx_mode == RX_ALL_ACCEPT
+		 ? (RX_CRC_ERROR_ENBL | RX_RUNT_ENBL | RX_EXTRA_DATA_ENBL)
+		 : 0));
 	spin_unlock_irqrestore(&lp->lock, flags);
 }