linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	linux-xtensa@linux-xtensa.org
Subject: Re: [PATCH] gpio: driver for Xtensa GPIO32
Date: Wed, 11 Dec 2013 14:38:54 +0200	[thread overview]
Message-ID: <20131211123854.GH1217@tarshish> (raw)
In-Reply-To: <CACRpkdZV-G8GSE7R+2cfriA0JxAhQz0nzsWOqMP9MEnzkrBVBg@mail.gmail.com>

Hi Linus,

On Wed, Dec 11, 2013 at 01:32:47PM +0100, Linus Walleij wrote:
> On Thu, Dec 5, 2013 at 6:43 AM, Baruch Siach <baruch@tkos.co.il> wrote:
> > We need to preserve the irq flags. Let me know if the following is OK:
> >
> > static inline unsigned long enable_cp(void)
> > {
> >         unsigned long flags, cpenable;
> >
> >         local_irq_save(flags);
> >         RSR_CPENABLE(cpenable);
> >         WSR_CPENABLE(cpenable | XCHAL_CP_PORT_MASK);
> >
> >         return flags;
> > }
> >
> > static inline void disable_cp(unsigned long flags)
> > {
> >         WSR_CPENABLE(cpenable);
> >         local_irq_restore(flags);
> > }
> 
> Looks OK.

Done in v2.

> >> > +static void xtensa_impwire_set_value(struct gpio_chip *gc, unsigned offset,
> >> > +                                   int value)
> >> > +{
> >> > +}
> >>
> >> This is a rather nasty implementation for something that will always
> >> fail. What about putting an dev_err(gc->dev, "..."); in that set_value?
> >
> > This is an input only device, so this callback should never run. Ideally it
> > would be nice to just have it NULL, but the core gpiolib doesn't support that.
> > Are you sure bloating the kernel with an error message that never displays is
> > worth it?
> 
> Yes I am sure. If you think a few lines of error message is too much,
> you can add a BUG(); here instead.

Will do in v3.

> >> Why not device_initcall()? (i.e. same as module_init())
> >> Do you need it very early?
> >
> > The main use case for this driver is for intra-core signaling, so it might be
> > needed quite early I guess. I don't need any specific need for it to be
> > available early at the moment, so I can change it device_initcall() if you
> > prefer that.
> 
> Please do that for now, thanks. We shouldn't stick strange stuff
> in because "may need later", as this can lead to weird stuff that people
> don't dare to change. (Cargo-cult phenomenon.)

Done in v2.

Thanks,
baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

      reply	other threads:[~2013-12-11 12:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03  8:04 [PATCH] gpio: driver for Xtensa GPIO32 Baruch Siach
2013-12-04 13:18 ` Linus Walleij
2013-12-05  5:43   ` Baruch Siach
2013-12-11 12:32     ` Linus Walleij
2013-12-11 12:38       ` Baruch Siach [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=20131211123854.GH1217@tarshish \
    --to=baruch@tkos.co.il \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.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;
as well as URLs for NNTP newsgroup(s).