public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Bart Van Assche <Bart.VanAssche@sandisk.com>
Cc: Joe Perches <joe@perches.com>,
	"eugenia@mellanox.com" <eugenia@mellanox.com>,
	"dan.carpenter@oracle.com" <dan.carpenter@oracle.com>,
	"yishaih@mellanox.com" <yishaih@mellanox.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: [patch] net/mlx4: && vs & typo
Date: Wed, 01 Mar 2017 06:52:01 +0000	[thread overview]
Message-ID: <alpine.DEB.2.20.1703010746230.2079@hadrien> (raw)
In-Reply-To: <1D08B61A9CF0974AA09887BE32D889DA0C193A@ULS-OP-MBXIP03.sdcorp.global.sandisk.com>

On Tue, 28 Feb 2017, Bart Van Assche wrote:

> On 02/28/2017 02:23 PM, Joe Perches wrote:
> > On Tue, 2017-02-28 at 15:35 +0000, Bart Van Assche wrote:
> >> On Tue, 2017-02-28 at 15:02 +0300, Dan Carpenter wrote:
> >>> Bitwise & was obviously intended here.
> > []
> >>> diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
> > []
> >>> @@ -109,7 +109,7 @@ static inline void 	(u8 *addr, u64 mac)
> >>>  	int i;
> >>>
> >>>  	for (i = ETH_ALEN; i > 0; i--) {
> >>> -		addr[i - 1] = mac && 0xFF;
> >>> +		addr[i - 1] = mac & 0xFF;
> >>>  		mac >>= 8;
> >>>  	}
> >>>  }
> >>
> >> Is this the only place where such a loop occurs?
> >
> > Seems to be.
> >
> >> Should a put_unaligned_be48()
> >> function be introduced?
> >
> > Why?  This is used exactly once.
>
> Really? Here is an example of another open-coded version of
> put_unaligned_be48() from arch/mips/cavium-octeon/octeon-platform.c:
>
> 	new_mac[0] = (mac >> 40) & 0xff;
> 	new_mac[1] = (mac >> 32) & 0xff;
> 	new_mac[2] = (mac >> 24) & 0xff;
> 	new_mac[3] = (mac >> 16) & 0xff;
> 	new_mac[4] = (mac >> 8) & 0xff;
> 	new_mac[5] = mac & 0xff;

drivers/media/radio/radio-shark2.c:
        for (i = 0; i < 6; i++)
               shark->transfer_buffer[i + 1] = (reg >> (40 - i * 8)) & 0xff;

drivers/rtc/rtc-ab3100.c
       buf[0] = (hw_counter) & 0xFF;
       buf[1] = (hw_counter >> 8) & 0xFF;
       buf[2] = (hw_counter >> 16) & 0xFF;
       buf[3] = (hw_counter >> 24) & 0xFF;
       buf[4] = (hw_counter >> 32) & 0xFF;
       buf[5] = (hw_counter >> 40) & 0xFF;

drivers/net/ethernet/sun/ldmvsw.c
        for (i = 0; i < ETH_ALEN; i++)
               port->raddr[i] = (*rmac >> (5 - i) * 8) & 0xff;

drivers/net/ethernet/sun/sunvnet.c
        for (i = 0; i < ETH_ALEN; i++)
               dev->dev_addr[i] = (*local_mac >> (5 - i) * 8) & 0xff;

        for (i = 0; i < ETH_ALEN; i++)
               port->raddr[i] = (*rmac >> (5 - i) * 8) & 0xff;

julia

>
> Bart.
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2017-03-01  6:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 12:02 [patch] net/mlx4: && vs & typo Dan Carpenter
2017-02-28 15:35 ` Bart Van Assche
     [not found]   ` <1488296129.3056.1.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-02-28 22:23     ` Joe Perches
2017-02-28 22:45       ` Bart Van Assche
2017-03-01  6:52         ` Julia Lawall [this message]
2017-03-01  8:34           ` Tariq Toukan
2017-02-28 16:53 ` Tariq Toukan
2017-03-01 17:52 ` David Miller

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=alpine.DEB.2.20.1703010746230.2079@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=Bart.VanAssche@sandisk.com \
    --cc=dan.carpenter@oracle.com \
    --cc=eugenia@mellanox.com \
    --cc=joe@perches.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yishaih@mellanox.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox