mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolas Pitre <nicolas.pitre@linaro.org>
To: Sangwook Lee <sangwook.lee@linaro.org>
Cc: cjb@laptop.org, linux-mmc@vger.kernel.org, per.forlin@linaro.org,
	linux-kernel@vger.kernel.org, patches@linaro.org
Subject: Re: [PATCH] mmc: sdio: optimization for process_sdio_pending_irq
Date: Fri, 9 Dec 2011 09:17:03 -0500 (EST)	[thread overview]
Message-ID: <alpine.LFD.2.02.1112090914170.2907@xanadu.home> (raw)
In-Reply-To: <1323433757-3811-1-git-send-email-sangwook.lee@linaro.org>

On Fri, 9 Dec 2011, Sangwook Lee wrote:

> Skip fillng in mmc_command struct for CCCR_INTx
> everytime sdio_irq_thread (process_sdio_pending_irqs)
> calls mmc_io_rw_direct.
> 
> Signed-off-by: Sangwook Lee <sangwook.lee@linaro.org>

Is there a real advantage doing this?

While you might be saving on a few stores, you are increasing code size 
and therefore i-cache miss probabilities.  So this is not clear to me 
this is actually a gain.

> ---
>  drivers/mmc/core/sdio_irq.c |    2 +-
>  drivers/mmc/core/sdio_ops.c |   40 ++++++++++++++++++++++++++++++++++++++++
>  drivers/mmc/core/sdio_ops.h |    1 +
>  3 files changed, 42 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
> index 68f81b9..67f782a 100644
> --- a/drivers/mmc/core/sdio_irq.c
> +++ b/drivers/mmc/core/sdio_irq.c
> @@ -44,7 +44,7 @@ static int process_sdio_pending_irqs(struct mmc_card *card)
>  		return 1;
>  	}
>  
> -	ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
> +	ret = mmc_io_rw_direct_irq(card, &pending);
>  	if (ret) {
>  		pr_debug("%s: error %d reading SDIO_CCCR_INTx\n",
>  		       mmc_card_id(card), ret);
> diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
> index b0517cc..c80fc32 100644
> --- a/drivers/mmc/core/sdio_ops.c
> +++ b/drivers/mmc/core/sdio_ops.c
> @@ -111,6 +111,46 @@ static int mmc_io_rw_direct_host(struct mmc_host *host, int write, unsigned fn,
>  	return 0;
>  }
>  
> +static struct mmc_command sdio_intx_cmd = {
> +	.opcode = SD_IO_RW_DIRECT,
> +	.arg = SDIO_CCCR_INTx << 9,
> +	.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC,
> +};
> +
> +int mmc_io_rw_direct_irq(struct mmc_card *card, u8 *out)
> +{
> +	int err;
> +	struct mmc_host *host ;
> +
> +	BUG_ON(!card);
> +	host = card->host;
> +	BUG_ON(!host);
> +
> +	err = mmc_wait_for_cmd(host, &sdio_intx_cmd, 0);
> +	if (err)
> +		return err;
> +
> +	if (mmc_host_is_spi(host)) {
> +		/* host driver already reported errors */
> +	} else {
> +		if (sdio_intx_cmd.resp[0] & R5_ERROR)
> +			return -EIO;
> +		if (sdio_intx_cmd.resp[0] & R5_FUNCTION_NUMBER)
> +			return -EINVAL;
> +		if (sdio_intx_cmd.resp[0] & R5_OUT_OF_RANGE)
> +			return -ERANGE;
> +	}
> +
> +	if (out) {
> +		if (mmc_host_is_spi(host))
> +			*out = (sdio_intx_cmd.resp[0] >> 8) & 0xFF;
> +		else
> +			*out = sdio_intx_cmd.resp[0] & 0xFF;
> +	}
> +
> +	return 0;
> +}
> +
>  int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
>  	unsigned addr, u8 in, u8 *out)
>  {
> diff --git a/drivers/mmc/core/sdio_ops.h b/drivers/mmc/core/sdio_ops.h
> index 12a4d3a..5fe8ad6 100644
> --- a/drivers/mmc/core/sdio_ops.h
> +++ b/drivers/mmc/core/sdio_ops.h
> @@ -15,6 +15,7 @@
>  int mmc_send_io_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
>  int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
>  	unsigned addr, u8 in, u8* out);
> +int mmc_io_rw_direct_irq(struct mmc_card *card, u8 *out);
>  int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
>  	unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz);
>  int sdio_reset(struct mmc_host *host);
> -- 
> 1.7.4.1
> 

      reply	other threads:[~2011-12-09 14:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-09 12:29 Sangwook Lee
2011-12-09 14:17 ` Nicolas Pitre [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=alpine.LFD.2.02.1112090914170.2907@xanadu.home \
    --to=nicolas.pitre@linaro.org \
    --cc=cjb@laptop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=per.forlin@linaro.org \
    --cc=sangwook.lee@linaro.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

all inboxes | Powered by JetHome®