All of lore.kernel.org
 help / color / mirror / Atom feed
From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] gpio: Add simple poweroff-gpio driver
Date: Thu, 3 May 2012 10:48:25 +0200	[thread overview]
Message-ID: <20120503084825.GD13023@lunn.ch> (raw)
In-Reply-To: <1336033446-18949-1-git-send-email-jm@lentin.co.uk>

> The main issue is where to put it. I'm not convinced that drivers/gpio
> is an appropriate home, however drivers/power and drivers/hwmon (where
> drivers with similar purpose live) contain frameworks this is not part
> of. drivers/mfd has some modules that can power off, but this is hardly
> multifunction :) Could also give in and use drivers/misc.
> 
> Feedback appreciated.

Humm, sorry, no idea...

> +static int __devinit gpio_poweroff_probe(struct platform_device *pdev)
> +{
> +	enum of_gpio_flags flags;
> +
> +	gpio_num = of_get_gpio_flags(pdev->dev.of_node, 0, &flags);
> +	if (gpio_num < 0) {
> +		pr_err("%s: Could not get GPIO configuration: %d",
> +		       __func__, gpio_num);
> +		return -ENODEV;
> +	}
> +	gpio_active_low = flags & OF_GPIO_ACTIVE_LOW;

If you look at the Kirkwood/Orion5x, most systems that could use this
are currently not DT enabled. So i think it needs old style
platform_data as well as OF.

> +static int __devexit gpio_poweroff_remove(struct platform_device *pdev)
> +{
> +	if (gpio_num)
> +		gpio_free(gpio_num);

GPIO 0 is a valid GPIO number. You should not need this check, since
if the probe function succeeded, you have a valid GPIO.

    Andrew

  reply	other threads:[~2012-05-03  8:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120501172042.GA13233@lunn.ch>
2012-05-01 18:34 ` [PATCH 1/1] ARM: kirkwood: Add support for RaidSonic Jamie Lentin
2012-05-01 19:56   ` Andrew Lunn
2012-05-02 13:29     ` Jamie Lentin
2012-05-02 21:31       ` Simon Baatz
2012-05-03 12:14         ` Andrew Lunn
2012-05-03  8:24     ` [PATCH] gpio: Add simple poweroff-gpio driver Jamie Lentin
2012-05-03  8:48       ` Andrew Lunn [this message]
2012-05-03 10:09         ` Jamie Lentin
2012-05-03 10:26           ` Andrew Lunn
2012-05-03  8:50       ` Andrew Lunn
2012-05-03 11:21       ` Luka Perkov
2012-05-03 13:00       ` Russell King - ARM Linux

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=20120503084825.GD13023@lunn.ch \
    --to=andrew@lunn.ch \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.