lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20091113134933.GH16033@parisc-linux.org>
Date:	Fri, 13 Nov 2009 06:49:33 -0700
From:	Matthew Wilcox <matthew@....cx>
To:	"Meng, Chen" <Chen.Meng@...driver.com>
Cc:	linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
	"Wallin, Anders" <Anders.Wallin@...driver.com>,
	"Feng, Xiaobing" <Xiaobing.Feng@...driver.com>,
	"Li, Li" <Li.Li@...driver.com>, giancarlo.asnaghi@...com
Subject: Re: [PATCH] GPIO driver for ST Microelectronics ConneXt
	(STA2X11/STA2X10), PCIe I/O Hub

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."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ