[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <19985.59397.631201.89451@ipc1.ka-ro>
Date: Mon, 4 Jul 2011 18:19:17 +0200
From: Lothar Waßmann <LW@...O-electronics.de>
To: Grant Likely <grant.likely@...retlab.ca>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] add missing intialisation of bgc->dir
Hi,
Grant Likely writes:
> On Mon, Jul 4, 2011 at 9:51 AM, Lothar Waßmann <LW@...o-electronics.de> wrote:
> > Hi,
> >
> >> > > I don't know if this is a valid thing to do or not. Not every GPIO
> >> > > controller supports reading back the initial state from the direction
> >> > > register. I suspect it is better to leave initialization of the
> >> > > direction to the gpio controller driver itself.
> >> > >
> >> > That would mean, that external software would have to have access to
> >> > the bgpio internal data structures which is a Bad Thing(TM) IMO. Or we
> >> > need a function that allows to explicitly initialize the internal
> >> > shadow registers.
> >>
> >> What device are you using this for. Are you using the basic gpio
> >> platform_driver, or do you have a driver using the library part of the
> >> basic gpio code?
> >>
> > I'm using it via drivers/gpio/gpio-mxc.
>
> You can safely do the "bgc->dir = bgc->read_reg(bgc->reg_dir);" in
> gpio-mxc after bgpio_init returns.
>
I know I can do that, but IMO it's a horrible way of programming, to
let a higher SW layer freely mess with the data structures of another
SW layer. There should be accessor functions to do that!
Lothar Waßmann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info@...o-electronics.de
___________________________________________________________
--
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