linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: Shubhrajyoti D <shubhrajyoti@ti.com>
Cc: spi-devel-general@lists.sourceforge.net,
	linux-kernel@vger.kernel.org,
	Steve Wilkins <steve.wilkins@raymarine.com>
Subject: Re: [PATCH 1/3] OMAP: SPI: Use a workqueue per omap2_mcspi controller
Date: Sat, 29 Oct 2011 14:03:19 +0200	[thread overview]
Message-ID: <20111029120319.GD22592@ponder.secretlab.ca> (raw)
In-Reply-To: <1319802259-16565-2-git-send-email-shubhrajyoti@ti.com>

On Fri, Oct 28, 2011 at 05:14:17PM +0530, Shubhrajyoti D wrote:
> Currently all the spi controllers share the work queue.
> This patch allocates a work queue per controller.
> 
> Signed-off-by: Steve Wilkins <steve.wilkins@raymarine.com>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>

Applied for v3.3, thanks.

g.

> ---
>  drivers/spi/spi-omap2-mcspi.c |   19 +++++++++++--------
>  1 files changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
> index a8b614b..471b0f3 100644
> --- a/drivers/spi/spi-omap2-mcspi.c
> +++ b/drivers/spi/spi-omap2-mcspi.c
> @@ -121,6 +121,7 @@ struct omap2_mcspi {
>  	/* SPI1 has 4 channels, while SPI2 has 2 */
>  	struct omap2_mcspi_dma	*dma_channels;
>  	struct  device		*dev;
> +	struct workqueue_struct *wq;
>  };
>  
>  struct omap2_mcspi_cs {
> @@ -143,8 +144,6 @@ struct omap2_mcspi_regs {
>  
>  static struct omap2_mcspi_regs omap2_mcspi_ctx[OMAP2_MCSPI_MAX_CTRL];
>  
> -static struct workqueue_struct *omap2_mcspi_wq;
> -
>  #define MOD_REG_BIT(val, mask, set) do { \
>  	if (set) \
>  		val |= mask; \
> @@ -1043,7 +1042,7 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m)
>  
>  	spin_lock_irqsave(&mcspi->lock, flags);
>  	list_add_tail(&m->queue, &mcspi->msg_queue);
> -	queue_work(omap2_mcspi_wq, &mcspi->work);
> +	queue_work(mcspi->wq, &mcspi->work);
>  	spin_unlock_irqrestore(&mcspi->lock, flags);
>  
>  	return 0;
> @@ -1088,6 +1087,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
>  	struct omap2_mcspi	*mcspi;
>  	struct resource		*r;
>  	int			status = 0, i;
> +	char			wq_name[20];
>  
>  	master = spi_alloc_master(&pdev->dev, sizeof *mcspi);
>  	if (master == NULL) {
> @@ -1111,6 +1111,13 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
>  	mcspi = spi_master_get_devdata(master);
>  	mcspi->master = master;
>  
> +	sprintf(wq_name, "omap2_mcspi/%d", master->bus_num);
> +	mcspi->wq = alloc_workqueue(wq_name, WQ_MEM_RECLAIM, 1);
> +	if (mcspi->wq == NULL) {
> +		status = -ENOMEM;
> +		goto err1;
> +	}
> +
>  	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (r == NULL) {
>  		status = -ENODEV;
> @@ -1216,6 +1223,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev)
>  	spi_unregister_master(master);
>  	iounmap(base);
>  	kfree(dma_channels);
> +	destroy_workqueue(mcspi->wq);
>  
>  	return 0;
>  }
> @@ -1274,10 +1282,6 @@ static struct platform_driver omap2_mcspi_driver = {
>  
>  static int __init omap2_mcspi_init(void)
>  {
> -	omap2_mcspi_wq = create_singlethread_workqueue(
> -				omap2_mcspi_driver.driver.name);
> -	if (omap2_mcspi_wq == NULL)
> -		return -1;
>  	return platform_driver_probe(&omap2_mcspi_driver, omap2_mcspi_probe);
>  }
>  subsys_initcall(omap2_mcspi_init);
> @@ -1286,7 +1290,6 @@ static void __exit omap2_mcspi_exit(void)
>  {
>  	platform_driver_unregister(&omap2_mcspi_driver);
>  
> -	destroy_workqueue(omap2_mcspi_wq);
>  }
>  module_exit(omap2_mcspi_exit);
>  
> -- 
> 1.7.1
> 
> 
> ------------------------------------------------------------------------------
> The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning@Cisco Self-Assessment and learn 
> about Cisco certifications, training, and career opportunities. 
> http://p.sf.net/sfu/cisco-dev2dev
> _______________________________________________
> spi-devel-general mailing list
> spi-devel-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/spi-devel-general

  reply	other threads:[~2011-10-29 12:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-28 11:44 [PATCH 0/3] OMAP: SPI: Driver updates Shubhrajyoti D
     [not found] ` <1319802259-16565-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2011-10-28 11:44   ` [PATCH 1/3] OMAP: SPI: Use a workqueue per omap2_mcspi controller Shubhrajyoti D
2011-10-29 12:03     ` Grant Likely [this message]
2011-10-28 11:44   ` [PATCH 2/3] OMAP: SPI: call pm_runtime_disable in error path and remove Shubhrajyoti D
2011-10-29 12:06     ` Grant Likely
     [not found]       ` <20111029120655.GE22592-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-10-31  5:16         ` Shubhrajyoti
2011-10-28 11:44   ` [PATCH 3/3] OMAP: SPI: Correct the error path Shubhrajyoti D
     [not found]     ` <1319802259-16565-4-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2011-10-29 12:07       ` Grant Likely

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=20111029120319.GD22592@ponder.secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shubhrajyoti@ti.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    --cc=steve.wilkins@raymarine.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 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).