From: David Jander <david@protonic.nl>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org,
Wolfgang Grandegger <wg@grandegger.com>,
Alexander Stein <alexander.stein@systec-electronic.com>
Subject: Re: [PATCH 02/14] can: rx-fifo: Increase MB size limit from 32 to 64
Date: Thu, 6 Nov 2014 17:03:30 +0100 [thread overview]
Message-ID: <20141106170330.54b6ed7e@archvile> (raw)
In-Reply-To: <545B3457.9030207@pengutronix.de>
On Thu, 06 Nov 2014 09:41:59 +0100
Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> On 11/06/2014 09:34 AM, David Jander wrote:
> > Signed-off-by: David Jander <david@protonic.nl>
> > ---
> > drivers/net/can/dev.c | 24 ++++++++++++------------
> > include/linux/can/dev.h | 12 ++++++------
> > 2 files changed, 18 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
> > index c1e53e9..930b9f4 100644
> > --- a/drivers/net/can/dev.c
> > +++ b/drivers/net/can/dev.c
> > @@ -289,20 +289,20 @@ static unsigned int can_rx_fifo_inc(struct
> > can_rx_fifo *fifo, unsigned int *val) return (*val)--;
> > }
> >
> > -static u32 can_rx_fifo_mask_low(struct can_rx_fifo *fifo)
> > +static u64 can_rx_fifo_mask_low(struct can_rx_fifo *fifo)
> > {
> > if (fifo->inc)
> > - return ~0U >> (32 + fifo->low_first - fifo->high_first)
> > << fifo->low_first;
> > + return ~0LLU >> (64 + fifo->low_first - fifo->high_first)
> > << fifo->low_first; else
> > - return ~0U >> (32 - fifo->low_first + fifo->high_first)
> > << (fifo->high_first + 1);
> > + return ~0LLU >> (64 - fifo->low_first + fifo->high_first)
> > << (fifo->high_first + 1);
>
> Yesterday I stumbled over GENMASK_ULL
> http://lxr.free-electrons.com/source/include/linux/bitops.h#L22
> Does it make sense to use it here?
Looks like its exactly what is needed here.... nice.
Btw, there is a subtle bug in the line you linked to:
> #define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l))
The _ULL in the name of the macro seems to hint to "unsigned long long", while
the implementation seems to assume that it means U64_C. This is obviously
wrong, although for most platforms that are currently capable of running
Linux, those are probably equivalent...
Funny.
Best regards,
--
David Jander
Protonic Holland.
next prev parent reply other threads:[~2014-11-06 16:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-06 8:33 [PATCH V4 00/14] CAN: Add rx-fifo support and port flexcan to it David Jander
2014-11-06 8:34 ` [PATCH 01/14] can: dev: add preliminary rx-fifo David Jander
2014-11-06 8:34 ` [PATCH 02/14] can: rx-fifo: Increase MB size limit from 32 to 64 David Jander
2014-11-06 8:41 ` Marc Kleine-Budde
2014-11-06 16:03 ` David Jander [this message]
2014-11-06 16:05 ` Marc Kleine-Budde
2014-11-06 16:20 ` David Jander
2014-11-07 8:40 ` Marc Kleine-Budde
2014-11-07 10:28 ` David Jander
2014-11-06 8:34 ` [PATCH 03/14] can: rx-fifo: Change to do controller off-load in interrupt and NAPI poll David Jander
2014-11-10 11:00 ` David Jander
2014-11-06 8:34 ` [PATCH 04/14] can: rx-fifo: fix long lines David Jander
2014-11-06 8:34 ` [PATCH 05/14] can: rx-fifo: Add can_rx_fifo_reset() function David Jander
2014-11-06 8:34 ` [PATCH 06/14] can: rx-fifo: remove obsolete comment David Jander
2014-11-06 8:34 ` [PATCH 07/14] can: rx-fifo: Add support for can state tracking and error polling David Jander
2014-11-06 8:34 ` [PATCH 08/14] can: rx-fifo: Add support for simple irq offloading David Jander
2014-11-06 8:34 ` [PATCH 09/14] can: rx-fifo: Add documentation to struct can_rx_fifo David Jander
2014-11-06 8:34 ` [PATCH 10/14] can: flexcan: add documentation about mailbox organizaiton David Jander
2014-11-06 8:34 ` [PATCH 11/14] can: flexcan: rename crl2 -> ctrl2 David Jander
2014-11-06 8:34 ` [PATCH 12/14] can: flexcan: replace open coded mailbox code by proper defines David Jander
2014-11-06 8:34 ` [PATCH 13/14] can: flexcan: Add support for RX-FIFO David Jander
2014-11-06 8:34 ` [PATCH 14/14] can: flexcan: Add MB/Fifo specific column to comment table of IP versions David Jander
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=20141106170330.54b6ed7e@archvile \
--to=david@protonic.nl \
--cc=alexander.stein@systec-electronic.com \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=wg@grandegger.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;
as well as URLs for NNTP newsgroup(s).