diff options
author | Shubhrajyoti D <shubhrajyoti@ti.com> | 2011-10-28 07:44:17 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-10-29 08:05:47 -0400 |
commit | 2856ac13b8ab41a17b1c65e4eed51543e55f4bac (patch) | |
tree | 36eace120cd01d1a376839f180a2109c01cc89e0 /drivers/spi/spi-omap2-mcspi.c | |
parent | 940ab88962bc1aff3273a8356d64577a6e386736 (diff) |
spi/omap: Use a workqueue per omap2_mcspi controller
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>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi/spi-omap2-mcspi.c')
-rw-r--r-- | 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 322be7aea8b4..0192d1b79ca7 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c | |||
@@ -121,6 +121,7 @@ struct omap2_mcspi { | |||
121 | /* SPI1 has 4 channels, while SPI2 has 2 */ | 121 | /* SPI1 has 4 channels, while SPI2 has 2 */ |
122 | struct omap2_mcspi_dma *dma_channels; | 122 | struct omap2_mcspi_dma *dma_channels; |
123 | struct device *dev; | 123 | struct device *dev; |
124 | struct workqueue_struct *wq; | ||
124 | }; | 125 | }; |
125 | 126 | ||
126 | struct omap2_mcspi_cs { | 127 | struct omap2_mcspi_cs { |
@@ -143,8 +144,6 @@ struct omap2_mcspi_regs { | |||
143 | 144 | ||
144 | static struct omap2_mcspi_regs omap2_mcspi_ctx[OMAP2_MCSPI_MAX_CTRL]; | 145 | static struct omap2_mcspi_regs omap2_mcspi_ctx[OMAP2_MCSPI_MAX_CTRL]; |
145 | 146 | ||
146 | static struct workqueue_struct *omap2_mcspi_wq; | ||
147 | |||
148 | #define MOD_REG_BIT(val, mask, set) do { \ | 147 | #define MOD_REG_BIT(val, mask, set) do { \ |
149 | if (set) \ | 148 | if (set) \ |
150 | val |= mask; \ | 149 | val |= mask; \ |
@@ -1043,7 +1042,7 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m) | |||
1043 | 1042 | ||
1044 | spin_lock_irqsave(&mcspi->lock, flags); | 1043 | spin_lock_irqsave(&mcspi->lock, flags); |
1045 | list_add_tail(&m->queue, &mcspi->msg_queue); | 1044 | list_add_tail(&m->queue, &mcspi->msg_queue); |
1046 | queue_work(omap2_mcspi_wq, &mcspi->work); | 1045 | queue_work(mcspi->wq, &mcspi->work); |
1047 | spin_unlock_irqrestore(&mcspi->lock, flags); | 1046 | spin_unlock_irqrestore(&mcspi->lock, flags); |
1048 | 1047 | ||
1049 | return 0; | 1048 | return 0; |
@@ -1088,6 +1087,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) | |||
1088 | struct omap2_mcspi *mcspi; | 1087 | struct omap2_mcspi *mcspi; |
1089 | struct resource *r; | 1088 | struct resource *r; |
1090 | int status = 0, i; | 1089 | int status = 0, i; |
1090 | char wq_name[20]; | ||
1091 | 1091 | ||
1092 | master = spi_alloc_master(&pdev->dev, sizeof *mcspi); | 1092 | master = spi_alloc_master(&pdev->dev, sizeof *mcspi); |
1093 | if (master == NULL) { | 1093 | if (master == NULL) { |
@@ -1111,6 +1111,13 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) | |||
1111 | mcspi = spi_master_get_devdata(master); | 1111 | mcspi = spi_master_get_devdata(master); |
1112 | mcspi->master = master; | 1112 | mcspi->master = master; |
1113 | 1113 | ||
1114 | sprintf(wq_name, "omap2_mcspi/%d", master->bus_num); | ||
1115 | mcspi->wq = alloc_workqueue(wq_name, WQ_MEM_RECLAIM, 1); | ||
1116 | if (mcspi->wq == NULL) { | ||
1117 | status = -ENOMEM; | ||
1118 | goto err1; | ||
1119 | } | ||
1120 | |||
1114 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1121 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1115 | if (r == NULL) { | 1122 | if (r == NULL) { |
1116 | status = -ENODEV; | 1123 | status = -ENODEV; |
@@ -1217,6 +1224,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev) | |||
1217 | spi_unregister_master(master); | 1224 | spi_unregister_master(master); |
1218 | iounmap(base); | 1225 | iounmap(base); |
1219 | kfree(dma_channels); | 1226 | kfree(dma_channels); |
1227 | destroy_workqueue(mcspi->wq); | ||
1220 | 1228 | ||
1221 | return 0; | 1229 | return 0; |
1222 | } | 1230 | } |
@@ -1275,10 +1283,6 @@ static struct platform_driver omap2_mcspi_driver = { | |||
1275 | 1283 | ||
1276 | static int __init omap2_mcspi_init(void) | 1284 | static int __init omap2_mcspi_init(void) |
1277 | { | 1285 | { |
1278 | omap2_mcspi_wq = create_singlethread_workqueue( | ||
1279 | omap2_mcspi_driver.driver.name); | ||
1280 | if (omap2_mcspi_wq == NULL) | ||
1281 | return -1; | ||
1282 | return platform_driver_probe(&omap2_mcspi_driver, omap2_mcspi_probe); | 1286 | return platform_driver_probe(&omap2_mcspi_driver, omap2_mcspi_probe); |
1283 | } | 1287 | } |
1284 | subsys_initcall(omap2_mcspi_init); | 1288 | subsys_initcall(omap2_mcspi_init); |
@@ -1287,7 +1291,6 @@ static void __exit omap2_mcspi_exit(void) | |||
1287 | { | 1291 | { |
1288 | platform_driver_unregister(&omap2_mcspi_driver); | 1292 | platform_driver_unregister(&omap2_mcspi_driver); |
1289 | 1293 | ||
1290 | destroy_workqueue(omap2_mcspi_wq); | ||
1291 | } | 1294 | } |
1292 | module_exit(omap2_mcspi_exit); | 1295 | module_exit(omap2_mcspi_exit); |
1293 | 1296 | ||