All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: Thomas Abraham <thomas.abraham@linaro.org>
Cc: linux-mmc@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	cjb@laptop.org, kgene.kim@samsung.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, will.newton@gmail.com,
	jh80.chung@samsung.com, tgih.jun@samsung.com,
	dianders@google.com
Subject: Re: [PATCH] mmc: dw_mmc: make multiple instances of dw_mci_card_workqueue
Date: Wed, 02 May 2012 12:07:59 +0900	[thread overview]
Message-ID: <4FA0A50F.4020400@samsung.com> (raw)
In-Reply-To: <1335909456-14020-1-git-send-email-thomas.abraham@linaro.org>

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

On 05/02/2012 06:57 AM, Thomas Abraham wrote:

> The variable 'dw_mci_card_workqueue' is a global variable shared between
> multiple instances of the dw_mmc host controller. Due to this, data
> corruption has been noticed when multiple instances of dw_mmc controllers
> are actively reading/writing the media. Fix this by adding a instance
> of 'struct workqueue_struct' for each host instance and removing the
> global 'dw_mci_card_workqueue' instance.
> 
> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
> ---
>  drivers/mmc/host/dw_mmc.c  |   14 ++++++--------
>  include/linux/mmc/dw_mmc.h |    1 +
>  2 files changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index ab3fc46..1532357 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -100,8 +100,6 @@ struct dw_mci_slot {
>  	int			last_detect_state;
>  };
>  
> -static struct workqueue_struct *dw_mci_card_workqueue;
> -
>  #if defined(CONFIG_DEBUG_FS)
>  static int dw_mci_req_show(struct seq_file *s, void *v)
>  {
> @@ -1605,7 +1603,7 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
>  
>  		if (pending & SDMMC_INT_CD) {
>  			mci_writel(host, RINTSTS, SDMMC_INT_CD);
> -			queue_work(dw_mci_card_workqueue, &host->card_work);
> +			queue_work(host->card_workqueue, &host->card_work);
>  		}
>  
>  		/* Handle SDIO Interrupts */
> @@ -1844,7 +1842,7 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id)
>  	 * Card may have been plugged in prior to boot so we
>  	 * need to run the detect tasklet
>  	 */
> -	queue_work(dw_mci_card_workqueue, &host->card_work);
> +	queue_work(host->card_workqueue, &host->card_work);
>  
>  	return 0;
>  }
> @@ -2021,9 +2019,9 @@ int dw_mci_probe(struct dw_mci *host)
>  	mci_writel(host, CLKSRC, 0);
>  
>  	tasklet_init(&host->tasklet, dw_mci_tasklet_func, (unsigned long)host);
> -	dw_mci_card_workqueue = alloc_workqueue("dw-mci-card",
> +	host->card_workqueue = alloc_workqueue("dw-mci-card",
>  			WQ_MEM_RECLAIM | WQ_NON_REENTRANT, 1);
> -	if (!dw_mci_card_workqueue)
> +	if (!host->card_workqueue)
>  		goto err_dmaunmap;
>  	INIT_WORK(&host->card_work, dw_mci_work_routine_card);
>  	ret = request_irq(host->irq, dw_mci_interrupt, host->irq_flags, "dw-mci", host);
> @@ -2085,7 +2083,7 @@ err_init_slot:
>  	free_irq(host->irq, host);
>  
>  err_workqueue:
> -	destroy_workqueue(dw_mci_card_workqueue);
> +	destroy_workqueue(host->card_workqueue);
>  
>  err_dmaunmap:
>  	if (host->use_dma && host->dma_ops->exit)
> @@ -2119,7 +2117,7 @@ void dw_mci_remove(struct dw_mci *host)
>  	mci_writel(host, CLKSRC, 0);
>  
>  	free_irq(host->irq, host);
> -	destroy_workqueue(dw_mci_card_workqueue);
> +	destroy_workqueue(host->card_workqueue);
>  	dma_free_coherent(&host->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
>  
>  	if (host->use_dma && host->dma_ops->exit)
> diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
> index 8f66e28..7a7ebd3 100644
> --- a/include/linux/mmc/dw_mmc.h
> +++ b/include/linux/mmc/dw_mmc.h
> @@ -125,6 +125,7 @@ struct dw_mci {
>  	struct mmc_request	*mrq;
>  	struct mmc_command	*cmd;
>  	struct mmc_data		*data;
> +	struct workqueue_struct	*card_workqueue;
>  
>  	/* DMA interface members*/
>  	int			use_dma;



WARNING: multiple messages have this Message-ID (diff)
From: jh80.chung@samsung.com (Jaehoon Chung)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mmc: dw_mmc: make multiple instances of dw_mci_card_workqueue
Date: Wed, 02 May 2012 12:07:59 +0900	[thread overview]
Message-ID: <4FA0A50F.4020400@samsung.com> (raw)
In-Reply-To: <1335909456-14020-1-git-send-email-thomas.abraham@linaro.org>

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

On 05/02/2012 06:57 AM, Thomas Abraham wrote:

> The variable 'dw_mci_card_workqueue' is a global variable shared between
> multiple instances of the dw_mmc host controller. Due to this, data
> corruption has been noticed when multiple instances of dw_mmc controllers
> are actively reading/writing the media. Fix this by adding a instance
> of 'struct workqueue_struct' for each host instance and removing the
> global 'dw_mci_card_workqueue' instance.
> 
> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
> ---
>  drivers/mmc/host/dw_mmc.c  |   14 ++++++--------
>  include/linux/mmc/dw_mmc.h |    1 +
>  2 files changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index ab3fc46..1532357 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -100,8 +100,6 @@ struct dw_mci_slot {
>  	int			last_detect_state;
>  };
>  
> -static struct workqueue_struct *dw_mci_card_workqueue;
> -
>  #if defined(CONFIG_DEBUG_FS)
>  static int dw_mci_req_show(struct seq_file *s, void *v)
>  {
> @@ -1605,7 +1603,7 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
>  
>  		if (pending & SDMMC_INT_CD) {
>  			mci_writel(host, RINTSTS, SDMMC_INT_CD);
> -			queue_work(dw_mci_card_workqueue, &host->card_work);
> +			queue_work(host->card_workqueue, &host->card_work);
>  		}
>  
>  		/* Handle SDIO Interrupts */
> @@ -1844,7 +1842,7 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id)
>  	 * Card may have been plugged in prior to boot so we
>  	 * need to run the detect tasklet
>  	 */
> -	queue_work(dw_mci_card_workqueue, &host->card_work);
> +	queue_work(host->card_workqueue, &host->card_work);
>  
>  	return 0;
>  }
> @@ -2021,9 +2019,9 @@ int dw_mci_probe(struct dw_mci *host)
>  	mci_writel(host, CLKSRC, 0);
>  
>  	tasklet_init(&host->tasklet, dw_mci_tasklet_func, (unsigned long)host);
> -	dw_mci_card_workqueue = alloc_workqueue("dw-mci-card",
> +	host->card_workqueue = alloc_workqueue("dw-mci-card",
>  			WQ_MEM_RECLAIM | WQ_NON_REENTRANT, 1);
> -	if (!dw_mci_card_workqueue)
> +	if (!host->card_workqueue)
>  		goto err_dmaunmap;
>  	INIT_WORK(&host->card_work, dw_mci_work_routine_card);
>  	ret = request_irq(host->irq, dw_mci_interrupt, host->irq_flags, "dw-mci", host);
> @@ -2085,7 +2083,7 @@ err_init_slot:
>  	free_irq(host->irq, host);
>  
>  err_workqueue:
> -	destroy_workqueue(dw_mci_card_workqueue);
> +	destroy_workqueue(host->card_workqueue);
>  
>  err_dmaunmap:
>  	if (host->use_dma && host->dma_ops->exit)
> @@ -2119,7 +2117,7 @@ void dw_mci_remove(struct dw_mci *host)
>  	mci_writel(host, CLKSRC, 0);
>  
>  	free_irq(host->irq, host);
> -	destroy_workqueue(dw_mci_card_workqueue);
> +	destroy_workqueue(host->card_workqueue);
>  	dma_free_coherent(&host->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
>  
>  	if (host->use_dma && host->dma_ops->exit)
> diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
> index 8f66e28..7a7ebd3 100644
> --- a/include/linux/mmc/dw_mmc.h
> +++ b/include/linux/mmc/dw_mmc.h
> @@ -125,6 +125,7 @@ struct dw_mci {
>  	struct mmc_request	*mrq;
>  	struct mmc_command	*cmd;
>  	struct mmc_data		*data;
> +	struct workqueue_struct	*card_workqueue;
>  
>  	/* DMA interface members*/
>  	int			use_dma;

  reply	other threads:[~2012-05-02  3:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-01 21:57 [PATCH] mmc: dw_mmc: make multiple instances of dw_mci_card_workqueue Thomas Abraham
2012-05-01 21:57 ` Thomas Abraham
2012-05-02  3:07 ` Jaehoon Chung [this message]
2012-05-02  3:07   ` Jaehoon Chung
2012-05-02  9:07 ` Will Newton
2012-05-02  9:07   ` Will Newton

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=4FA0A50F.4020400@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=cjb@laptop.org \
    --cc=dianders@google.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=tgih.jun@samsung.com \
    --cc=thomas.abraham@linaro.org \
    --cc=will.newton@gmail.com \
    /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.