9
0
Fork 0
barebox/drivers/serial
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/efi' 2014-08-07 06:14:56 +02:00
Makefile Merge branch 'for-next/efi' 2014-08-07 06:14:56 +02:00
amba-pl011.c amba: pl011: add support for regulator 2015-02-04 15:49:58 +01:00
arm_dcc.c console: drop f_caps and check the function pointer getc/putc instead 2013-09-21 09:59:16 +02:00
atmel.c driver: workaroud resource request that conflicts with errno PTR 2015-01-08 08:07:58 +01:00
efi-stdio.c serial: Add EFI stdio driver 2014-07-16 10:46:18 +02:00
linux_console.c console: drop f_caps and check the function pointer getc/putc instead 2013-09-21 09:59:16 +02:00
serial_altera.c console: drop f_caps and check the function pointer getc/putc instead 2013-09-21 09:59:16 +02:00
serial_altera_jtag.c console: drop f_caps and check the function pointer getc/putc instead 2013-09-21 09:59:16 +02:00
serial_ar933x.c resource: Let dev_request_mem_region return an error pointer 2014-09-16 08:32:10 +02:00
serial_ar933x.h serial: add Atheros AR933x driver 2014-03-28 10:28:15 +01:00
serial_auart.c drivers: remove unnecessary mach/imx-regs.h include 2015-01-05 11:30:59 +01:00
serial_blackfin.c console: drop f_caps and check the function pointer getc/putc instead 2013-09-21 09:59:16 +02:00
serial_cadence.c of: use 'const void *' for struct of_device_id.data 2015-04-30 08:12:57 +02:00
serial_clps711x.c resource: Let dev_get_mem_region return an error pointer 2014-09-16 08:32:10 +02:00
serial_digic.c serial: add driver for Canon DIGIC UART 2014-07-29 15:08:29 +02:00
serial_imx.c of: use 'const void *' for struct of_device_id.data 2015-04-30 08:12:57 +02:00
serial_mpc5xxx.c resource: Let dev_request_mem_region return an error pointer 2014-09-16 08:32:10 +02:00
serial_netx.c console: drop f_caps and check the function pointer getc/putc instead 2013-09-21 09:59:16 +02:00
serial_ns16550.c of: use 'const void *' for struct of_device_id.data 2015-04-30 08:12:57 +02:00
serial_ns16550.h serial: ns16550: Add device ids for omap 2013-11-22 10:56:49 +01:00
serial_omap4_usbboot.c console: drop f_caps and check the function pointer getc/putc instead 2013-09-21 09:59:16 +02:00
serial_pl010.c console: drop f_caps and check the function pointer getc/putc instead 2013-09-21 09:59:16 +02:00
serial_pl010.h Treewide: remove address of the Free Software Foundation 2012-09-17 10:57:41 +02:00
serial_pxa.c console: drop f_caps and check the function pointer getc/putc instead 2013-09-21 09:59:16 +02:00
serial_s3c.c console: drop f_caps and check the function pointer getc/putc instead 2013-09-21 09:59:16 +02:00
stm-serial.c serial: stm_serial: Add devicetree support 2015-01-28 08:18:44 +01:00