spi: pic32: Retire dma_request_slave_channel_compat()
PATCH 1/1 spi: pic32: Retire dma_request_slave_channel_compat()
There is no reason to use the dma_request_slave_channel_compat() as no filter function and parameter is provided.
Switch the driver to use dma_request_chan() instead.
---
Hi,
Trying to crack down on the dma_request_slave_channel_compat() in the tree...
Only compile tested!
Regards,
Peter
drivers/spi/spi-pic32.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/spi/spi-pic32.c +12 -12
@@ -609,22 +609,18 @@ static void pic32_spi_cleanup(struct spi_device *spi)static void pic32_spi_dma_prep (struct pic32_spi *pic32s,struct device *dev) {struct spi_master *master = pic32s->master; -dma_cap_mask_t mask; -dma_cap_zero (mask); -dma_cap_set (DMA_SLAVE , mask); - - master->dma_rx =dma_request_slave_channel_compat (mask,NULL ,NULL , - dev,"spi-rx" ); -if (!master->dma_rx) { + master->dma_rx =dma_request_chan (dev,"spi-rx" ); +if (IS_ERR (master->dma_rx)) {dev_warn (dev,"RX channel not found.\n" ); + master->dma_rx =NULL ; goto out_err; } - master->dma_tx =dma_request_slave_channel_compat (mask,NULL ,NULL , - dev,"spi-tx" ); -if (!master->dma_tx) { + master->dma_tx =dma_request_chan (dev,"spi-tx" ); +if (IS_ERR (master->dma_tx)) {dev_warn (dev,"TX channel not found.\n" ); + master->dma_tx =NULL ; goto out_err; }
@@ -637,11 +633,15 @@ static void pic32_spi_dma_prep(struct pic32_spi *pic32s, struct device *dev)return ; out_err: -if (master->dma_rx) +if (master->dma_rx) {dma_release_channel (master->dma_rx); + master->dma_rx =NULL ; + } -if (master->dma_tx) +if (master->dma_tx) {dma_release_channel (master->dma_tx); + master->dma_tx =NULL ; + } }static void pic32_spi_dma_unprep (struct pic32_spi *pic32s)
Signature · 4 lines
Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Hi Peter,
Quoted 12 lines · Peter Ujfalusi
There is no reason to use the
dma_request_slave_channel_compat()as no filter function and parameter is provided.Switch the driver to use
dma_request_chan()instead.Signed-off-by Peter Ujfalusi <[email protected]>drivers/spi/spi-pic32.c +0
-0@@ -609,22 +609,18 @@ static void pic32_spi_cleanup(struct spi_device *spi)static void pic32_spi_dma_prep (struct pic32_spi *pic32s,struct device *dev) {
drivers/spi/spi-pic32.c static void pic32_spi_cleanup(struct spi_device *spi) · line 613
Quoted 10 lines
drivers/spi/spi-pic32.c +1
-7struct spi_master *master = pic32s->master; -dma_cap_mask_t mask; -dma_cap_zero (mask); -dma_cap_set (DMA_SLAVE , mask); - - master->dma_rx =dma_request_slave_channel_compat (mask,NULL ,NULL , - dev,"spi-rx" ); -if (!master->dma_rx) { + master->dma_rx =dma_request_chan (dev,"spi-rx" );
Why not dma_request_slave_channel()?
That way you...
drivers/spi/spi-pic32.c static void pic32_spi_cleanup(struct spi_device *spi) · line 614
Quoted 1 line
drivers/spi/spi-pic32.c +1
-0+if (IS_ERR (master->dma_rx)) {
... don't have to change the NULL check here, and...
drivers/spi/spi-pic32.c static void pic32_spi_cleanup(struct spi_device *spi) · line 616
Quoted 2 lines
drivers/spi/spi-pic32.c +1
-0dev_warn (dev,"RX channel not found.\n" ); + master->dma_rx =NULL ;
... don't have to override by NULL here.
(same for TX below).
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Geert,
Quoted 18 lines · Geert Uytterhoeven
Hi Peter,
Quoted 15 lines · Peter Ujfalusi
There is no reason to use the
dma_request_slave_channel_compat()as no filter function and parameter is provided.Switch the driver to use
dma_request_chan()instead.Signed-off-by Peter Ujfalusi <[email protected]>drivers/spi/spi-pic32.c +0
-1@@ -609,22 +609,18 @@ static void pic32_spi_cleanup(struct spi_device *spi)static void pic32_spi_dma_prep (struct pic32_spi *pic32s,struct device *dev) {struct spi_master *master = pic32s->master; -dma_cap_mask_t mask;
Quoted 9 lines
drivers/spi/spi-pic32.c static void pic32_spi_cleanup(struct spi_device *spi) · line 613
Quoted 7 lines
drivers/spi/spi-pic32.c +1
-6-dma_cap_zero (mask); -dma_cap_set (DMA_SLAVE , mask); - - master->dma_rx =dma_request_slave_channel_compat (mask,NULL ,NULL , - dev,"spi-rx" ); -if (!master->dma_rx) { + master->dma_rx =dma_request_chan (dev,"spi-rx" );Why not
dma_request_slave_channel()?
The longer term plan is to retire dma_request_slave_channel() as well. With dma_request_chan() deferred probing against DMA drivers is possible and it also supports legacy boot with dma_slave_map.
At the end we should be left with only dma_request_chan() for slave channels in the kernel.
Quoted 10 lines
That way you...
drivers/spi/spi-pic32.c static void pic32_spi_cleanup(struct spi_device *spi) · line 614
Quoted 1 line
drivers/spi/spi-pic32.c +1
-0+if (IS_ERR (master->dma_rx)) {... don't have to change the NULL check here, and...
drivers/spi/spi-pic32.c static void pic32_spi_cleanup(struct spi_device *spi) · line 616
Quoted 2 lines
drivers/spi/spi-pic32.c +1
-0dev_warn (dev,"RX channel not found.\n" ); + master->dma_rx =NULL ;... don't have to override by NULL here.
It is a small sacrifice, true, but if anyone cares the driver can support deferred probing with dma_request_chan().
Quoted 7 lines
(same for TX below).
Gr{oetje,eeting}s,
Geert
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Geert Uytterhoeven
Reviewed-byHi Peter,
Quoted 27 lines · Peter Ujfalusi
Quoted 16 lines · Geert Uytterhoeven
Quoted 15 lines · Peter Ujfalusi
There is no reason to use the
dma_request_slave_channel_compat()as no filter function and parameter is provided.Switch the driver to use
dma_request_chan()instead.Signed-off-by Peter Ujfalusi <[email protected]>drivers/spi/spi-pic32.c +0
-1@@ -609,22 +609,18 @@ static void pic32_spi_cleanup(struct spi_device *spi)static void pic32_spi_dma_prep (struct pic32_spi *pic32s,struct device *dev) {struct spi_master *master = pic32s->master; -dma_cap_mask_t mask;Quoted 9 lines
drivers/spi/spi-pic32.c static void pic32_spi_cleanup(struct spi_device *spi) · line 613
Quoted 7 lines
drivers/spi/spi-pic32.c +1
-6-dma_cap_zero (mask); -dma_cap_set (DMA_SLAVE , mask); - - master->dma_rx =dma_request_slave_channel_compat (mask,NULL ,NULL , - dev,"spi-rx" ); -if (!master->dma_rx) { + master->dma_rx =dma_request_chan (dev,"spi-rx" );Why not
dma_request_slave_channel()?
Quoted 6 lines
The longer term plan is to retire
dma_request_slave_channel()as well. Withdma_request_chan()deferred probing against DMA drivers is possible and it also supports legacy boot withdma_slave_map.At the end we should be left with only
dma_request_chan()for slave channels in the kernel.
Thank you, deferred probing is a valid argument. You may want to add that to the patch description.
Quoted 6 lines
Quoted 6 lines
That way you...
drivers/spi/spi-pic32.c static void pic32_spi_cleanup(struct spi_device *spi) · line 614
Quoted 1 line
drivers/spi/spi-pic32.c +1
-0+if (IS_ERR (master->dma_rx)) {... don't have to change the NULL check here, and...
Quoted 7 lines
Quoted 4 lines
drivers/spi/spi-pic32.c static void pic32_spi_cleanup(struct spi_device *spi) · line 616
Quoted 2 lines
drivers/spi/spi-pic32.c +1
-0dev_warn (dev,"RX channel not found.\n" ); + master->dma_rx =NULL ;... don't have to override by NULL here.
It is a small sacrifice, true, but if anyone cares the driver can support deferred probing with
dma_request_chan().
Deferred probing in case of missing DMA controllers is always a bit tricky, as there are multiple options:
1. Defer probing of the slave driver,
2a. Continue probing of the slave driver, fall back to PIO (which is
what this driver does)
2b. and Retry DMA setup later.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds