summaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorAntony Pavlov <antonynpavlov@gmail.com>2015-04-29 11:56:58 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2015-04-30 08:12:57 +0200
commit377d261708d3057200c7ad9647fddb15169fea78 (patch)
tree9334590c4a63ec0b4ea01b91a7adc627a1ceb699 /drivers/clk
parent92207cde490261c52cc804588561d8f3117cdf87 (diff)
downloadbarebox-377d261708d3057200c7ad9647fddb15169fea78.tar.gz
barebox-377d261708d3057200c7ad9647fddb15169fea78.tar.xz
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>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/mvebu/common.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c
index 0e7f65c488..c4774979bd 100644
--- a/drivers/clk/mvebu/common.c
+++ b/drivers/clk/mvebu/common.c
@@ -28,15 +28,15 @@ static struct clk_onecell_data clk_data;
static struct of_device_id mvebu_coreclk_ids[] = {
{ .compatible = "marvell,armada-370-core-clock",
- .data = (u32)&armada_370_coreclks },
+ .data = &armada_370_coreclks },
{ .compatible = "marvell,armada-xp-core-clock",
- .data = (u32)&armada_xp_coreclks },
+ .data = &armada_xp_coreclks },
{ .compatible = "marvell,dove-core-clock",
- .data = (u32)&dove_coreclks },
+ .data = &dove_coreclks },
{ .compatible = "marvell,kirkwood-core-clock",
- .data = (u32)&kirkwood_coreclks },
+ .data = &kirkwood_coreclks },
{ .compatible = "marvell,mv88f6180-core-clock",
- .data = (u32)&mv88f6180_coreclks },
+ .data = &mv88f6180_coreclks },
{ }
};
@@ -139,13 +139,13 @@ static struct clk *clk_gating_get_src(
static struct of_device_id mvebu_clk_gating_ids[] = {
{ .compatible = "marvell,armada-370-gating-clock",
- .data = (u32)&armada_370_gating_desc },
+ .data = &armada_370_gating_desc },
{ .compatible = "marvell,armada-xp-gating-clock",
- .data = (u32)&armada_xp_gating_desc },
+ .data = &armada_xp_gating_desc },
{ .compatible = "marvell,dove-gating-clock",
- .data = (u32)&dove_gating_desc },
+ .data = &dove_gating_desc },
{ .compatible = "marvell,kirkwood-gating-clock",
- .data = (u32)&kirkwood_gating_desc },
+ .data = &kirkwood_gating_desc },
{ }
};