mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
spi: spi-dw: fix all sparse warnings
The dw_{read,write}[lw] macros produce sparse warnings everytime they are used. The "read" ones cause: warning: cast removes address space of expression warning: incorrect type in argument 1 (different address spaces) expected void const volatile [noderef] <asn:2>*addr got unsigned int *<noident> And the "write" ones: warning: cast removes address space of expression warning: incorrect type in argument 2 (different address spaces) expected void volatile [noderef] <asn:2>*addr got unsigned int *<noident> Fix this by removing struct dw_spi_reg and converting all the register offsets to #defines. Then convert the macros into inlined functions so that proper type checking can occur. While here, also fix the three sparse warnings in spi-dw-mid.c due to the return value of ioremap_nocache being stored in a u32 * not a void __iomem *. With these changes the spi-dw* files all build with no sparse warnings. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: Feng Tang <feng.tang@intel.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
parent
3e3ea71627
commit
7eb187b3cd
3 changed files with 89 additions and 79 deletions
|
@ -116,13 +116,13 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
|
|||
/* 1. setup DMA related registers */
|
||||
if (cs_change) {
|
||||
spi_enable_chip(dws, 0);
|
||||
dw_writew(dws, dmardlr, 0xf);
|
||||
dw_writew(dws, dmatdlr, 0x10);
|
||||
dw_writew(dws, DW_SPI_DMARDLR, 0xf);
|
||||
dw_writew(dws, DW_SPI_DMATDLR, 0x10);
|
||||
if (dws->tx_dma)
|
||||
dma_ctrl |= 0x2;
|
||||
if (dws->rx_dma)
|
||||
dma_ctrl |= 0x1;
|
||||
dw_writew(dws, dmacr, dma_ctrl);
|
||||
dw_writew(dws, DW_SPI_DMACR, dma_ctrl);
|
||||
spi_enable_chip(dws, 1);
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,8 @@ static struct dw_spi_dma_ops mid_dma_ops = {
|
|||
|
||||
int dw_spi_mid_init(struct dw_spi *dws)
|
||||
{
|
||||
u32 *clk_reg, clk_cdiv;
|
||||
void __iomem *clk_reg;
|
||||
u32 clk_cdiv;
|
||||
|
||||
clk_reg = ioremap_nocache(MRST_CLK_SPI0_REG, 16);
|
||||
if (!clk_reg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue