9
0
Fork 0
barebox/drivers/mci
Antony Pavlov 377d261708 of: use 'const void *' for struct of_device_id.data
Since 2011 barebox' of_device_id struct uses unsigned long type for data field:

    struct of_device_id {
            char *compatible;
            unsigned long data;
    };

Almost always struct of_device_id.data field are used as pointer
and need 'unsigned long' casting.

E.g. see 'git grep -A 4 of_device_id drivers/' output:

    drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = {
    drivers/ata/sata-imx.c- {
    drivers/ata/sata-imx.c-         .compatible = "fsl,imx6q-ahci",
    drivers/ata/sata-imx.c-         .data = (unsigned long)&data_imx6,
    drivers/ata/sata-imx.c- }, {

Here is of_device_id struct in linux kernel v4.0:

    struct of_device_id {
            char name[32];
            char type[32];
            char compatible[128];
            const void *data;
    };

Changing of_device_id.data type to 'const void *data' will increase
barebox' linux kernel compatibility and decrease number of 'unsigned
long' casts.

Part of the patch was done using the 'coccinelle' tool with the
following semantic patch:

    @rule1@
    identifier dev;
    identifier type;
    identifier func;
    @@
    func(...) {
    <...
    - dev_get_drvdata(dev, (unsigned long *)&type)
    + dev_get_drvdata(dev, (const void **)&type)
    ...>
    }
    @rule2@
    identifier dev;
    identifier type;
    identifier func;
    identifier data;
    @@
    func(...) {
    <...
    - dev_get_drvdata(dev, (unsigned long *)&type->data)
    + dev_get_drvdata(dev, (const void **)&type->data)
    ...>
    }

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-30 08:12:57 +02:00
..
Kconfig Merge branch 'for-next/streaming-dma' 2015-03-09 08:32:21 +01:00
Makefile tegra: add SDMMC controller driver 2013-12-04 16:57:35 +01:00
atmel-mci-regs.h atmel_mci: use linux regs define 2013-01-25 19:52:14 +01:00
atmel_mci.c Merge branch 'for-next/resource-err-ptr' 2014-10-02 08:54:42 +02:00
dw_mmc.c MMC: dw_mmc: PIO mode fixes 2015-03-09 11:40:20 +01:00
imx-esdhc.c MCI: imx: convert to streaming DMA ops 2015-03-06 07:52:02 +01:00
imx-esdhc.h mci: esdhc: add back PIO_TIMEOUT 2014-11-24 14:04:10 +01:00
imx.c resource: Let dev_request_mem_region return an error pointer 2014-09-16 08:32:10 +02:00
mci-bcm2835.c resource: Let dev_request_mem_region return an error pointer 2014-09-16 08:32:10 +02:00
mci-bcm2835.h mci: bcm2835: use the registered device clkdev 2013-10-22 15:28:59 +02:00
mci-core.c mci: core: Check return value of dev_add_param_bool 2015-03-19 07:52:24 +01:00
mci_spi.c Introduce device_spi_driver() macro and use it for SPI drivers 2013-03-14 07:15:45 +01:00
mmci.c treewide: remove address of the Free Software Foundation 2014-06-11 08:35:25 +02:00
mmci.h add: mmci drivers 2013-10-22 16:49:48 +02:00
mxs.c mci: mxs: Add devicetree support 2015-01-28 08:18:44 +01:00
omap_hsmmc.c of: use 'const void *' for struct of_device_id.data 2015-04-30 08:12:57 +02:00
pxamci.c resource: Let dev_request_mem_region return an error pointer 2014-09-16 08:32:10 +02:00
pxamci.h mci: pxamci fix CMD12 handling 2012-04-17 22:02:54 +02:00
s3c.c resource: Let dev_request_mem_region return an error pointer 2014-09-16 08:32:10 +02:00
sdhci.h MMC: IMX: Reset MMC_BOOT register after controller reset. 2015-01-19 08:38:12 +01:00
tegra-sdmmc.c Merge branch 'for-next/tegra' 2015-03-09 08:32:26 +01:00