summaryrefslogtreecommitdiffstats
path: root/drivers/video
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/video
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/video')
-rw-r--r--drivers/video/imx-ipu-v3/imx-hdmi.c8
-rw-r--r--drivers/video/imx-ipu-v3/imx-ldb.c6
-rw-r--r--drivers/video/imx-ipu-v3/ipu-common.c8
3 files changed, 11 insertions, 11 deletions
diff --git a/drivers/video/imx-ipu-v3/imx-hdmi.c b/drivers/video/imx-ipu-v3/imx-hdmi.c
index 2da76a4b7a..e01bfe8f31 100644
--- a/drivers/video/imx-ipu-v3/imx-hdmi.c
+++ b/drivers/video/imx-ipu-v3/imx-hdmi.c
@@ -1125,10 +1125,10 @@ static struct imx_hdmi_data imx6dl_hdmi_data = {
static struct of_device_id imx_hdmi_dt_ids[] = {
{
.compatible = "fsl,imx6q-hdmi",
- .data = (unsigned long)&imx6q_hdmi_data,
+ .data = &imx6q_hdmi_data,
}, {
.compatible = "fsl,imx6dl-hdmi",
- .data = (unsigned long)&imx6dl_hdmi_data,
+ .data = &imx6dl_hdmi_data,
}, {
/* sentinel */
}
@@ -1175,7 +1175,7 @@ static int imx_hdmi_probe(struct device_d *dev)
int ret;
const struct imx_hdmi_data *devtype;
- ret = dev_get_drvdata(dev, (unsigned long *)&devtype);
+ ret = dev_get_drvdata(dev, (const void **)&devtype);
if (ret)
return ret;
@@ -1186,7 +1186,7 @@ static int imx_hdmi_probe(struct device_d *dev)
hdmi->sample_rate = 48000;
hdmi->ratio = 100;
- ret = dev_get_drvdata(dev, (unsigned long *)&hdmi->dev_type);
+ ret = dev_get_drvdata(dev, (const void **)&hdmi->dev_type);
if (ret)
return ret;
diff --git a/drivers/video/imx-ipu-v3/imx-ldb.c b/drivers/video/imx-ipu-v3/imx-ldb.c
index 70429eb5d8..a05bfad8c0 100644
--- a/drivers/video/imx-ipu-v3/imx-ldb.c
+++ b/drivers/video/imx-ipu-v3/imx-ldb.c
@@ -249,7 +249,7 @@ static int imx_ldb_probe(struct device_d *dev)
int mapping;
const struct imx_ldb_data *devtype;
- ret = dev_get_drvdata(dev, (unsigned long *)&devtype);
+ ret = dev_get_drvdata(dev, (const void **)&devtype);
if (ret)
return ret;
@@ -322,8 +322,8 @@ static int imx_ldb_probe(struct device_d *dev)
}
static struct of_device_id imx_ldb_dt_ids[] = {
- { .compatible = "fsl,imx6q-ldb", (unsigned long)&imx_ldb_data_imx6q},
- { .compatible = "fsl,imx53-ldb", (unsigned long)&imx_ldb_data_imx53},
+ { .compatible = "fsl,imx6q-ldb", &imx_ldb_data_imx6q},
+ { .compatible = "fsl,imx53-ldb", &imx_ldb_data_imx53},
{ /* sentinel */ }
};
diff --git a/drivers/video/imx-ipu-v3/ipu-common.c b/drivers/video/imx-ipu-v3/ipu-common.c
index 5c85f8615c..cd63f04475 100644
--- a/drivers/video/imx-ipu-v3/ipu-common.c
+++ b/drivers/video/imx-ipu-v3/ipu-common.c
@@ -612,9 +612,9 @@ static struct ipu_devtype ipu_type_imx6q = {
};
static struct of_device_id imx_ipu_dt_ids[] = {
- { .compatible = "fsl,imx51-ipu", .data = (unsigned long)&ipu_type_imx51, },
- { .compatible = "fsl,imx53-ipu", .data = (unsigned long)&ipu_type_imx53, },
- { .compatible = "fsl,imx6q-ipu", .data = (unsigned long)&ipu_type_imx6q, },
+ { .compatible = "fsl,imx51-ipu", .data = &ipu_type_imx51, },
+ { .compatible = "fsl,imx53-ipu", .data = &ipu_type_imx53, },
+ { .compatible = "fsl,imx6q-ipu", .data = &ipu_type_imx6q, },
{ /* sentinel */ }
};
@@ -755,7 +755,7 @@ static int ipu_probe(struct device_d *dev)
int i, ret;
const struct ipu_devtype *devtype;
- ret = dev_get_drvdata(dev, (unsigned long *)&devtype);
+ ret = dev_get_drvdata(dev, (const void **)&devtype);
if (ret)
return ret;