linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: marex@denx.de (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] MXS-MMC: Add wp-inverted property
Date: Mon, 21 May 2012 04:38:20 +0200	[thread overview]
Message-ID: <201205210438.20794.marex@denx.de> (raw)
In-Reply-To: <20120521013915.GN5427@S2101-09.ap.freescale.net>

Dear Shawn Guo,

> Copy Chris and linux-mmc, as I assume that the patch should go via mmc
> tree after the merge window.
> 
> On Mon, May 21, 2012 at 03:02:20AM +0200, Marek Vasut wrote:
> > The write-protect GPIO is inverted on some boards. Handle such case.
> > 
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Acked-by: Shawn Guo <shawn.guo@linaro.org>
> 
> A coupe of nits though:
> 
> The subject prefix can better be "mmc: mxs-mmc: ".

Want me to resend it ?

> 
> > ---
> > 
> >  Documentation/devicetree/bindings/mmc/mxs-mmc.txt |    1 +
> >  drivers/mmc/host/mxs-mmc.c                        |   11 ++++++++++-
> >  2 files changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
> > b/Documentation/devicetree/bindings/mmc/mxs-mmc.txt index
> > 14d870a..0a7d2cd 100644
> > --- a/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
> > +++ b/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
> > 
> > @@ -13,6 +13,7 @@ Required properties:
> >  Optional properties:
> >  - wp-gpios: Specify GPIOs for write protection
> > 
> > +- wp-inverted: Set if the write protection GPIO is inverted
> > 
> >  Examples:
> > diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
> > index 277161d..119beb9 100644
> > --- a/drivers/mmc/host/mxs-mmc.c
> > +++ b/drivers/mmc/host/mxs-mmc.c
> > @@ -164,16 +164,23 @@ struct mxs_mmc_host {
> > 
> >  	spinlock_t			lock;
> >  	int				sdio_irq_en;
> >  	int				wp_gpio;
> > 
> > +	int				wp_inverted:1;
> > 
> >  };
> >  
> >  static int mxs_mmc_get_ro(struct mmc_host *mmc)
> >  {
> >  
> >  	struct mxs_mmc_host *host = mmc_priv(mmc);
> > 
> > +	int ret;
> > 
> >  	if (!gpio_is_valid(host->wp_gpio))
> >  	
> >  		return -EINVAL;
> > 
> > -	return gpio_get_value(host->wp_gpio);
> > +	ret = gpio_get_value(host->wp_gpio);
> > +
> > +	if (host->wp_inverted)
> > +		ret = !ret;
> > +
> > +	return ret;
> 
> The above lines can just be the one below?
> 
> 	return (host->wp_inverted) ? !ret : ret;

I'd prefer to avoid the ternary operator, it's more readable as it is.

> 
> >  }

Best regards,
Marek Vasut

  reply	other threads:[~2012-05-21  2:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-21  1:02 [PATCH 1/4] GPMI-NAND: Define ecc.strength Marek Vasut
2012-05-21  1:02 ` [PATCH 2/4] GPMI-NAND: Fixup compile issue Marek Vasut
2012-05-21  1:16   ` Shawn Guo
2012-05-21  1:02 ` [PATCH 3/4] MXS-MMC: Move of_match_table out of CONFIG_PM Marek Vasut
2012-05-21  4:09   ` Shawn Guo
2012-05-21  3:52     ` Chris Ball
2012-05-21  4:33       ` Marek Vasut
2012-05-21  1:02 ` [PATCH 4/4] MXS-MMC: Add wp-inverted property Marek Vasut
2012-05-21  1:39   ` Shawn Guo
2012-05-21  2:38     ` Marek Vasut [this message]
2012-05-21  2:48       ` Shawn Guo
2012-05-21  3:22         ` Chris Ball
2012-05-21  3:36           ` Marek Vasut
2012-05-21  7:22   ` Lothar Waßmann
2012-05-21 17:38     ` Marek Vasut
2012-05-21  1:14 ` [PATCH 1/4] GPMI-NAND: Define ecc.strength Shawn Guo
2012-05-21  1:36   ` Marek Vasut
2012-05-21  1:41     ` Shawn Guo
2012-05-21  2:40       ` Marek Vasut
2012-05-21  3:08         ` Huang Shijie
2012-05-21  3:48           ` Marek Vasut
2012-05-21  3:45         ` Shawn Guo
2012-05-21  3:39           ` Marek Vasut
2012-05-21  2:44       ` Huang Shijie
2012-05-21  3:43         ` Marek Vasut

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=201205210438.20794.marex@denx.de \
    --to=marex@denx.de \
    --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).