Lines Matching refs:master
49 if (spi->master->cleanup) in spidev_release()
50 spi->master->cleanup(spi); in spidev_release()
52 spi_master_put(spi->master); in spidev_release()
234 struct spi_device *spi_alloc_device(struct spi_master *master) in spi_alloc_device() argument
238 if (!spi_master_get(master)) in spi_alloc_device()
243 spi_master_put(master); in spi_alloc_device()
247 spi->master = master; in spi_alloc_device()
248 spi->dev.parent = &master->dev; in spi_alloc_device()
266 dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->master->dev), in spi_dev_set_name()
275 if (spi->master == new_spi->master && in spi_dev_check()
293 struct spi_master *master = spi->master; in spi_add_device() local
294 struct device *dev = master->dev.parent; in spi_add_device()
298 if (spi->chip_select >= master->num_chipselect) { in spi_add_device()
301 master->num_chipselect); in spi_add_device()
321 if (master->cs_gpios) in spi_add_device()
322 spi->cs_gpio = master->cs_gpios[spi->chip_select]; in spi_add_device()
363 struct spi_device *spi_new_device(struct spi_master *master, in spi_new_device() argument
376 proxy = spi_alloc_device(master); in spi_new_device()
401 static void spi_match_master_to_boardinfo(struct spi_master *master, in spi_match_master_to_boardinfo() argument
406 if (master->bus_num != bi->bus_num) in spi_match_master_to_boardinfo()
409 dev = spi_new_device(master, bi); in spi_match_master_to_boardinfo()
411 dev_err(master->dev.parent, "can't create new device for %s\n", in spi_match_master_to_boardinfo()
447 struct spi_master *master; in spi_register_board_info() local
452 list_for_each_entry(master, &spi_master_list, list) in spi_register_board_info()
453 spi_match_master_to_boardinfo(master, &bi->board_info); in spi_register_board_info()
469 else if (spi->master->set_cs) in spi_set_cs()
470 spi->master->set_cs(spi, !enable); in spi_set_cs()
474 static int spi_map_buf(struct spi_master *master, struct device *dev, in spi_map_buf() argument
479 const int desc_len = vmalloced_buf ? PAGE_SIZE : master->max_dma_len; in spi_map_buf()
524 static void spi_unmap_buf(struct spi_master *master, struct device *dev, in spi_unmap_buf() argument
533 static int __spi_map_msg(struct spi_master *master, struct spi_message *msg) in __spi_map_msg() argument
539 if (!master->can_dma) in __spi_map_msg()
542 tx_dev = master->dma_tx->device->dev; in __spi_map_msg()
543 rx_dev = master->dma_rx->device->dev; in __spi_map_msg()
546 if (!master->can_dma(master, msg->spi, xfer)) in __spi_map_msg()
550 ret = spi_map_buf(master, tx_dev, &xfer->tx_sg, in __spi_map_msg()
558 ret = spi_map_buf(master, rx_dev, &xfer->rx_sg, in __spi_map_msg()
562 spi_unmap_buf(master, tx_dev, &xfer->tx_sg, in __spi_map_msg()
569 master->cur_msg_mapped = true; in __spi_map_msg()
574 static int spi_unmap_msg(struct spi_master *master, struct spi_message *msg) in spi_unmap_msg() argument
579 if (!master->cur_msg_mapped || !master->can_dma) in spi_unmap_msg()
582 tx_dev = master->dma_tx->device->dev; in spi_unmap_msg()
583 rx_dev = master->dma_rx->device->dev; in spi_unmap_msg()
590 if (xfer->tx_buf == master->dummy_tx) in spi_unmap_msg()
592 if (xfer->rx_buf == master->dummy_rx) in spi_unmap_msg()
595 if (!master->can_dma(master, msg->spi, xfer)) in spi_unmap_msg()
598 spi_unmap_buf(master, rx_dev, &xfer->rx_sg, DMA_FROM_DEVICE); in spi_unmap_msg()
599 spi_unmap_buf(master, tx_dev, &xfer->tx_sg, DMA_TO_DEVICE); in spi_unmap_msg()
605 static inline int __spi_map_msg(struct spi_master *master, in __spi_map_msg() argument
611 static inline int spi_unmap_msg(struct spi_master *master, in spi_unmap_msg() argument
618 static int spi_map_msg(struct spi_master *master, struct spi_message *msg) in spi_map_msg() argument
624 if (master->flags & (SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX)) { in spi_map_msg()
629 if ((master->flags & SPI_MASTER_MUST_TX) && in spi_map_msg()
632 if ((master->flags & SPI_MASTER_MUST_RX) && in spi_map_msg()
638 tmp = krealloc(master->dummy_tx, max_tx, in spi_map_msg()
642 master->dummy_tx = tmp; in spi_map_msg()
647 tmp = krealloc(master->dummy_rx, max_rx, in spi_map_msg()
651 master->dummy_rx = tmp; in spi_map_msg()
658 xfer->tx_buf = master->dummy_tx; in spi_map_msg()
660 xfer->rx_buf = master->dummy_rx; in spi_map_msg()
665 return __spi_map_msg(master, msg); in spi_map_msg()
675 static int spi_transfer_one_message(struct spi_master *master, in spi_transfer_one_message() argument
689 reinit_completion(&master->xfer_completion); in spi_transfer_one_message()
691 ret = master->transfer_one(master, msg->spi, xfer); in spi_transfer_one_message()
703 ms = wait_for_completion_timeout(&master->xfer_completion, in spi_transfer_one_message()
748 if (msg->status && master->handle_err) in spi_transfer_one_message()
749 master->handle_err(master, msg); in spi_transfer_one_message()
751 spi_finalize_current_message(master); in spi_transfer_one_message()
764 void spi_finalize_current_transfer(struct spi_master *master) in spi_finalize_current_transfer() argument
766 complete(&master->xfer_completion); in spi_finalize_current_transfer()
783 static void __spi_pump_messages(struct spi_master *master, bool in_kthread) in __spi_pump_messages() argument
790 spin_lock_irqsave(&master->queue_lock, flags); in __spi_pump_messages()
793 if (master->cur_msg) { in __spi_pump_messages()
794 spin_unlock_irqrestore(&master->queue_lock, flags); in __spi_pump_messages()
799 if (master->idling) { in __spi_pump_messages()
800 queue_kthread_work(&master->kworker, &master->pump_messages); in __spi_pump_messages()
801 spin_unlock_irqrestore(&master->queue_lock, flags); in __spi_pump_messages()
806 if (list_empty(&master->queue) || !master->running) { in __spi_pump_messages()
807 if (!master->busy) { in __spi_pump_messages()
808 spin_unlock_irqrestore(&master->queue_lock, flags); in __spi_pump_messages()
814 queue_kthread_work(&master->kworker, in __spi_pump_messages()
815 &master->pump_messages); in __spi_pump_messages()
816 spin_unlock_irqrestore(&master->queue_lock, flags); in __spi_pump_messages()
820 master->busy = false; in __spi_pump_messages()
821 master->idling = true; in __spi_pump_messages()
822 spin_unlock_irqrestore(&master->queue_lock, flags); in __spi_pump_messages()
824 kfree(master->dummy_rx); in __spi_pump_messages()
825 master->dummy_rx = NULL; in __spi_pump_messages()
826 kfree(master->dummy_tx); in __spi_pump_messages()
827 master->dummy_tx = NULL; in __spi_pump_messages()
828 if (master->unprepare_transfer_hardware && in __spi_pump_messages()
829 master->unprepare_transfer_hardware(master)) in __spi_pump_messages()
830 dev_err(&master->dev, in __spi_pump_messages()
832 if (master->auto_runtime_pm) { in __spi_pump_messages()
833 pm_runtime_mark_last_busy(master->dev.parent); in __spi_pump_messages()
834 pm_runtime_put_autosuspend(master->dev.parent); in __spi_pump_messages()
836 trace_spi_master_idle(master); in __spi_pump_messages()
838 spin_lock_irqsave(&master->queue_lock, flags); in __spi_pump_messages()
839 master->idling = false; in __spi_pump_messages()
840 spin_unlock_irqrestore(&master->queue_lock, flags); in __spi_pump_messages()
845 master->cur_msg = in __spi_pump_messages()
846 list_first_entry(&master->queue, struct spi_message, queue); in __spi_pump_messages()
848 list_del_init(&master->cur_msg->queue); in __spi_pump_messages()
849 if (master->busy) in __spi_pump_messages()
852 master->busy = true; in __spi_pump_messages()
853 spin_unlock_irqrestore(&master->queue_lock, flags); in __spi_pump_messages()
855 if (!was_busy && master->auto_runtime_pm) { in __spi_pump_messages()
856 ret = pm_runtime_get_sync(master->dev.parent); in __spi_pump_messages()
858 dev_err(&master->dev, "Failed to power device: %d\n", in __spi_pump_messages()
865 trace_spi_master_busy(master); in __spi_pump_messages()
867 if (!was_busy && master->prepare_transfer_hardware) { in __spi_pump_messages()
868 ret = master->prepare_transfer_hardware(master); in __spi_pump_messages()
870 dev_err(&master->dev, in __spi_pump_messages()
873 if (master->auto_runtime_pm) in __spi_pump_messages()
874 pm_runtime_put(master->dev.parent); in __spi_pump_messages()
879 trace_spi_message_start(master->cur_msg); in __spi_pump_messages()
881 if (master->prepare_message) { in __spi_pump_messages()
882 ret = master->prepare_message(master, master->cur_msg); in __spi_pump_messages()
884 dev_err(&master->dev, in __spi_pump_messages()
886 master->cur_msg->status = ret; in __spi_pump_messages()
887 spi_finalize_current_message(master); in __spi_pump_messages()
890 master->cur_msg_prepared = true; in __spi_pump_messages()
893 ret = spi_map_msg(master, master->cur_msg); in __spi_pump_messages()
895 master->cur_msg->status = ret; in __spi_pump_messages()
896 spi_finalize_current_message(master); in __spi_pump_messages()
900 ret = master->transfer_one_message(master, master->cur_msg); in __spi_pump_messages()
902 dev_err(&master->dev, in __spi_pump_messages()
914 struct spi_master *master = in spi_pump_messages() local
917 __spi_pump_messages(master, true); in spi_pump_messages()
920 static int spi_init_queue(struct spi_master *master) in spi_init_queue() argument
924 master->running = false; in spi_init_queue()
925 master->busy = false; in spi_init_queue()
927 init_kthread_worker(&master->kworker); in spi_init_queue()
928 master->kworker_task = kthread_run(kthread_worker_fn, in spi_init_queue()
929 &master->kworker, "%s", in spi_init_queue()
930 dev_name(&master->dev)); in spi_init_queue()
931 if (IS_ERR(master->kworker_task)) { in spi_init_queue()
932 dev_err(&master->dev, "failed to create message pump task\n"); in spi_init_queue()
933 return PTR_ERR(master->kworker_task); in spi_init_queue()
935 init_kthread_work(&master->pump_messages, spi_pump_messages); in spi_init_queue()
944 if (master->rt) { in spi_init_queue()
945 dev_info(&master->dev, in spi_init_queue()
947 sched_setscheduler(master->kworker_task, SCHED_FIFO, ¶m); in spi_init_queue()
961 struct spi_message *spi_get_next_queued_message(struct spi_master *master) in spi_get_next_queued_message() argument
967 spin_lock_irqsave(&master->queue_lock, flags); in spi_get_next_queued_message()
968 next = list_first_entry_or_null(&master->queue, struct spi_message, in spi_get_next_queued_message()
970 spin_unlock_irqrestore(&master->queue_lock, flags); in spi_get_next_queued_message()
983 void spi_finalize_current_message(struct spi_master *master) in spi_finalize_current_message() argument
989 spin_lock_irqsave(&master->queue_lock, flags); in spi_finalize_current_message()
990 mesg = master->cur_msg; in spi_finalize_current_message()
991 spin_unlock_irqrestore(&master->queue_lock, flags); in spi_finalize_current_message()
993 spi_unmap_msg(master, mesg); in spi_finalize_current_message()
995 if (master->cur_msg_prepared && master->unprepare_message) { in spi_finalize_current_message()
996 ret = master->unprepare_message(master, mesg); in spi_finalize_current_message()
998 dev_err(&master->dev, in spi_finalize_current_message()
1003 spin_lock_irqsave(&master->queue_lock, flags); in spi_finalize_current_message()
1004 master->cur_msg = NULL; in spi_finalize_current_message()
1005 master->cur_msg_prepared = false; in spi_finalize_current_message()
1006 queue_kthread_work(&master->kworker, &master->pump_messages); in spi_finalize_current_message()
1007 spin_unlock_irqrestore(&master->queue_lock, flags); in spi_finalize_current_message()
1017 static int spi_start_queue(struct spi_master *master) in spi_start_queue() argument
1021 spin_lock_irqsave(&master->queue_lock, flags); in spi_start_queue()
1023 if (master->running || master->busy) { in spi_start_queue()
1024 spin_unlock_irqrestore(&master->queue_lock, flags); in spi_start_queue()
1028 master->running = true; in spi_start_queue()
1029 master->cur_msg = NULL; in spi_start_queue()
1030 spin_unlock_irqrestore(&master->queue_lock, flags); in spi_start_queue()
1032 queue_kthread_work(&master->kworker, &master->pump_messages); in spi_start_queue()
1037 static int spi_stop_queue(struct spi_master *master) in spi_stop_queue() argument
1043 spin_lock_irqsave(&master->queue_lock, flags); in spi_stop_queue()
1051 while ((!list_empty(&master->queue) || master->busy) && limit--) { in spi_stop_queue()
1052 spin_unlock_irqrestore(&master->queue_lock, flags); in spi_stop_queue()
1054 spin_lock_irqsave(&master->queue_lock, flags); in spi_stop_queue()
1057 if (!list_empty(&master->queue) || master->busy) in spi_stop_queue()
1060 master->running = false; in spi_stop_queue()
1062 spin_unlock_irqrestore(&master->queue_lock, flags); in spi_stop_queue()
1065 dev_warn(&master->dev, in spi_stop_queue()
1072 static int spi_destroy_queue(struct spi_master *master) in spi_destroy_queue() argument
1076 ret = spi_stop_queue(master); in spi_destroy_queue()
1085 dev_err(&master->dev, "problem destroying queue\n"); in spi_destroy_queue()
1089 flush_kthread_worker(&master->kworker); in spi_destroy_queue()
1090 kthread_stop(master->kworker_task); in spi_destroy_queue()
1099 struct spi_master *master = spi->master; in __spi_queued_transfer() local
1102 spin_lock_irqsave(&master->queue_lock, flags); in __spi_queued_transfer()
1104 if (!master->running) { in __spi_queued_transfer()
1105 spin_unlock_irqrestore(&master->queue_lock, flags); in __spi_queued_transfer()
1111 list_add_tail(&msg->queue, &master->queue); in __spi_queued_transfer()
1112 if (!master->busy && need_pump) in __spi_queued_transfer()
1113 queue_kthread_work(&master->kworker, &master->pump_messages); in __spi_queued_transfer()
1115 spin_unlock_irqrestore(&master->queue_lock, flags); in __spi_queued_transfer()
1129 static int spi_master_initialize_queue(struct spi_master *master) in spi_master_initialize_queue() argument
1133 master->transfer = spi_queued_transfer; in spi_master_initialize_queue()
1134 if (!master->transfer_one_message) in spi_master_initialize_queue()
1135 master->transfer_one_message = spi_transfer_one_message; in spi_master_initialize_queue()
1138 ret = spi_init_queue(master); in spi_master_initialize_queue()
1140 dev_err(&master->dev, "problem initializing queue\n"); in spi_master_initialize_queue()
1143 master->queued = true; in spi_master_initialize_queue()
1144 ret = spi_start_queue(master); in spi_master_initialize_queue()
1146 dev_err(&master->dev, "problem starting queue\n"); in spi_master_initialize_queue()
1153 spi_destroy_queue(master); in spi_master_initialize_queue()
1162 of_register_spi_device(struct spi_master *master, struct device_node *nc) in of_register_spi_device() argument
1169 spi = spi_alloc_device(master); in of_register_spi_device()
1171 dev_err(&master->dev, "spi_device alloc error for %s\n", in of_register_spi_device()
1181 dev_err(&master->dev, "cannot find modalias for %s\n", in of_register_spi_device()
1189 dev_err(&master->dev, "%s has no valid 'reg' property (%d)\n", in of_register_spi_device()
1219 dev_warn(&master->dev, in of_register_spi_device()
1237 dev_warn(&master->dev, in of_register_spi_device()
1247 dev_err(&master->dev, "%s has no valid 'spi-max-frequency' property (%d)\n", in of_register_spi_device()
1263 dev_err(&master->dev, "spi_device register error %s\n", in of_register_spi_device()
1282 static void of_register_spi_devices(struct spi_master *master) in of_register_spi_devices() argument
1287 if (!master->dev.of_node) in of_register_spi_devices()
1290 for_each_available_child_of_node(master->dev.of_node, nc) { in of_register_spi_devices()
1291 spi = of_register_spi_device(master, nc); in of_register_spi_devices()
1293 dev_warn(&master->dev, "Failed to create SPI device for %s\n", in of_register_spi_devices()
1298 static void of_register_spi_devices(struct spi_master *master) { } in of_register_spi_devices() argument
1335 struct spi_master *master = data; in acpi_spi_add_device() local
1346 spi = spi_alloc_device(master); in acpi_spi_add_device()
1348 dev_err(&master->dev, "failed to allocate SPI device for %s\n", in acpi_spi_add_device()
1370 dev_err(&master->dev, "failed to add SPI device %s from ACPI\n", in acpi_spi_add_device()
1378 static void acpi_register_spi_devices(struct spi_master *master) in acpi_register_spi_devices() argument
1383 handle = ACPI_HANDLE(master->dev.parent); in acpi_register_spi_devices()
1389 master, NULL); in acpi_register_spi_devices()
1391 dev_warn(&master->dev, "failed to enumerate SPI slaves\n"); in acpi_register_spi_devices()
1394 static inline void acpi_register_spi_devices(struct spi_master *master) {} in acpi_register_spi_devices() argument
1399 struct spi_master *master; in spi_master_release() local
1401 master = container_of(dev, struct spi_master, dev); in spi_master_release()
1402 kfree(master); in spi_master_release()
1434 struct spi_master *master; in spi_alloc_master() local
1439 master = kzalloc(size + sizeof(*master), GFP_KERNEL); in spi_alloc_master()
1440 if (!master) in spi_alloc_master()
1443 device_initialize(&master->dev); in spi_alloc_master()
1444 master->bus_num = -1; in spi_alloc_master()
1445 master->num_chipselect = 1; in spi_alloc_master()
1446 master->dev.class = &spi_master_class; in spi_alloc_master()
1447 master->dev.parent = get_device(dev); in spi_alloc_master()
1448 spi_master_set_devdata(master, &master[1]); in spi_alloc_master()
1450 return master; in spi_alloc_master()
1455 static int of_spi_register_master(struct spi_master *master) in of_spi_register_master() argument
1458 struct device_node *np = master->dev.of_node; in of_spi_register_master()
1464 master->num_chipselect = max_t(int, nb, master->num_chipselect); in of_spi_register_master()
1472 cs = devm_kzalloc(&master->dev, in of_spi_register_master()
1473 sizeof(int) * master->num_chipselect, in of_spi_register_master()
1475 master->cs_gpios = cs; in of_spi_register_master()
1477 if (!master->cs_gpios) in of_spi_register_master()
1480 for (i = 0; i < master->num_chipselect; i++) in of_spi_register_master()
1489 static int of_spi_register_master(struct spi_master *master) in of_spi_register_master() argument
1515 int spi_register_master(struct spi_master *master) in spi_register_master() argument
1518 struct device *dev = master->dev.parent; in spi_register_master()
1526 status = of_spi_register_master(master); in spi_register_master()
1533 if (master->num_chipselect == 0) in spi_register_master()
1536 if ((master->bus_num < 0) && master->dev.of_node) in spi_register_master()
1537 master->bus_num = of_alias_get_id(master->dev.of_node, "spi"); in spi_register_master()
1540 if (master->bus_num < 0) { in spi_register_master()
1544 master->bus_num = atomic_dec_return(&dyn_bus_id); in spi_register_master()
1548 INIT_LIST_HEAD(&master->queue); in spi_register_master()
1549 spin_lock_init(&master->queue_lock); in spi_register_master()
1550 spin_lock_init(&master->bus_lock_spinlock); in spi_register_master()
1551 mutex_init(&master->bus_lock_mutex); in spi_register_master()
1552 master->bus_lock_flag = 0; in spi_register_master()
1553 init_completion(&master->xfer_completion); in spi_register_master()
1554 if (!master->max_dma_len) in spi_register_master()
1555 master->max_dma_len = INT_MAX; in spi_register_master()
1560 dev_set_name(&master->dev, "spi%u", master->bus_num); in spi_register_master()
1561 status = device_add(&master->dev); in spi_register_master()
1564 dev_dbg(dev, "registered master %s%s\n", dev_name(&master->dev), in spi_register_master()
1568 if (master->transfer) in spi_register_master()
1571 status = spi_master_initialize_queue(master); in spi_register_master()
1573 device_del(&master->dev); in spi_register_master()
1579 list_add_tail(&master->list, &spi_master_list); in spi_register_master()
1581 spi_match_master_to_boardinfo(master, &bi->board_info); in spi_register_master()
1585 of_register_spi_devices(master); in spi_register_master()
1586 acpi_register_spi_devices(master); in spi_register_master()
1606 int devm_spi_register_master(struct device *dev, struct spi_master *master) in devm_spi_register_master() argument
1615 ret = spi_register_master(master); in devm_spi_register_master()
1617 *ptr = master; in devm_spi_register_master()
1643 void spi_unregister_master(struct spi_master *master) in spi_unregister_master() argument
1647 if (master->queued) { in spi_unregister_master()
1648 if (spi_destroy_queue(master)) in spi_unregister_master()
1649 dev_err(&master->dev, "queue remove failed\n"); in spi_unregister_master()
1653 list_del(&master->list); in spi_unregister_master()
1656 dummy = device_for_each_child(&master->dev, NULL, __unregister); in spi_unregister_master()
1657 device_unregister(&master->dev); in spi_unregister_master()
1661 int spi_master_suspend(struct spi_master *master) in spi_master_suspend() argument
1666 if (!master->queued) in spi_master_suspend()
1669 ret = spi_stop_queue(master); in spi_master_suspend()
1671 dev_err(&master->dev, "queue stop failed\n"); in spi_master_suspend()
1677 int spi_master_resume(struct spi_master *master) in spi_master_resume() argument
1681 if (!master->queued) in spi_master_resume()
1684 ret = spi_start_queue(master); in spi_master_resume()
1686 dev_err(&master->dev, "queue restart failed\n"); in spi_master_resume()
1714 struct spi_master *master = NULL; in spi_busnum_to_master() local
1719 master = container_of(dev, struct spi_master, dev); in spi_busnum_to_master()
1721 return master; in spi_busnum_to_master()
1771 bad_bits = spi->mode & ~spi->master->mode_bits; in spi_setup()
1791 spi->max_speed_hz = spi->master->max_speed_hz; in spi_setup()
1795 if (spi->master->setup) in spi_setup()
1796 status = spi->master->setup(spi); in spi_setup()
1813 struct spi_master *master = spi->master; in __spi_validate() local
1825 if ((master->flags & SPI_MASTER_HALF_DUPLEX) in __spi_validate()
1827 unsigned flags = master->flags; in __spi_validate()
1853 if (master->max_speed_hz && in __spi_validate()
1854 xfer->speed_hz > master->max_speed_hz) in __spi_validate()
1855 xfer->speed_hz = master->max_speed_hz; in __spi_validate()
1857 if (master->bits_per_word_mask) { in __spi_validate()
1861 if (!(master->bits_per_word_mask & in __spi_validate()
1881 if (xfer->speed_hz && master->min_speed_hz && in __spi_validate()
1882 xfer->speed_hz < master->min_speed_hz) in __spi_validate()
1927 struct spi_master *master = spi->master; in __spi_async() local
1933 return master->transfer(spi, message); in __spi_async()
1967 struct spi_master *master = spi->master; in spi_async() local
1975 spin_lock_irqsave(&master->bus_lock_spinlock, flags); in spi_async()
1977 if (master->bus_lock_flag) in spi_async()
1982 spin_unlock_irqrestore(&master->bus_lock_spinlock, flags); in spi_async()
2019 struct spi_master *master = spi->master; in spi_async_locked() local
2027 spin_lock_irqsave(&master->bus_lock_spinlock, flags); in spi_async_locked()
2031 spin_unlock_irqrestore(&master->bus_lock_spinlock, flags); in spi_async_locked()
2056 struct spi_master *master = spi->master; in __spi_sync() local
2068 mutex_lock(&master->bus_lock_mutex); in __spi_sync()
2075 if (master->transfer == spi_queued_transfer) { in __spi_sync()
2076 spin_lock_irqsave(&master->bus_lock_spinlock, flags); in __spi_sync()
2082 spin_unlock_irqrestore(&master->bus_lock_spinlock, flags); in __spi_sync()
2088 mutex_unlock(&master->bus_lock_mutex); in __spi_sync()
2094 if (master->transfer == spi_queued_transfer) in __spi_sync()
2095 __spi_pump_messages(master, false); in __spi_sync()
2168 int spi_bus_lock(struct spi_master *master) in spi_bus_lock() argument
2172 mutex_lock(&master->bus_lock_mutex); in spi_bus_lock()
2174 spin_lock_irqsave(&master->bus_lock_spinlock, flags); in spi_bus_lock()
2175 master->bus_lock_flag = 1; in spi_bus_lock()
2176 spin_unlock_irqrestore(&master->bus_lock_spinlock, flags); in spi_bus_lock()
2197 int spi_bus_unlock(struct spi_master *master) in spi_bus_unlock() argument
2199 master->bus_lock_flag = 0; in spi_bus_unlock()
2201 mutex_unlock(&master->bus_lock_mutex); in spi_bus_unlock()
2324 struct spi_master *master; in of_spi_notify() local
2329 master = of_find_spi_master_by_node(rd->dn->parent); in of_spi_notify()
2330 if (master == NULL) in of_spi_notify()
2333 spi = of_register_spi_device(master, rd->dn); in of_spi_notify()
2334 put_device(&master->dev); in of_spi_notify()