···14171417 __spi_pump_messages(ctlr, true);14181418}1419141914201420-static int spi_init_queue(struct spi_controller *ctlr)14201420+/**14211421+ * spi_set_thread_rt - set the controller to pump at realtime priority14221422+ * @ctlr: controller to boost priority of14231423+ *14241424+ * This can be called because the controller requested realtime priority14251425+ * (by setting the ->rt value before calling spi_register_controller()) or14261426+ * because a device on the bus said that its transfers needed realtime14271427+ * priority.14281428+ *14291429+ * NOTE: at the moment if any device on a bus says it needs realtime then14301430+ * the thread will be at realtime priority for all transfers on that14311431+ * controller. If this eventually becomes a problem we may see if we can14321432+ * find a way to boost the priority only temporarily during relevant14331433+ * transfers.14341434+ */14351435+static void spi_set_thread_rt(struct spi_controller *ctlr)14211436{14221437 struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 };1423143814391439+ dev_info(&ctlr->dev,14401440+ "will run message pump with realtime priority\n");14411441+ sched_setscheduler(ctlr->kworker_task, SCHED_FIFO, ¶m);14421442+}14431443+14441444+static int spi_init_queue(struct spi_controller *ctlr)14451445+{14241446 ctlr->running = false;14251447 ctlr->busy = false;14261448···14621440 * request and the scheduling of the message pump thread. Without this14631441 * setting the message pump thread will remain at default priority.14641442 */14651465- if (ctlr->rt) {14661466- dev_info(&ctlr->dev,14671467- "will run message pump with realtime priority\n");14681468- sched_setscheduler(ctlr->kworker_task, SCHED_FIFO, ¶m);14691469- }14431443+ if (ctlr->rt)14441444+ spi_set_thread_rt(ctlr);1470144514711446 return 0;14721447}···30893070 status = spi->controller->setup(spi);3090307130913072 spi_set_cs(spi, false);30733073+30743074+ if (spi->rt && !spi->controller->rt) {30753075+ spi->controller->rt = true;30763076+ spi_set_thread_rt(spi->controller);30773077+ }3092307830933079 dev_dbg(&spi->dev, "setup mode %d, %s%s%s%s%u bits/w, %u Hz max --> %d\n",30943080 (int) (spi->mode & (SPI_CPOL | SPI_CPHA)),
+2
include/linux/spi/spi.h
···109109 * This may be changed by the device's driver, or left at the110110 * default (0) indicating protocol words are eight bit bytes.111111 * The spi_transfer.bits_per_word can override this for each transfer.112112+ * @rt: Make the pump thread real time priority.112113 * @irq: Negative, or the number passed to request_irq() to receive113114 * interrupts from this device.114115 * @controller_state: Controller's runtime state···144143 u32 max_speed_hz;145144 u8 chip_select;146145 u8 bits_per_word;146146+ bool rt;147147 u32 mode;148148#define SPI_CPHA 0x01 /* clock phase */149149#define SPI_CPOL 0x02 /* clock polarity */