From: Matthew Wilcox <matthew@wil.cx>
To: "Meng, Chen" <Chen.Meng@windriver.com>
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, "Wallin,
Anders" <Anders.Wallin@windriver.com>,
"Feng, Xiaobing" <Xiaobing.Feng@windriver.com>,
"Li, Li" <Li.Li@windriver.com>,
giancarlo.asnaghi@st.com
Subject: Re: [PATCH] GPIO driver for ST Microelectronics ConneXt (STA2X11/STA2X10), PCIe I/O Hub
Date: Fri, 13 Nov 2009 06:49:33 -0700 [thread overview]
Message-ID: <20091113134933.GH16033@parisc-linux.org> (raw)
In-Reply-To: <D87B22B1FE8C0F479CA9BEAD6C25AAE8043659AF@ism-mail03.corp.ad.wrs.com>
On Fri, Nov 13, 2009 at 01:23:26PM +0100, Meng, Chen wrote:
> This patch is a GPIO driver for ST Microelectronics ConneXt
> (STA2X11/STA2X10), PCIe I/O Hub.
> It's derived from pl061.c and compatible with GPIOLIB.
You really need to run this driver through scripts/Lindent ...
> +#define ppwrite(dat, base, adr) writel((dat), (base) + (adr))
> +#define ppread(base, adr) readl((base) + (adr))
Why not just use readl and writel directly?
> +int pl061_pci_gpio_request(struct gpio_chip *gpio, unsigned nr) {
> + struct pl061_pci *pp = container_of(gpio, struct pl061_pci, gpio);
> + u32 flag = 1 << (nr % PINS_PER_CHIP);
> + u32 *mutex = &pp->mutex[nr / PINS_PER_CHIP];
> +
> + if (nr >= gpio->ngpio)
> + return -EINVAL;
> + if ((*mutex) & flag)
> + return -EBUSY;
> +
> + *mutex |= flag;
> +
> + return 0;
> +}
gpiolib calls chip->request without a lock held, so you need some locking
to protect pp->mutex.
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
prev parent reply other threads:[~2009-11-13 13:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-13 12:23 [PATCH] GPIO driver for ST Microelectronics ConneXt (STA2X11/STA2X10), PCIe I/O Hub Meng, Chen
2009-11-13 13:49 ` Matthew Wilcox [this message]
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=20091113134933.GH16033@parisc-linux.org \
--to=matthew@wil.cx \
--cc=Anders.Wallin@windriver.com \
--cc=Chen.Meng@windriver.com \
--cc=Li.Li@windriver.com \
--cc=Xiaobing.Feng@windriver.com \
--cc=giancarlo.asnaghi@st.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox