acpi-dma: fix sparse warning
Subsystems (2)
Andy Shevchenko
reviewerPATCH 1/6 acpi-dma: fix sparse warning
This patch fixes sparse warning:
drivers/dma/acpi-dma.c:76:21: sparse: cast to restricted __le32
Since everything in all ACPI tables is little-endian, by definition, the used types in practice are uXX. Thus, we have to enforce __leXX if we want to convert them to CPU order.
--- drivers/dma/acpi-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/acpi-dma.c +1 -1
@@ -73,7 +73,7 @@ static int acpi_dma_parse_resource_group(const struct acpi_csrt_group *grp,if (si->mmio_base_low != mem || si->gsi_interrupt != irq)return 0 ; - vendor_id =le32_to_cpu (grp->vendor_id); + vendor_id =le32_to_cpu ((__force __le32 )grp->vendor_id);dev_dbg (&adev->dev,"matches with %.4s%04X (rev %u)\n" , (char *)&vendor_id, grp->device_id, grp->revision);
Signature · 1 line
1.8.3.2
Andy Shevchenko
reviewerPATCH 2/6 dma: dw: append MODULE_DEVICE_TABLE for ACPI case
In rare cases (mostly for the testing purposes) the dw_dmac driver might be compiled as a module as well as the other LPSS device drivers (I2C, SPI, HSUART). When udev handles the event of the devices appearing the dw_dmac module is missing. This patch will fix that.
--- drivers/dma/dw/platform.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/dw/platform.c +1 -0
@@ -253,6 +253,7 @@ static const struct acpi_device_id dw_dma_acpi_id_table[] = { { "INTL9C60", 0 }, { } }; +MODULE_DEVICE_TABLE(acpi, dw_dma_acpi_id_table); #endif #ifdef CONFIG_PM_SLEEP
Signature · 1 line
1.8.3.2
Andy Shevchenko
reviewerPATCH 3/6 dma: dw: improve comparison with ~0
In reply to Andy ShevchenkoIn general ~0 does not fit some integer types. Let's do a helper to make a comparison with that constant properly.
--- drivers/dma/dw/core.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/dma/dw/core.c +11 -5
@@ -37,16 +37,22 @@* which does not support descriptor writeback. */ +static inline bool is_request_line_unset (struct dw_dma_chan *dwc) +{ + return dwc->request_line == (typeof(dwc->request_line))~0; +} +static inline void dwc_set_masters (struct dw_dma_chan *dwc) {struct dw_dma *dw =to_dw_dma (dwc->chan.device);struct dw_dma_slave *dws = dwc->chan.private;unsigned char mmax = dw->nr_masters -1 ; -if (dwc->request_line == ~0 ) { - dwc->src_master = min_t(unsigned char, mmax, dwc_get_sms(dws)); - dwc->dst_master = min_t(unsigned char, mmax, dwc_get_dms(dws)); - } +if (!is_request_line_unset (dwc)) +return ; + + dwc->src_master = min_t(unsigned char, mmax, dwc_get_sms(dws)); + dwc->dst_master = min_t(unsigned char, mmax, dwc_get_dms(dws)); }#define DWC_DEFAULT_CTLLO (_chan) ({ \
@@ -984,7 +990,7 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig) dwc->direction = sconfig->direction;/* Take the request line from slave_id member */ -if (dwc->request_line == ~0 ) +if (is_request_line_unset (dwc)) dwc->request_line = sconfig->slave_id;convert_burst (&dwc->dma_sconfig.src_maxburst);
Signature · 1 line
1.8.3.2
Andy Shevchenko
reviewerPATCH 4/6 dma: dw: allow shared interrupts
In reply to Andy ShevchenkoIn the PC world is quite possible that devices are sharing the same interrupt line. The patch prepares dw_dmac driver to such cases.
--- drivers/dma/dw/core.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/dma/dw/core.c +8 -5
@@ -650,10 +650,13 @@ static void dw_dma_tasklet(unsigned long data)static irqreturn_t dw_dma_interrupt (int irq,void *dev_id) {struct dw_dma *dw = dev_id; -u32 status; +u32 status =dma_readl (dw,STATUS_INT ); -dev_vdbg (dw->dma.dev,"%s: status=0x%x\n" , __func__, -dma_readl (dw,STATUS_INT )); +dev_vdbg (dw->dma.dev,"%s: status=0x%x\n" , __func__, status); + +/* Check if we have any interrupt from the DMAC */ +if (!status) +return IRQ_NONE ;/* * Just disable the interrupts. We'll turn them back on in the
@@ -1567,8 +1570,8 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)/* Disable BLOCK interrupts as well */ channel_clear_bit (dw,MASK .BLOCK, dw->all_chan_mask); - err =devm_request_irq (chip->dev, chip->irq, dw_dma_interrupt,0 , -"dw_dmac" , dw); + err =devm_request_irq (chip->dev, chip->irq, dw_dma_interrupt, +IRQF_SHARED ,"dw_dmac" , dw);if (err)return err;
Signature · 1 line
1.8.3.2
Andy Shevchenko
reviewerPATCH 5/6 dma: dw: return DMA_SUCCESS immediately from device_tx_status()
In reply to Andy ShevchenkoThere is no point to go throught the rest of the function if first call to dma_cookie_status() returned DMA_SUCCESS.
--- drivers/dma/dw/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/dma/dw/core.c +4 -4
@@ -1098,12 +1098,12 @@ dwc_tx_status(struct dma_chan *chan,enum dma_status ret; ret =dma_cookie_status (chan, cookie, txstate); -if (ret !=DMA_SUCCESS ) { -dwc_scan_descriptors (to_dw_dma (chan->device), dwc); +if (ret ==DMA_SUCCESS ) +return ret; - ret =dma_cookie_status (chan, cookie, txstate); - } +dwc_scan_descriptors (to_dw_dma (chan->device), dwc); + ret =dma_cookie_status (chan, cookie, txstate);if (ret !=DMA_SUCCESS )dma_set_residue (txstate,dwc_get_residue (dwc));
Signature · 1 line
1.8.3.2
Andy Shevchenko
reviewerPATCH 6/6 dma: dw: return DMA_PAUSED only if cookie status is DMA_IN_PROGRESS
In reply to Andy ShevchenkoTo obey a usual practice let's return DMA_PAUSED status only if dma_cookie_status returned DMA_IN_PROGRESS.
--- drivers/dma/dw/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/dw/core.c +1 -1
@@ -1107,7 +1107,7 @@ dwc_tx_status(struct dma_chan *chan,if (ret !=DMA_SUCCESS )dma_set_residue (txstate,dwc_get_residue (dwc)); -if (dwc->paused) +if (dwc->paused && ret ==DMA_IN_PROGRESS )return DMA_PAUSED ;return ret;
Signature · 1 line
1.8.3.2
Quoted 7 lines · Andy Shevchenko
This patch fixes sparse warning:
drivers/dma/acpi-dma.c:76:21: sparse: cast to restricted __le32Since everything in all ACPI tables is little-endian, by definition, the used types in practice are uXX. Thus, we have to enforce
__leXXif we want to convert them to CPU order.
Quoted 5 lines
Signed-off-by Andy Shevchenko <[email protected]>Reviewed-by Mika Westerberg <[email protected]>--- drivers/dma/acpi-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
For the complete series:
Vinod Koul
AppliedQuoted 9 lines · Andy Shevchenko
This patch fixes sparse warning:
drivers/dma/acpi-dma.c:76:21: sparse: cast to restricted __le32Since everything in all ACPI tables is little-endian, by definition, the used types in practice are uXX. Thus, we have to enforce
__leXXif we want to convert them to CPU order.Signed-off-by Andy Shevchenko <[email protected]>Reviewed-by Mika Westerberg <[email protected]>
Applied all, thanks
--
~Vinod