Re: [PATCH 2/2] sh_eth: factor out register bit twiddling code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sergei,

On Sun, Feb 7, 2016 at 8:30 PM, Sergei Shtylyov
<sergei.shtylyov@xxxxxxxxxxxxxxxxxx> wrote:
> --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
> +++ net-next/drivers/net/ethernet/renesas/sh_eth.c
> @@ -428,6 +428,13 @@ static u32 sh_eth_read(struct net_device
>         return ioread32(mdp->addr + offset);
>  }
>
> +static void sh_eth_modify(struct net_device *ndev, int enum_index, u32 mask,
> +                         u32 value)
> +{
> +       sh_eth_write(ndev, (sh_eth_read(ndev, enum_index) & ~mask) | value,
> +                    enum_index);
> +}

Same comment as for ravb:

Usually "mask"is used for the bits to keep, not for the bits to clear.

So I'd either
  1. AND with "mask" instead of "~mask", and update all callers, or
  2. rename "mask" to "clear", and "value" to "set".

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

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



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux