From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] add missing intialisation of bgc->dir
Date: Mon, 4 Jul 2011 18:19:17 +0200 [thread overview]
Message-ID: <19985.59397.631201.89451@ipc1.ka-ro> (raw)
In-Reply-To: <CACxGe6v87WboQwZn9L0QtND2=B6g6ScQcPgTPnU_2whn=-B9HA@mail.gmail.com>
Hi,
Grant Likely writes:
> On Mon, Jul 4, 2011 at 9:51 AM, Lothar Waßmann <LW@karo-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@karo-electronics.de
___________________________________________________________
prev parent reply other threads:[~2011-07-04 16:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-01 12:08 [BUGFIX][PATCH] gpiolib: add missing initialisation " Lothar Waßmann
2011-07-01 12:08 ` [PATCH] add missing intialisation " Lothar Waßmann
2011-07-04 6:48 ` Grant Likely
2011-07-04 9:37 ` Lothar Waßmann
2011-07-04 15:39 ` Grant Likely
2011-07-04 15:51 ` Lothar Waßmann
2011-07-04 16:00 ` Grant Likely
2011-07-04 16:19 ` Lothar Waßmann [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=19985.59397.631201.89451@ipc1.ka-ro \
--to=lw@karo-electronics.de \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®