9
0
Fork 0
barebox/drivers/video
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
..
imx-ipu-v3 of: use 'const void *' for struct of_device_id.data 2015-04-30 08:12:57 +02:00
Kconfig video: EDID: depends on I2C 2014-11-27 17:15:05 +01:00
Makefile video: Add i.MX IPUv3 support 2014-03-29 07:57:53 +01:00
atmel_hlcdfb.c ARM: move DMA alloc functions to dma.h 2015-03-06 07:52:02 +01:00
atmel_lcdfb.c ARM: move DMA alloc functions to dma.h 2015-03-06 07:52:02 +01:00
atmel_lcdfb.h video: add Atmel HLCD support 2013-01-31 19:05:50 +01:00
atmel_lcdfb_core.c ARM: move DMA alloc functions to dma.h 2015-03-06 07:52:02 +01:00
bcm2835.c video: add a BCM2835 framebuffer driver 2013-11-06 09:59:05 +01:00
edid.c video: Add edid support 2014-03-29 07:57:53 +01:00
edid.h video: Add edid support 2014-03-29 07:57:53 +01:00
fb.c devinfo: make the output of "devinfo DEVICE" nicer 2014-06-02 09:07:11 +02:00
imx-ipu-fb.c ARM: move DMA alloc functions to dma.h 2015-03-06 07:52:02 +01:00
imx.c resource: Let dev_request_mem_region return an error pointer 2014-09-16 08:32:10 +02:00
of_display_timing.c video: displaytimings: remove two broken error messages 2014-04-23 09:05:52 +02:00
omap.c ARM: move DMA alloc functions to dma.h 2015-03-06 07:52:02 +01:00
omap.h omap-fb: add driver 2013-06-24 21:47:07 +02:00
pxa.c ARM: move DMA alloc functions to dma.h 2015-03-06 07:52:02 +01:00
s3c24xx.c video: introduce struct display_timings 2014-03-29 06:33:34 +01:00
sdl.c video: introduce struct display_timings 2014-03-29 06:33:34 +01:00
simplefb.c video: simplefb: Add a8r8g8b8 support 2013-12-20 11:32:08 +01:00
stm.c drivers: remove unnecessary mach/imx-regs.h include 2015-01-05 11:30:59 +01:00