Message ID | 1554972.rhPQTyRgNp@wasted.cogentembedded.com (mailing list archive) |
---|---|
State | Awaiting Upstream |
Headers | show |
Hi Sergei, On Sun, Jan 10, 2016 at 10:27 PM, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote: > The code in ravb_emac_init() twiddling the ECMR bits always looked a bit > strange to me: if one intends to respect 'priv->duplex', why save old value > of the ECMR.DM bit? As all the other bits are zeroed anyway, we don't > really need to read ECMR before writing to it. Just an observation, I don't know about correctness: priv->duplex wasn't respected if ECMR_DM was already set before. Same comment for the second patch. > Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> > > --- > drivers/net/ethernet/renesas/ravb_main.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > Index: net/drivers/net/ethernet/renesas/ravb_main.c > =================================================================== > --- net.orig/drivers/net/ethernet/renesas/ravb_main.c > +++ net/drivers/net/ethernet/renesas/ravb_main.c > @@ -338,16 +338,13 @@ error: > static void ravb_emac_init(struct net_device *ndev) > { > struct ravb_private *priv = netdev_priv(ndev); > - u32 ecmr; > > /* Receive frame limit set register */ > ravb_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, RFLR); > > /* PAUSE prohibition */ > - ecmr = ravb_read(ndev, ECMR); > - ecmr &= ECMR_DM; Perhaps you misread as "ecmr &= ~ECMR_DM"? > - ecmr |= ECMR_ZPF | (priv->duplex ? ECMR_DM : 0) | ECMR_TE | ECMR_RE; > - ravb_write(ndev, ecmr, ECMR); > + ravb_write(ndev, ECMR_ZPF | (priv->duplex ? ECMR_DM : 0) | > + ECMR_TE | ECMR_RE, ECMR); Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello. On 1/11/2016 12:45 PM, Geert Uytterhoeven wrote: > On Sun, Jan 10, 2016 at 10:27 PM, Sergei Shtylyov > <sergei.shtylyov@cogentembedded.com> wrote: >> The code in ravb_emac_init() twiddling the ECMR bits always looked a bit >> strange to me: if one intends to respect 'priv->duplex', why save old value >> of the ECMR.DM bit? As all the other bits are zeroed anyway, we don't >> really need to read ECMR before writing to it. > > Just an observation, I don't know about correctness: priv->duplex wasn't > respected if ECMR_DM was already set before. > > Same comment for the second patch. That's what the patches try to fix. Perhaps the description was too terse? >> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> >> >> --- >> drivers/net/ethernet/renesas/ravb_main.c | 7 ++----- >> 1 file changed, 2 insertions(+), 5 deletions(-) >> >> Index: net/drivers/net/ethernet/renesas/ravb_main.c >> =================================================================== >> --- net.orig/drivers/net/ethernet/renesas/ravb_main.c >> +++ net/drivers/net/ethernet/renesas/ravb_main.c >> @@ -338,16 +338,13 @@ error: >> static void ravb_emac_init(struct net_device *ndev) >> { >> struct ravb_private *priv = netdev_priv(ndev); >> - u32 ecmr; >> >> /* Receive frame limit set register */ >> ravb_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, RFLR); >> >> /* PAUSE prohibition */ >> - ecmr = ravb_read(ndev, ECMR); >> - ecmr &= ECMR_DM; > > Perhaps you misread as "ecmr &= ~ECMR_DM"? If it was so, there would be no point in patching... [...] > Gr{oetje,eeting}s, > > Geert MBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Index: net/drivers/net/ethernet/renesas/ravb_main.c =================================================================== --- net.orig/drivers/net/ethernet/renesas/ravb_main.c +++ net/drivers/net/ethernet/renesas/ravb_main.c @@ -338,16 +338,13 @@ error: static void ravb_emac_init(struct net_device *ndev) { struct ravb_private *priv = netdev_priv(ndev); - u32 ecmr; /* Receive frame limit set register */ ravb_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, RFLR); /* PAUSE prohibition */ - ecmr = ravb_read(ndev, ECMR); - ecmr &= ECMR_DM; - ecmr |= ECMR_ZPF | (priv->duplex ? ECMR_DM : 0) | ECMR_TE | ECMR_RE; - ravb_write(ndev, ecmr, ECMR); + ravb_write(ndev, ECMR_ZPF | (priv->duplex ? ECMR_DM : 0) | + ECMR_TE | ECMR_RE, ECMR); ravb_set_rate(ndev);
The code in ravb_emac_init() twiddling the ECMR bits always looked a bit strange to me: if one intends to respect 'priv->duplex', why save old value of the ECMR.DM bit? As all the other bits are zeroed anyway, we don't really need to read ECMR before writing to it. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> --- drivers/net/ethernet/renesas/ravb_main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html