3333#include <linux/pm.h>
3434#include <linux/pm_runtime.h>
3535#include <linux/pinctrl/consumer.h>
36+ #include <linux/workqueue.h>
3637
3738#include <asm/cacheflush.h>
3839#include <asm/io.h>
@@ -272,12 +273,12 @@ struct atmel_mci_dma {
272273 * EVENT_DATA_ERROR is pending.
273274 * @stop_cmdr: Value to be loaded into CMDR when the stop command is
274275 * to be sent.
275- * @tasklet: Tasklet running the request state machine.
276+ * @bh_work: Work running the request state machine.
276277 * @pending_events: Bitmask of events flagged by the interrupt handler
277- * to be processed by the tasklet .
278+ * to be processed by the work .
278279 * @completed_events: Bitmask of events which the state machine has
279280 * processed.
280- * @state: Tasklet state.
281+ * @state: Work state.
281282 * @queue: List of slots waiting for access to the controller.
282283 * @need_clock_update: Update the clock rate before the next request.
283284 * @need_reset: Reset controller before next request.
@@ -352,7 +353,7 @@ struct atmel_mci {
352353 u32 data_status ;
353354 u32 stop_cmdr ;
354355
355- struct tasklet_struct tasklet ;
356+ struct work_struct bh_work ;
356357 unsigned long pending_events ;
357358 unsigned long completed_events ;
358359 enum atmel_mci_state state ;
@@ -735,7 +736,7 @@ static void atmci_timeout_timer(struct timer_list *t)
735736 host -> need_reset = 1 ;
736737 host -> state = STATE_END_REQUEST ;
737738 smp_wmb ();
738- tasklet_schedule ( & host -> tasklet );
739+ queue_work ( system_bh_wq , & host -> bh_work );
739740}
740741
741742static inline unsigned int atmci_ns_to_clocks (struct atmel_mci * host ,
@@ -958,7 +959,7 @@ static void atmci_pdc_complete(struct atmel_mci *host)
958959
959960 dev_dbg (dev , "(%s) set pending xfer complete\n" , __func__ );
960961 atmci_set_pending (host , EVENT_XFER_COMPLETE );
961- tasklet_schedule ( & host -> tasklet );
962+ queue_work ( system_bh_wq , & host -> bh_work );
962963}
963964
964965static void atmci_dma_cleanup (struct atmel_mci * host )
@@ -972,7 +973,7 @@ static void atmci_dma_cleanup(struct atmel_mci *host)
972973}
973974
974975/*
975- * This function is called by the DMA driver from tasklet context.
976+ * This function is called by the DMA driver from bh context.
976977 */
977978static void atmci_dma_complete (void * arg )
978979{
@@ -995,7 +996,7 @@ static void atmci_dma_complete(void *arg)
995996 if (data ) {
996997 dev_dbg (dev , "(%s) set pending xfer complete\n" , __func__ );
997998 atmci_set_pending (host , EVENT_XFER_COMPLETE );
998- tasklet_schedule ( & host -> tasklet );
999+ queue_work ( system_bh_wq , & host -> bh_work );
9991000
10001001 /*
10011002 * Regardless of what the documentation says, we have
@@ -1008,7 +1009,7 @@ static void atmci_dma_complete(void *arg)
10081009 * haven't seen all the potential error bits yet.
10091010 *
10101011 * The interrupt handler will schedule a different
1011- * tasklet to finish things up when the data transfer
1012+ * bh work to finish things up when the data transfer
10121013 * is completely done.
10131014 *
10141015 * We may not complete the mmc request here anyway
@@ -1745,9 +1746,9 @@ static void atmci_detect_change(struct timer_list *t)
17451746 }
17461747}
17471748
1748- static void atmci_tasklet_func (struct tasklet_struct * t )
1749+ static void atmci_work_func (struct work_struct * t )
17491750{
1750- struct atmel_mci * host = from_tasklet (host , t , tasklet );
1751+ struct atmel_mci * host = from_work (host , t , bh_work );
17511752 struct mmc_request * mrq = host -> mrq ;
17521753 struct mmc_data * data = host -> data ;
17531754 struct device * dev = host -> dev ;
@@ -1759,7 +1760,7 @@ static void atmci_tasklet_func(struct tasklet_struct *t)
17591760
17601761 state = host -> state ;
17611762
1762- dev_vdbg (dev , "tasklet : state %u pending/completed/mask %lx/%lx/%x\n" ,
1763+ dev_vdbg (dev , "bh_work : state %u pending/completed/mask %lx/%lx/%x\n" ,
17631764 state , host -> pending_events , host -> completed_events ,
17641765 atmci_readl (host , ATMCI_IMR ));
17651766
@@ -2118,7 +2119,7 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id)
21182119 dev_dbg (dev , "set pending data error\n" );
21192120 smp_wmb ();
21202121 atmci_set_pending (host , EVENT_DATA_ERROR );
2121- tasklet_schedule ( & host -> tasklet );
2122+ queue_work ( system_bh_wq , & host -> bh_work );
21222123 }
21232124
21242125 if (pending & ATMCI_TXBUFE ) {
@@ -2187,7 +2188,7 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id)
21872188 smp_wmb ();
21882189 dev_dbg (dev , "set pending notbusy\n" );
21892190 atmci_set_pending (host , EVENT_NOTBUSY );
2190- tasklet_schedule ( & host -> tasklet );
2191+ queue_work ( system_bh_wq , & host -> bh_work );
21912192 }
21922193
21932194 if (pending & ATMCI_NOTBUSY ) {
@@ -2196,7 +2197,7 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id)
21962197 smp_wmb ();
21972198 dev_dbg (dev , "set pending notbusy\n" );
21982199 atmci_set_pending (host , EVENT_NOTBUSY );
2199- tasklet_schedule ( & host -> tasklet );
2200+ queue_work ( system_bh_wq , & host -> bh_work );
22002201 }
22012202
22022203 if (pending & ATMCI_RXRDY )
@@ -2211,7 +2212,7 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id)
22112212 smp_wmb ();
22122213 dev_dbg (dev , "set pending cmd rdy\n" );
22132214 atmci_set_pending (host , EVENT_CMD_RDY );
2214- tasklet_schedule ( & host -> tasklet );
2215+ queue_work ( system_bh_wq , & host -> bh_work );
22152216 }
22162217
22172218 if (pending & (ATMCI_SDIOIRQA | ATMCI_SDIOIRQB ))
@@ -2487,7 +2488,7 @@ static int atmci_probe(struct platform_device *pdev)
24872488
24882489 host -> mapbase = regs -> start ;
24892490
2490- tasklet_setup (& host -> tasklet , atmci_tasklet_func );
2491+ INIT_WORK (& host -> bh_work , atmci_work_func );
24912492
24922493 ret = request_irq (irq , atmci_interrupt , 0 , dev_name (dev ), host );
24932494 if (ret ) {
0 commit comments