diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/at25.c | 2 | ||||
-rw-r--r-- | drivers/spi/atmel_spi.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi.c | 10 | ||||
-rw-r--r-- | drivers/spi/spi_bitbang.c | 26 | ||||
-rw-r--r-- | drivers/spi/spi_s3c24xx.c | 6 |
5 files changed, 11 insertions, 35 deletions
diff --git a/drivers/spi/at25.c b/drivers/spi/at25.c index 48e4f48e779f..8efa07e8b8c2 100644 --- a/drivers/spi/at25.c +++ b/drivers/spi/at25.c | |||
@@ -291,7 +291,7 @@ static int at25_probe(struct spi_device *spi) | |||
291 | */ | 291 | */ |
292 | sr = spi_w8r8(spi, AT25_RDSR); | 292 | sr = spi_w8r8(spi, AT25_RDSR); |
293 | if (sr < 0 || sr & AT25_SR_nRDY) { | 293 | if (sr < 0 || sr & AT25_SR_nRDY) { |
294 | dev_dbg(&at25->spi->dev, "rdsr --> %d (%02x)\n", sr, sr); | 294 | dev_dbg(&spi->dev, "rdsr --> %d (%02x)\n", sr, sr); |
295 | err = -ENXIO; | 295 | err = -ENXIO; |
296 | goto fail; | 296 | goto fail; |
297 | } | 297 | } |
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 6fa260d1a9be..66e7bc985797 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c | |||
@@ -425,7 +425,7 @@ static int atmel_spi_setup(struct spi_device *spi) | |||
425 | if (ret) | 425 | if (ret) |
426 | return ret; | 426 | return ret; |
427 | spi->controller_state = (void *)npcs_pin; | 427 | spi->controller_state = (void *)npcs_pin; |
428 | gpio_direction_output(npcs_pin); | 428 | gpio_direction_output(npcs_pin, !(spi->mode & SPI_CS_HIGH)); |
429 | } | 429 | } |
430 | 430 | ||
431 | dev_dbg(&spi->dev, | 431 | dev_dbg(&spi->dev, |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 2328128728be..6657331eed93 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -189,8 +189,8 @@ static DECLARE_MUTEX(board_lock); | |||
189 | * this is exported so that for example a USB or parport based adapter | 189 | * this is exported so that for example a USB or parport based adapter |
190 | * driver could add devices (which it would learn about out-of-band). | 190 | * driver could add devices (which it would learn about out-of-band). |
191 | */ | 191 | */ |
192 | struct spi_device *__init_or_module | 192 | struct spi_device *spi_new_device(struct spi_master *master, |
193 | spi_new_device(struct spi_master *master, struct spi_board_info *chip) | 193 | struct spi_board_info *chip) |
194 | { | 194 | { |
195 | struct spi_device *proxy; | 195 | struct spi_device *proxy; |
196 | struct device *dev = master->cdev.dev; | 196 | struct device *dev = master->cdev.dev; |
@@ -352,8 +352,7 @@ static struct class spi_master_class = { | |||
352 | * the master's methods before calling spi_register_master(); and (after errors | 352 | * the master's methods before calling spi_register_master(); and (after errors |
353 | * adding the device) calling spi_master_put() to prevent a memory leak. | 353 | * adding the device) calling spi_master_put() to prevent a memory leak. |
354 | */ | 354 | */ |
355 | struct spi_master * __init_or_module | 355 | struct spi_master *spi_alloc_master(struct device *dev, unsigned size) |
356 | spi_alloc_master(struct device *dev, unsigned size) | ||
357 | { | 356 | { |
358 | struct spi_master *master; | 357 | struct spi_master *master; |
359 | 358 | ||
@@ -392,8 +391,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master); | |||
392 | * After a successful return, the caller is responsible for calling | 391 | * After a successful return, the caller is responsible for calling |
393 | * spi_unregister_master(). | 392 | * spi_unregister_master(). |
394 | */ | 393 | */ |
395 | int __init_or_module | 394 | int spi_register_master(struct spi_master *master) |
396 | spi_register_master(struct spi_master *master) | ||
397 | { | 395 | { |
398 | static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1); | 396 | static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1); |
399 | struct device *dev = master->cdev.dev; | 397 | struct device *dev = master->cdev.dev; |
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 24a330d82395..88425e1af4d3 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -302,10 +302,6 @@ static void bitbang_work(struct work_struct *work) | |||
302 | setup_transfer = NULL; | 302 | setup_transfer = NULL; |
303 | 303 | ||
304 | list_for_each_entry (t, &m->transfers, transfer_list) { | 304 | list_for_each_entry (t, &m->transfers, transfer_list) { |
305 | if (bitbang->shutdown) { | ||
306 | status = -ESHUTDOWN; | ||
307 | break; | ||
308 | } | ||
309 | 305 | ||
310 | /* override or restore speed and wordsize */ | 306 | /* override or restore speed and wordsize */ |
311 | if (t->speed_hz || t->bits_per_word) { | 307 | if (t->speed_hz || t->bits_per_word) { |
@@ -410,8 +406,6 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m) | |||
410 | m->status = -EINPROGRESS; | 406 | m->status = -EINPROGRESS; |
411 | 407 | ||
412 | bitbang = spi_master_get_devdata(spi->master); | 408 | bitbang = spi_master_get_devdata(spi->master); |
413 | if (bitbang->shutdown) | ||
414 | return -ESHUTDOWN; | ||
415 | 409 | ||
416 | spin_lock_irqsave(&bitbang->lock, flags); | 410 | spin_lock_irqsave(&bitbang->lock, flags); |
417 | if (!spi->max_speed_hz) | 411 | if (!spi->max_speed_hz) |
@@ -507,28 +501,12 @@ EXPORT_SYMBOL_GPL(spi_bitbang_start); | |||
507 | */ | 501 | */ |
508 | int spi_bitbang_stop(struct spi_bitbang *bitbang) | 502 | int spi_bitbang_stop(struct spi_bitbang *bitbang) |
509 | { | 503 | { |
510 | unsigned limit = 500; | 504 | spi_unregister_master(bitbang->master); |
511 | |||
512 | spin_lock_irq(&bitbang->lock); | ||
513 | bitbang->shutdown = 0; | ||
514 | while (!list_empty(&bitbang->queue) && limit--) { | ||
515 | spin_unlock_irq(&bitbang->lock); | ||
516 | 505 | ||
517 | dev_dbg(bitbang->master->cdev.dev, "wait for queue\n"); | 506 | WARN_ON(!list_empty(&bitbang->queue)); |
518 | msleep(10); | ||
519 | |||
520 | spin_lock_irq(&bitbang->lock); | ||
521 | } | ||
522 | spin_unlock_irq(&bitbang->lock); | ||
523 | if (!list_empty(&bitbang->queue)) { | ||
524 | dev_err(bitbang->master->cdev.dev, "queue didn't empty\n"); | ||
525 | return -EBUSY; | ||
526 | } | ||
527 | 507 | ||
528 | destroy_workqueue(bitbang->workqueue); | 508 | destroy_workqueue(bitbang->workqueue); |
529 | 509 | ||
530 | spi_unregister_master(bitbang->master); | ||
531 | |||
532 | return 0; | 510 | return 0; |
533 | } | 511 | } |
534 | EXPORT_SYMBOL_GPL(spi_bitbang_stop); | 512 | EXPORT_SYMBOL_GPL(spi_bitbang_stop); |
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c index 651379c51ae6..b10211c420ef 100644 --- a/drivers/spi/spi_s3c24xx.c +++ b/drivers/spi/spi_s3c24xx.c | |||
@@ -41,7 +41,7 @@ struct s3c24xx_spi { | |||
41 | int len; | 41 | int len; |
42 | int count; | 42 | int count; |
43 | 43 | ||
44 | int (*set_cs)(struct s3c2410_spi_info *spi, | 44 | void (*set_cs)(struct s3c2410_spi_info *spi, |
45 | int cs, int pol); | 45 | int cs, int pol); |
46 | 46 | ||
47 | /* data buffers */ | 47 | /* data buffers */ |
@@ -77,7 +77,7 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) | |||
77 | 77 | ||
78 | switch (value) { | 78 | switch (value) { |
79 | case BITBANG_CS_INACTIVE: | 79 | case BITBANG_CS_INACTIVE: |
80 | hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol^1); | 80 | hw->set_cs(hw->pdata, spi->chip_select, cspol^1); |
81 | break; | 81 | break; |
82 | 82 | ||
83 | case BITBANG_CS_ACTIVE: | 83 | case BITBANG_CS_ACTIVE: |
@@ -98,7 +98,7 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) | |||
98 | /* write new configration */ | 98 | /* write new configration */ |
99 | 99 | ||
100 | writeb(spcon, hw->regs + S3C2410_SPCON); | 100 | writeb(spcon, hw->regs + S3C2410_SPCON); |
101 | hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol); | 101 | hw->set_cs(hw->pdata, spi->chip_select, cspol); |
102 | 102 | ||
103 | break; | 103 | break; |
104 | } | 104 | } |