Re: [PATCH 1/2] ravb: 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/ravb_main.c
> +++ net-next/drivers/net/ethernet/renesas/ravb_main.c
> @@ -2,7 +2,7 @@
>   *
>   * Copyright (C) 2014-2015 Renesas Electronics Corporation
>   * Copyright (C) 2015 Renesas Solutions Corp.
> - * Copyright (C) 2015 Cogent Embedded, Inc. <source@xxxxxxxxxxxxxxxxxx>
> + * Copyright (C) 2015-2016 Cogent Embedded, Inc. <source@xxxxxxxxxxxxxxxxxx>
>   *
>   * Based on the SuperH Ethernet driver
>   *
> @@ -42,6 +42,12 @@
>                  NETIF_MSG_RX_ERR | \
>                  NETIF_MSG_TX_ERR)
>
> +void ravb_modify(struct net_device *ndev, enum ravb_reg reg, u32 mask,
> +                u32 value)
> +{
> +       ravb_write(ndev, (ravb_read(ndev, reg) & ~mask) | value, reg);
> +}

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