linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC][PATCH] gpiolib: add irq_wake (power-management) sysfs file
Date: Tue, 15 Nov 2011 17:20:53 +0000	[thread overview]
Message-ID: <20111115172053.GB9581@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20111115131636.GA31028@sirena.org.uk>

On Tue, Nov 15, 2011 at 01:16:37PM +0000, Mark Brown wrote:
> On Fri, Nov 11, 2011 at 10:40:06AM +0100, Patrick Combes wrote:
> > +	else if (sysfs_streq(buf, "enable") || sysfs_streq(buf, "1"))
> > +		status = enable_irq_wake(gpio_to_irq(gpio));
> > +	else if (sysfs_streq(buf, "disable") || sysfs_streq(buf, "0"))
> > +		status = disable_irq_wake(gpio_to_irq(gpio));
> > +	else
> > +		status = -EINVAL;
> 
> ...this doesn't do anything to stop userspace doing multiple enables and
> disables.

It doesn't check whether gpio_to_irq(gpio) returns something sane either.
It should be doing something like this before taking the mutex:

	irq = gpio_to_irq(gpio);
	if (irq <= 0)
		return irq < 0 ? irq : -EINVAL;

and then doing (enable|disable)_irq_wake() on irq.

  reply	other threads:[~2011-11-15 17:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-11  9:40 [RFC][PATCH] gpiolib: add irq_wake (power-management) sysfs file Patrick Combes
2011-11-15 13:16 ` Mark Brown
2011-11-15 17:20   ` Russell King - ARM Linux [this message]
2011-11-16 14:39     ` Patrick Combes
2011-11-16 14:30   ` Patrick Combes
2011-11-16 14:37     ` Mark Brown
2011-11-16 17:23       ` Patrick Combes
2011-11-21  7:47 ` Linus Walleij

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=20111115172053.GB9581@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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).