diff options
author | Antony Pavlov <antonynpavlov@gmail.com> | 2015-04-29 11:56:58 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-04-30 08:12:57 +0200 |
commit | 377d261708d3057200c7ad9647fddb15169fea78 (patch) | |
tree | 9334590c4a63ec0b4ea01b91a7adc627a1ceb699 /drivers/gpio/gpio-mxs.c | |
parent | 92207cde490261c52cc804588561d8f3117cdf87 (diff) | |
download | barebox-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/gpio/gpio-mxs.c')
-rw-r--r-- | drivers/gpio/gpio-mxs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c index 30f9589831..b2b3ad3ac6 100644 --- a/drivers/gpio/gpio-mxs.c +++ b/drivers/gpio/gpio-mxs.c @@ -112,7 +112,7 @@ static int mxs_gpio_probe(struct device_d *dev) struct mxs_gpio_regs *regs; int ret, id; - ret = dev_get_drvdata(dev, (unsigned long *)®s); + ret = dev_get_drvdata(dev, (const void **)®s); if (ret) return ret; @@ -150,10 +150,10 @@ static int mxs_gpio_probe(struct device_d *dev) static __maybe_unused struct of_device_id mxs_gpio_dt_ids[] = { { .compatible = "fsl,imx23-gpio", - .data = (unsigned long)®s_mxs23, + .data = ®s_mxs23, }, { .compatible = "fsl,imx28-gpio", - .data = (unsigned long)®s_mxs28, + .data = ®s_mxs28, }, { /* sentinel */ } |