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] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 26 Nov 2008 13:08:57 +0100 (CET)
From:	Geert Uytterhoeven <geert@...ux-m68k.org>
To:	Jaya Kumar <jayakumar.lkml@...il.com>
cc:	Paulius Zaleckas <paulius.zaleckas@...tonika.lt>,
	David Brownell <dbrownell@...rs.sourceforge.net>,
	linux-fbdev-devel@...ts.sourceforge.net,
	Haavard Skinnemoen <hskinnemoen@...el.com>,
	Greg KH <greg@...ah.com>, linux-kernel@...r.kernel.org,
	David Brownell <david-b@...bell.net>,
	Ben Gardner <bgardner@...tec.com>,
	Eric Miao <eric.miao@...vell.com>,
	Philipp Zabel <philipp.zabel@...il.com>,
	Sam Ravnborg <sam@...nborg.org>,
	linux-arm-kernel@...ts.arm.linux.org.uk,
	Russell King <rmk@....linux.org.uk>
Subject: Re: [Linux-fbdev-devel] [RFC 2.6.27 1/1] gpiolib: add support for
 batch set of pins

On Wed, 26 Nov 2008, Jaya Kumar wrote:
> On Wed, Nov 26, 2008 at 5:08 AM, Geert Uytterhoeven
> <geert@...ux-m68k.org> wrote:
> > On Wed, 26 Nov 2008, Jaya Kumar wrote:
> >> On Wed, Nov 26, 2008 at 4:09 AM, Paulius Zaleckas
> >> <paulius.zaleckas@...tonika.lt> wrote:
> >> > Jaya Kumar wrote:
> >> >>   * @to_irq: optional hook supporting non-static gpio_to_irq() mappings;
> >> >>   *   implementation may not sleep
> >> >>   * @dbg_show: optional routine to show contents in debugfs; default code
> >> >> @@ -84,6 +86,9 @@ struct gpio_chip {
> >> >>                                               unsigned offset, int value);
> >> >>       void                    (*set)(struct gpio_chip *chip,
> >> >>                                               unsigned offset, int value);
> >> >> +     void                    (*set_bus)(struct gpio_chip *chip,
> >> >> +                                             unsigned offset, int values,
> >> >
> >> > I think values should be unsigned
> >>
> >> Okay, can do but it is unusual no? since set uses int value, i figured
> >> set_bus should be similar right?
> >
> > ->set() sets one pin, right? So it's either 0 or 1.
> >
> > ->set_bus() sets multiple pins. With `int', it will fail for bit 31, as that's
> > the sign bit.
> 
> I'm not sure I understood this. I imagine the usage will be like
> 
> int values = 0x8000_0000;
> set_bus(..., start_pin, values);
> 
> write_32(register, values); // will still work to set bit 31

Tehcnically, it will work. But it's more confusing if it's int.

> (values >> 31) == 1;

However, be careful with shifts, as right shifts on signed values will
duplicate te sign bit.

> > Perhaps you even want u32, to make it clear what's the maximum number of pins
> > you can set in one shot?
> 
> Yes, I agree, I will change to use u32 as it is then explicit.

OK. Thx!

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
--
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