All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 1/2] ravb: factor out register bit twiddling code
Date: Sun, 7 Feb 2016 23:58:39 +0300	[thread overview]
Message-ID: <56B7AFFF.1060005@cogentembedded.com> (raw)
In-Reply-To: <CAMuHMdUSepk+9sdp0tXGoVa4Bz2Xjc8hPbxbyS9PwO78gmLe+w@mail.gmail.com>

Hello.

On 02/07/2016 11:48 PM, Geert Uytterhoeven 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@cogentembedded.com>
>> + * Copyright (C) 2015-2016 Cogent Embedded, Inc. <source@cogentembedded.com>
>>    *
>>    * 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".

    I'll go with the 2nd option.

> Gr{oetje,eeting}s,
>
>                          Geert

MBR, Sergei

  reply	other threads:[~2016-02-07 20:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-07 19:29 [PATCH 0/2] Factor out register bit twiddling in the Renesas Ethernet drivers Sergei Shtylyov
2016-02-07 19:30 ` [PATCH 1/2] ravb: factor out register bit twiddling code Sergei Shtylyov
2016-02-07 20:48   ` Geert Uytterhoeven
2016-02-07 20:58     ` Sergei Shtylyov [this message]
2016-02-07 19:30 ` [PATCH 2/2] sh_eth: " Sergei Shtylyov
2016-02-07 20:49   ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56B7AFFF.1060005@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.