From 377d261708d3057200c7ad9647fddb15169fea78 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Wed, 29 Apr 2015 11:56:58 +0300 Subject: 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 Signed-off-by: Sascha Hauer --- include/of.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/of.h') diff --git a/include/of.h b/include/of.h index 764a2e5939..c1dd4d51ec 100644 --- a/include/of.h +++ b/include/of.h @@ -35,7 +35,7 @@ struct device_node { struct of_device_id { char *compatible; - unsigned long data; + const void *data; }; #define MAX_PHANDLE_ARGS 8 -- cgit v1.2.3