archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <>
To: JaeJoon Jung <>
Cc:,,,,, Yash Shah <>,
	Palmer Dabbelt <>,,,
	Paul Walmsley <>,
	linux-riscv <>
Subject: Re: [PATCH] gpio/sifive: fix static checker warning
Date: Wed, 29 Jan 2020 09:12:08 +0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>


On 2020-01-29 01:27, JaeJoon Jung wrote:
> Because SiFive FU540 GPIO Registers are aligned 32-bit,
> I think that irq_state is good "unsigned int" than "unsigned long".
> I refer to SiFive FU540-C000 Manual v1p0 (GPIO Register Table 103)
> as "Only naturally aligned 32-bit memory accesses are supported"

You realize that we're talking about variables here, and not hardware
registers, right?

> when you use assign_bit(offset, &chip->irq_state, 1),
> offset is 32-bit.

And? assign_bit takes an "unsigned long *" as a parameter. irrespective
of the size of long on a given architecture, by the way.

> I prefer to use bit operation instead of assign_bit().
> u32 bit = BIT(offset);
> chip->irq_state |= bit;

which is not what assign_bit() does.

> If you use this code, you do not use the assign_bit() and
> need not change irq_state data type.

Or we can use the correct API and not introduce additional bugs, which
your suggestion above would lead to.

> There are many improvements in my works for drivers/gpio/gpio-sifive.c.
> I hope to check my attached source file.

That's not how we submit patches to the Linux kernel. I suggest you
read the documentation on how to do this.


Jazz is not dead. It just smells funny...

  reply	other threads:[~2020-01-29  9:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-28  5:24 [PATCH] gpio/sifive: fix static checker warning Yash Shah
2020-01-28 13:21 ` Marc Zyngier
2020-01-29  1:27   ` JaeJoon Jung
2020-01-29  9:12     ` Marc Zyngier [this message]
2020-01-29 10:02   ` Linus Walleij
2020-02-10 12:55 ` Linus Walleij
2020-02-10 17:59 ` Palmer Dabbelt

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* 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).