From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH 01/13 v2] sh: ecovec: switch MMC power control to regulators
Date: Wed, 27 Jun 2012 00:49:10 +0000 [thread overview]
Message-ID: <20120627004910.GG24033@linux-sh.org> (raw)
In-Reply-To: <1340751009-18663-2-git-send-email-g.liakhovetski@gmx.de>
On Wed, Jun 27, 2012 at 12:49:57AM +0200, Guennadi Liakhovetski wrote:
> Power on the CN11 and CN12 SD/MMC slots on ecovec is controlled by GPIOs,
> which makes it possible to use the fixed voltage regulator driver to switch
> card power on and off.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>
> v2: request the SD/MMC power-switching GPIO not in the board initialisation
> routine, but in the .set_pwr() callback similar to ag5evm.
>
That looks fine, but..
> static void sdhi0_set_pwr(struct platform_device *pdev, int state)
> {
> + static int power_gpio = -EINVAL;
> +
> + if (power_gpio < 0) {
> + int ret = gpio_request(GPIO_PTB6, NULL);
> + if (!ret) {
> + power_gpio = GPIO_PTB6;
> + gpio_direction_output(power_gpio, 0);
> + }
You do have the platform device available here, so there's no reason to
have a NULL label for gpio_request(). Even just wrapping to dev_name()
will be more helpful.
> -#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
> -/* SDHI1 */
> -static void sdhi1_set_pwr(struct platform_device *pdev, int state)
> +static void cn12_set_pwr(struct platform_device *pdev, int state)
> {
> + static int power_gpio = -EINVAL;
> +
> + if (power_gpio < 0) {
> + int ret = gpio_request(GPIO_PTB7, NULL);
Likewise.
next prev parent reply other threads:[~2012-06-27 0:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-26 22:49 [PATCH 01/13 v2] sh: ecovec: switch MMC power control to regulators Guennadi Liakhovetski
2012-06-27 0:49 ` Paul Mundt [this message]
2012-06-28 9:05 ` Paul Mundt
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=20120627004910.GG24033@linux-sh.org \
--to=lethal@linux-sh.org \
--cc=linux-sh@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