All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-m68k@vger.kernel.org, David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	"open list:MEMORY TECHNOLOGY..." <linux-mtd@lists.infradead.org>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] m68k: Implement ndelay() as an inline function to force type checking/casting
Date: Mon, 14 May 2018 01:38:15 +0300	[thread overview]
Message-ID: <CAHp75Veu2Uapp-=ATL7v7uscsP+46eYcRi7MEoLt_QPR4BLZOQ@mail.gmail.com> (raw)
In-Reply-To: <20180513140212.3961-1-boris.brezillon@bootlin.com>

On Sun, May 13, 2018 at 5:02 PM, Boris Brezillon
<boris.brezillon@bootlin.com> wrote:
> ndelay() is supposed to take an unsigned long, but if you define
> ndelay() as a macro and the caller pass an unsigned long long instead
> of an unsigned long, the unsigned long long to unsigned long cast is
> not done and we end up with an "undefined reference to `__udivdi3'"
> error at link time.

> -#define ndelay(n) __delay(DIV_ROUND_UP((n) * ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6), 1000))
> +static inline void ndelay(unsigned long nsec)
> +{
> +       __delay(DIV_ROUND_UP(nsec *
> +                            ((((HZSCALE) >> 11) *

One pair of parens is redundant.

> +                              (loops_per_jiffy >> 11)) >> 6),
> +                            1000));

Can't you keep as one line as in original?

> +}
> +#define ndelay(n) ndelay(n)
>
>  #endif /* defined(_M68K_DELAY_H) */
> --
> 2.14.1
>



-- 
With Best Regards,
Andy Shevchenko

WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-m68k@lists.linux-m68k.org,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	"open list:MEMORY TECHNOLOGY..." <linux-mtd@lists.infradead.org>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] m68k: Implement ndelay() as an inline function to force type checking/casting
Date: Mon, 14 May 2018 01:38:15 +0300	[thread overview]
Message-ID: <CAHp75Veu2Uapp-=ATL7v7uscsP+46eYcRi7MEoLt_QPR4BLZOQ@mail.gmail.com> (raw)
In-Reply-To: <20180513140212.3961-1-boris.brezillon@bootlin.com>

On Sun, May 13, 2018 at 5:02 PM, Boris Brezillon
<boris.brezillon@bootlin.com> wrote:
> ndelay() is supposed to take an unsigned long, but if you define
> ndelay() as a macro and the caller pass an unsigned long long instead
> of an unsigned long, the unsigned long long to unsigned long cast is
> not done and we end up with an "undefined reference to `__udivdi3'"
> error at link time.

> -#define ndelay(n) __delay(DIV_ROUND_UP((n) * ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6), 1000))
> +static inline void ndelay(unsigned long nsec)
> +{
> +       __delay(DIV_ROUND_UP(nsec *
> +                            ((((HZSCALE) >> 11) *

One pair of parens is redundant.

> +                              (loops_per_jiffy >> 11)) >> 6),
> +                            1000));

Can't you keep as one line as in original?

> +}
> +#define ndelay(n) ndelay(n)
>
>  #endif /* defined(_M68K_DELAY_H) */
> --
> 2.14.1
>



-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2018-05-13 22:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-13 14:02 [PATCH] m68k: Implement ndelay() as an inline function to force type checking/casting Boris Brezillon
2018-05-13 14:02 ` Boris Brezillon
2018-05-13 22:38 ` Andy Shevchenko [this message]
2018-05-13 22:38   ` Andy Shevchenko
2018-05-14  7:23 ` Miquel Raynal
2018-05-14  7:23   ` Miquel Raynal
2018-05-14  9:29 ` Geert Uytterhoeven
2018-05-14  9:29   ` Geert Uytterhoeven
2018-05-14 10:52   ` Geert Uytterhoeven
2018-05-14 10:52     ` 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='CAHp75Veu2Uapp-=ATL7v7uscsP+46eYcRi7MEoLt_QPR4BLZOQ@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    /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.