make struct of_device_id.data const
Subsystems (26)
cover make struct of_device_id.data const
From: Uwe Kleine-K?nig <[email protected]>
Hello,
this series' goal is to make struct of_device_id.data const. Conceptually a driver must not modify the data contained there so making it const is the right thing.
This change might introduce warnings because drivers don't use const to access the data pointed to by of_device_id.data. In most cases the fix is to add some consts.
This series (apart from adding this const in patch 10) fixes all drivers covered by all arm defconfigs (based on v3.5-rc6).
There is one exception though:drivers/regulator/twl-regulator.c (build in omap2plus_defconfig) now issues:
drivers/regulator/twl-regulator.c: In function 'twlreg_probe':
drivers/regulator/twl-regulator.c:1181: warning: assignment discards qualifiers from pointer target type drivers/regulator/twl-regulator.c:1190: warning: assignment discards qualifiers from pointer target type
that is because this driver really modifies his .of_match_table in the precence of a traditionally probed device.
I didn't check deeply, but probably the easiest fix is to remove traditional platform support. Don't know if omap is ready for that though.
And also patch 11 adds some more consts that are possible now after patch 10.
This series is available in my git tree at:
git://git.pengutronix.de/git/ukl/linux.git ofdeviceiddata
Best regards
Uwe
Uwe Kleine-K?nig (11):
spi/imx: make spi_imx_data.devtype_data member point to const data serial/imx: make imx_port.devdata member point to const data
ARM: cache-l2x0: add a const qualifier
misc/atmel_tc: make atmel_tc.tcb_config member point to const data gpio/gpio-omap.c: add a const qualifier
i2c/i2c-omap: add a const qualifier
dmaengine: at_hdmac: add a few const qualifiers spi/spi-omap2-mcspi: add a const qualifier mmc/omap_hsmmc: add a const qualifier
of: add const to struct of_device_id.data gpio/gpio-omap: make platformdata used as of_device_id.data const
arch/arm/mm/cache-l2x0.c | 2 +- drivers/dma/at_hdmac.c | 4 ++-- drivers/gpio/gpio-omap.c | 8 ++++---- drivers/i2c/busses/i2c-omap.c | 3 ++- drivers/mmc/host/omap_hsmmc.c | 2 +- drivers/spi/spi-imx.c | 2 +- drivers/spi/spi-omap2-mcspi.c | 2 +- drivers/tty/serial/imx.c | 2 +- include/linux/atmel_tc.h | 2 +- include/linux/mod_devicetable.h | 2 +- 10 files changed, 15 insertions(+), 14 deletions(-)
Signature · 1 line
1.7.10.4
cover make struct of_device_id.data const
From: Uwe Kleine-K?nig <[email protected]>
Uwe Kleine-K?nig (9):
spi/imx: make spi_imx_data.devtype_data member point to const data serial/imx: make imx_port.devdata member point to const data
ARM: cache-l2x0: add a const qualifier
misc/atmel_tc: make atmel_tc.tcb_config member point to const data gpio/gpio-omap.c: add a const qualifier
i2c/i2c-omap: add a const qualifier spi/spi-omap2-mcspi: add a const qualifier
of: add const to struct of_device_id.data gpio/gpio-omap: make platformdata used as of_device_id.data const
arch/arm/mm/cache-l2x0.c | 2 +- drivers/gpio/gpio-omap.c | 8 ++++---- drivers/i2c/busses/i2c-omap.c | 3 ++- drivers/spi/spi-imx.c | 2 +- drivers/spi/spi-omap2-mcspi.c | 2 +- drivers/tty/serial/imx.c | 2 +- include/linux/atmel_tc.h | 2 +- include/linux/mod_devicetable.h | 2 +- 8 files changed, 12 insertions(+), 11 deletions(-)
Signature · 1 line
1.7.10
cover make struct of_device_id.data const
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
Uwe Kleine-König (9):
spi/imx: make spi_imx_data.devtype_data member point to const data serial/imx: make imx_port.devdata member point to const data
ARM: cache-l2x0: add a const qualifier
misc/atmel_tc: make atmel_tc.tcb_config member point to const data gpio/gpio-omap.c: add a const qualifier
i2c/i2c-omap: add a const qualifier spi/spi-omap2-mcspi: add a const qualifier
of: add const to struct of_device_id.data gpio/gpio-omap: make platformdata used as of_device_id.data const
arch/arm/mm/cache-l2x0.c | 2 +- drivers/gpio/gpio-omap.c | 8 ++++---- drivers/i2c/busses/i2c-omap.c | 3 ++- drivers/spi/spi-imx.c | 2 +- drivers/spi/spi-omap2-mcspi.c | 2 +- drivers/tty/serial/imx.c | 2 +- include/linux/atmel_tc.h | 2 +- include/linux/mod_devicetable.h | 2 +- 8 files changed, 12 insertions(+), 11 deletions(-)
Signature · 7 lines
1.7.10 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/11 spi/imx: make spi_imx_data.devtype_data member point to const data
In reply to y at pengutronix.deFrom: Uwe Kleine-K?nig <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/spi/spi-imx.c: In function spi_imx_probe:
drivers/spi/spi-imx.c:814:24: warning: assignment discards const qualifier from pointer target type [enabled by default]
--- drivers/spi/spi-imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-imx.c +1 -1
@@ -97,7 +97,7 @@ struct spi_imx_data {const void *tx_buf;unsigned int txfifo;/* number of words pushed in tx FIFO */ -struct spi_imx_devtype_data *devtype_data; +const struct spi_imx_devtype_data *devtype_data;int chipselect[0 ]; };
Signature · 1 line
1.7.10.4
PATCH 1/11 spi/imx: make spi_imx_data.devtype_data member point to const data
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/spi/spi-imx.c: In function spi_imx_probe:
drivers/spi/spi-imx.c:814:24: warning: assignment discards const qualifier from pointer target type [enabled by default]
--- drivers/spi/spi-imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-imx.c +1 -1
@@ -97,7 +97,7 @@ struct spi_imx_data {const void *tx_buf;unsigned int txfifo;/* number of words pushed in tx FIFO */ -struct spi_imx_devtype_data *devtype_data; +const struct spi_imx_devtype_data *devtype_data;int chipselect[0 ]; };
Signature · 7 lines
1.7.10.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/11 spi/imx: make spi_imx_data.devtype_data member point to const data
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/spi/spi-imx.c: In function spi_imx_probe:
drivers/spi/spi-imx.c:814:24: warning: assignment discards const qualifier from pointer target type [enabled by default]
--- drivers/spi/spi-imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-imx.c +1 -1
@@ -97,7 +97,7 @@ struct spi_imx_data {const void *tx_buf;unsigned int txfifo;/* number of words pushed in tx FIFO */ -struct spi_imx_devtype_data *devtype_data; +const struct spi_imx_devtype_data *devtype_data;int chipselect[0 ]; };
Signature · 13 lines
1.7.10.4 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ spi-devel-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spi-devel-general
PATCH 2/11 serial/imx: make imx_port.devdata member point to const data
In reply to y at pengutronix.deFrom: Uwe Kleine-K?nig <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/tty/serial/imx.c: In function 'serial_imx_probe_dt':
drivers/tty/serial/imx.c:1430:17: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
--- drivers/tty/serial/imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/imx.c +1 -1
@@ -207,7 +207,7 @@ struct imx_port {unsigned short trcv_delay;/* transceiver delay */ struct clk *clk_ipg;struct clk *clk_per; -struct imx_uart_data *devdata; +const struct imx_uart_data *devdata; };struct imx_port_ucrs {
Signature · 1 line
1.7.10.4
PATCH 2/11 serial/imx: make imx_port.devdata member point to const data
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/tty/serial/imx.c: In function 'serial_imx_probe_dt':
drivers/tty/serial/imx.c:1430:17: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
--- drivers/tty/serial/imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/imx.c +1 -1
@@ -207,7 +207,7 @@ struct imx_port {unsigned short trcv_delay;/* transceiver delay */ struct clk *clk_ipg;struct clk *clk_per; -struct imx_uart_data *devdata; +const struct imx_uart_data *devdata; };struct imx_port_ucrs {
Signature · 7 lines
1.7.10.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 2/11 serial/imx: make imx_port.devdata member point to const data
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/tty/serial/imx.c: In function 'serial_imx_probe_dt':
drivers/tty/serial/imx.c:1430:17: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
--- drivers/tty/serial/imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/imx.c +1 -1
@@ -207,7 +207,7 @@ struct imx_port {unsigned short trcv_delay;/* transceiver delay */ struct clk *clk_ipg;struct clk *clk_per; -struct imx_uart_data *devdata; +const struct imx_uart_data *devdata; };struct imx_port_ucrs {
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/11 ARM: cache-l2x0: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-K?nig <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
arch/arm/mm/cache-l2x0.c: In function 'l2x0_of_init': arch/arm/mm/cache-l2x0.c:573:7: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
though.
--- arch/arm/mm/cache-l2x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/cache-l2x0.c +1 -1
@@ -554,7 +554,7 @@ static const struct of_device_id l2x0_ids[] __initconst = {int __init l2x0_of_init (u32 aux_val,u32 aux_mask) {struct device_node *np; -struct l2x0_of_data *data; +const struct l2x0_of_data *data;struct resource res; np =of_find_matching_node (NULL , l2x0_ids);
Signature · 1 line
1.7.10.4
PATCH 3/11 ARM: cache-l2x0: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
arch/arm/mm/cache-l2x0.c: In function 'l2x0_of_init': arch/arm/mm/cache-l2x0.c:573:7: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
though.
--- arch/arm/mm/cache-l2x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/cache-l2x0.c +1 -1
@@ -554,7 +554,7 @@ static const struct of_device_id l2x0_ids[] __initconst = {int __init l2x0_of_init (u32 aux_val,u32 aux_mask) {struct device_node *np; -struct l2x0_of_data *data; +const struct l2x0_of_data *data;struct resource res; np =of_find_matching_node (NULL , l2x0_ids);
Signature · 7 lines
1.7.10.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 4/11 misc/atmel_tc: make atmel_tc.tcb_config member point to const data
In reply to y at pengutronix.deFrom: Uwe Kleine-K?nig <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/misc/atmel_tclib.c: In function 'tc_probe':
drivers/misc/atmel_tclib.c:170: warning: assignment discards qualifiers from pointer target type
---
Hello,
btw, get_maintainer.pl suggested to Cc:
linux-atm-general at lists.sourceforge.net but not the Atmel people because include/linux/atmel_tc.h matches include/linux/atm*.
Best regards
Uwe
include/linux/atmel_tc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/atmel_tc.h +1 -1
@@ -63,7 +63,7 @@ struct atmel_tc {struct platform_device *pdev;struct resource *iomem;void __iomem *regs; -struct atmel_tcb_config *tcb_config; +const struct atmel_tcb_config *tcb_config;int irq[3 ];struct clk *clk[3 ];struct list_head node;
Signature · 1 line
1.7.10.4
PATCH 4/11 misc/atmel_tc: make atmel_tc.tcb_config member point to const data
On 07/13/2012 02:32 PM, y at pengutronix.de :
Quoted 10 lines
From: Uwe Kleine-K?nig <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/misc/atmel_tclib.c: In function 'tc_probe':
drivers/misc/atmel_tclib.c:170: warning: assignment discards qualifiers from pointer target typeSigned-off-by Uwe Kleine-K?nig <[email protected]>Cc Nicolas Ferre <[email protected]>
Thanks Uwe!
Quoted 7 lines
Cc Greg Kroah-Hartman <[email protected]>---
Hello,btw, get_maintainer.pl suggested to Cc:
linux-atm-general at lists.sourceforge.net but not the Atmel people becauseinclude/linux/atmel_tc.hmatchesinclude/linux/atm*.
Ah, ok, good to know. I will try to update MAINTAINERS file for this.
Bye,
Quoted 19 lines
Best regards
Uweinclude/linux/atmel_tc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/atmel_tc.h +1
-1@@ -63,7 +63,7 @@ struct atmel_tc {struct platform_device *pdev;struct resource *iomem;void __iomem *regs; -struct atmel_tcb_config *tcb_config; +const struct atmel_tcb_config *tcb_config;int irq[3 ];struct clk *clk[3 ];struct list_head node;
Signature · 1 line
Nicolas Ferre
PATCH 4/11 misc/atmel_tc: make atmel_tc.tcb_config member point to const data
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/misc/atmel_tclib.c: In function 'tc_probe':
drivers/misc/atmel_tclib.c:170: warning: assignment discards qualifiers from pointer target type
---
Hello,
btw, get_maintainer.pl suggested to Cc:
[email protected] but not the Atmel people because include/linux/atmel_tc.h matches include/linux/atm*.
Best regards
Uwe
include/linux/atmel_tc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/atmel_tc.h +1 -1
@@ -63,7 +63,7 @@ struct atmel_tc {struct platform_device *pdev;struct resource *iomem;void __iomem *regs; -struct atmel_tcb_config *tcb_config; +const struct atmel_tcb_config *tcb_config;int irq[3 ];struct clk *clk[3 ];struct list_head node;
Signature · 7 lines
1.7.10.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 5/11 gpio/gpio-omap.c: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-K?nig <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/gpio/gpio-omap.c: In function 'omap_gpio_probe':
drivers/gpio/gpio-omap.c:1060: warning: assignment discards qualifiers from pointer target type
--- drivers/gpio/gpio-omap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-omap.c +1 -1
@@ -1050,7 +1050,7 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct device_node *node = dev->of_node;const struct of_device_id *match; -struct omap_gpio_platform_data *pdata; +const struct omap_gpio_platform_data *pdata;struct resource *res;struct gpio_bank *bank;int ret =0 ;
Signature · 1 line
1.7.10.4
PATCH 5/11 gpio/gpio-omap.c: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/gpio/gpio-omap.c: In function 'omap_gpio_probe':
drivers/gpio/gpio-omap.c:1060: warning: assignment discards qualifiers from pointer target type
--- drivers/gpio/gpio-omap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-omap.c +1 -1
@@ -1050,7 +1050,7 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct device_node *node = dev->of_node;const struct of_device_id *match; -struct omap_gpio_platform_data *pdata; +const struct omap_gpio_platform_data *pdata;struct resource *res;struct gpio_bank *bank;int ret =0 ;
Signature · 7 lines
1.7.10.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 6/11 i2c/i2c-omap: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-K?nig <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/i2c/busses/i2c-omap.c: In function 'omap_i2c_probe':
drivers/i2c/busses/i2c-omap.c:1025: warning: assignment discards qualifiers from pointer target type
--- drivers/i2c/busses/i2c-omap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-omap.c +2 -1
@@ -987,7 +987,8 @@ omap_i2c_probe(struct platform_device *pdev)struct omap_i2c_dev *dev;struct i2c_adapter *adap;struct resource *mem, *irq, *ioarea; -struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data; +const struct omap_i2c_bus_platform_data *pdata = + pdev->dev.platform_data;struct device_node *node = pdev->dev.of_node;const struct of_device_id *match;irq_handler_t isr;
Signature · 1 line
1.7.10.4
PATCH 6/11 i2c/i2c-omap: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/i2c/busses/i2c-omap.c: In function 'omap_i2c_probe':
drivers/i2c/busses/i2c-omap.c:1025: warning: assignment discards qualifiers from pointer target type
--- drivers/i2c/busses/i2c-omap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-omap.c +2 -1
@@ -987,7 +987,8 @@ omap_i2c_probe(struct platform_device *pdev)struct omap_i2c_dev *dev;struct i2c_adapter *adap;struct resource *mem, *irq, *ioarea; -struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data; +const struct omap_i2c_bus_platform_data *pdata = + pdev->dev.platform_data;struct device_node *node = pdev->dev.of_node;const struct of_device_id *match;irq_handler_t isr;
Signature · 1 line
1.7.10.4
PATCH 6/11 i2c/i2c-omap: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/i2c/busses/i2c-omap.c: In function 'omap_i2c_probe':
drivers/i2c/busses/i2c-omap.c:1025: warning: assignment discards qualifiers from pointer target type
--- drivers/i2c/busses/i2c-omap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-omap.c +2 -1
@@ -987,7 +987,8 @@ omap_i2c_probe(struct platform_device *pdev)struct omap_i2c_dev *dev;struct i2c_adapter *adap;struct resource *mem, *irq, *ioarea; -struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data; +const struct omap_i2c_bus_platform_data *pdata = + pdev->dev.platform_data;struct device_node *node = pdev->dev.of_node;const struct of_device_id *match;irq_handler_t isr;
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/11 i2c/i2c-omap: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/i2c/busses/i2c-omap.c: In function 'omap_i2c_probe':
drivers/i2c/busses/i2c-omap.c:1025: warning: assignment discards qualifiers from pointer target type
--- drivers/i2c/busses/i2c-omap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-omap.c +2 -1
@@ -987,7 +987,8 @@ omap_i2c_probe(struct platform_device *pdev)struct omap_i2c_dev *dev;struct i2c_adapter *adap;struct resource *mem, *irq, *ioarea; -struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data; +const struct omap_i2c_bus_platform_data *pdata = + pdev->dev.platform_data;struct device_node *node = pdev->dev.of_node;const struct of_device_id *match;irq_handler_t isr;
Signature · 7 lines
1.7.10.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 7/11 dmaengine: at_hdmac: add a few const qualifiers
In reply to y at pengutronix.deFrom: Uwe Kleine-K?nig <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/dma/at_hdmac.c: In function 'at_dma_get_driver_data':
drivers/dma/at_hdmac.c:1228: warning: return discards qualifiers from pointer target type
--- drivers/dma/at_hdmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/at_hdmac.c +2 -2
@@ -1217,7 +1217,7 @@ static const struct platform_device_id atdma_devtypes[] = { } }; -static inline struct at_dma_platform_data *__init at_dma_get_driver_data ( +static inline const struct at_dma_platform_data *__init at_dma_get_driver_data (struct platform_device *pdev) {if (pdev->dev.of_node) {
@@ -1255,7 +1255,7 @@ static int __init at_dma_probe(struct platform_device *pdev)int irq;int err;int i; -struct at_dma_platform_data *plat_dat; +const struct at_dma_platform_data *plat_dat;/* setup platform data for each SoC */ dma_cap_set (DMA_MEMCPY , at91sam9rl_config.cap_mask);
Signature · 1 line
1.7.10.4
PATCH 7/11 dmaengine: at_hdmac: add a few const qualifiers
On 07/13/2012 02:32 PM, y at pengutronix.de :
Quoted 10 lines
From: Uwe Kleine-K?nig <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/dma/at_hdmac.c: In function 'at_dma_get_driver_data':
drivers/dma/at_hdmac.c:1228: warning: return discards qualifiers from pointer target typeSigned-off-by Uwe Kleine-K?nig <[email protected]>Cc Nicolas Ferre <[email protected]>
Quoted 29 lines
Cc Dan Williams <[email protected]>Cc Vinod Koul <[email protected]>--- drivers/dma/at_hdmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/dma/at_hdmac.c +2
-2@@ -1217,7 +1217,7 @@ static const struct platform_device_id atdma_devtypes[] = { } }; -static inline struct at_dma_platform_data *__init at_dma_get_driver_data ( +static inline const struct at_dma_platform_data *__init at_dma_get_driver_data (struct platform_device *pdev) {if (pdev->dev.of_node) {@@ -1255,7 +1255,7 @@ static int __init at_dma_probe(struct platform_device *pdev)int irq;int err;int i; -struct at_dma_platform_data *plat_dat; +const struct at_dma_platform_data *plat_dat;/* setup platform data for each SoC */ dma_cap_set (DMA_MEMCPY , at91sam9rl_config.cap_mask);
Signature · 1 line
Nicolas Ferre
Vinod Koul
AppliedPATCH 7/11 dmaengine: at_hdmac: add a few const qualifiers
In reply to y at pengutronix.deQuoted 7 lines · y at pengutronix.de
From: Uwe Kleine-K?nig <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/dma/at_hdmac.c: In function 'at_dma_get_driver_data':
drivers/dma/at_hdmac.c:1228: warning: return discards qualifiers from pointer target type
Applied, thanks.
By now, you should know git-send-mail asks for sender name and don't hit "y". Bitten once, am careful about it :D
Signature · 1 line
~Vinod
PATCH 7/11 dmaengine: at_hdmac: add a few const qualifiers
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/dma/at_hdmac.c: In function 'at_dma_get_driver_data':
drivers/dma/at_hdmac.c:1228: warning: return discards qualifiers from pointer target type
--- drivers/dma/at_hdmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/at_hdmac.c +2 -2
@@ -1217,7 +1217,7 @@ static const struct platform_device_id atdma_devtypes[] = { } }; -static inline struct at_dma_platform_data *__init at_dma_get_driver_data ( +static inline const struct at_dma_platform_data *__init at_dma_get_driver_data (struct platform_device *pdev) {if (pdev->dev.of_node) {
@@ -1255,7 +1255,7 @@ static int __init at_dma_probe(struct platform_device *pdev)int irq;int err;int i; -struct at_dma_platform_data *plat_dat; +const struct at_dma_platform_data *plat_dat;/* setup platform data for each SoC */ dma_cap_set (DMA_MEMCPY , at91sam9rl_config.cap_mask);
Signature · 7 lines
1.7.10.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 8/11 spi/spi-omap2-mcspi: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-K?nig <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/spi/spi-omap2-mcspi.c: In function 'omap2_mcspi_probe':
drivers/spi/spi-omap2-mcspi.c:1118: warning: assignment discards qualifiers from pointer target type
--- drivers/spi/spi-omap2-mcspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-omap2-mcspi.c +1 -1
@@ -1087,7 +1087,7 @@ MODULE_DEVICE_TABLE(of, omap_mcspi_of_match);static int __devinit omap2_mcspi_probe (struct platform_device *pdev) {struct spi_master *master; -struct omap2_mcspi_platform_config *pdata; +const struct omap2_mcspi_platform_config *pdata;struct omap2_mcspi *mcspi;struct resource *r;int status =0 , i;
Signature · 1 line
1.7.10.4
PATCH 8/11 spi/spi-omap2-mcspi: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/spi/spi-omap2-mcspi.c: In function 'omap2_mcspi_probe':
drivers/spi/spi-omap2-mcspi.c:1118: warning: assignment discards qualifiers from pointer target type
--- drivers/spi/spi-omap2-mcspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-omap2-mcspi.c +1 -1
@@ -1087,7 +1087,7 @@ MODULE_DEVICE_TABLE(of, omap_mcspi_of_match);static int __devinit omap2_mcspi_probe (struct platform_device *pdev) {struct spi_master *master; -struct omap2_mcspi_platform_config *pdata; +const struct omap2_mcspi_platform_config *pdata;struct omap2_mcspi *mcspi;struct resource *r;int status =0 , i;
Signature · 7 lines
1.7.10.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 8/11 spi/spi-omap2-mcspi: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/spi/spi-omap2-mcspi.c: In function 'omap2_mcspi_probe':
drivers/spi/spi-omap2-mcspi.c:1118: warning: assignment discards qualifiers from pointer target type
--- drivers/spi/spi-omap2-mcspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-omap2-mcspi.c +1 -1
@@ -1087,7 +1087,7 @@ MODULE_DEVICE_TABLE(of, omap_mcspi_of_match);static int __devinit omap2_mcspi_probe (struct platform_device *pdev) {struct spi_master *master; -struct omap2_mcspi_platform_config *pdata; +const struct omap2_mcspi_platform_config *pdata;struct omap2_mcspi *mcspi;struct resource *r;int status =0 , i;
Signature · 13 lines
1.7.10.4 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ spi-devel-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spi-devel-general
PATCH 9/11 mmc/omap_hsmmc: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-K?nig <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/mmc/host/omap_hsmmc.c: In function 'omap_hsmmc_probe':
drivers/mmc/host/omap_hsmmc.c:1808: warning: initialization discards qualifiers from pointer target type
--- drivers/mmc/host/omap_hsmmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/omap_hsmmc.c +1 -1
@@ -1805,7 +1805,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)if (match) { pdata =of_get_hsmmc_pdata (&pdev->dev);if (match->data) { -u16 *offsetp = match->data; +const u16 *offsetp = match->data; pdata->reg_offset = *offsetp; } }
Signature · 1 line
1.7.10.4
PATCH 9/11 mmc/omap_hsmmc: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/mmc/host/omap_hsmmc.c: In function 'omap_hsmmc_probe':
drivers/mmc/host/omap_hsmmc.c:1808: warning: initialization discards qualifiers from pointer target type
--- drivers/mmc/host/omap_hsmmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/omap_hsmmc.c +1 -1
@@ -1805,7 +1805,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)if (match) { pdata =of_get_hsmmc_pdata (&pdev->dev);if (match->data) { -u16 *offsetp = match->data; +const u16 *offsetp = match->data; pdata->reg_offset = *offsetp; } }
Signature · 1 line
1.7.10.4
PATCH 9/11 mmc/omap_hsmmc: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/mmc/host/omap_hsmmc.c: In function 'omap_hsmmc_probe':
drivers/mmc/host/omap_hsmmc.c:1808: warning: initialization discards qualifiers from pointer target type
--- drivers/mmc/host/omap_hsmmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/omap_hsmmc.c +1 -1
@@ -1805,7 +1805,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)if (match) { pdata =of_get_hsmmc_pdata (&pdev->dev);if (match->data) { -u16 *offsetp = match->data; +const u16 *offsetp = match->data; pdata->reg_offset = *offsetp; } }
Signature · 7 lines
1.7.10.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 9/11 mmc/omap_hsmmc: add a const qualifier
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
This prepares of_device_id.data becoming const. Without this change the following warning would occur:
drivers/mmc/host/omap_hsmmc.c: In function 'omap_hsmmc_probe':
drivers/mmc/host/omap_hsmmc.c:1808: warning: initialization discards qualifiers from pointer target type
--- drivers/mmc/host/omap_hsmmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/omap_hsmmc.c +1 -1
@@ -1805,7 +1805,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)if (match) { pdata =of_get_hsmmc_pdata (&pdev->dev);if (match->data) { -u16 *offsetp = match->data; +const u16 *offsetp = match->data; pdata->reg_offset = *offsetp; } }
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 10/11 of: add const to struct of_device_id.data
In reply to y at pengutronix.deFrom: Uwe Kleine-K?nig <[email protected]>
Drivers should never need to modify the data of a device id. So it can be const which in turn allows more consts in the driver.
--- include/linux/mod_devicetable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mod_devicetable.h +1 -1
@@ -224,7 +224,7 @@ struct of_device_idchar type[32 ];char compatible[128 ];#ifdef __KERNEL__ -void *data; +const void *data;#else kernel_ulong_t data;#endif
Signature · 1 line
1.7.10.4
PATCH 10/11 of: add const to struct of_device_id.data
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
Drivers should never need to modify the data of a device id. So it can be const which in turn allows more consts in the driver.
--- include/linux/mod_devicetable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mod_devicetable.h +1 -1
@@ -224,7 +224,7 @@ struct of_device_idchar type[32 ];char compatible[128 ];#ifdef __KERNEL__ -void *data; +const void *data;#else kernel_ulong_t data;#endif
Signature · 7 lines
1.7.10.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 11/11 gpio/gpio-omap: make platformdata used as of_device_id.data const
In reply to y at pengutronix.deFrom: Uwe Kleine-K?nig <[email protected]>
--- drivers/gpio/gpio-omap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-omap.c +3 -3
@@ -1430,19 +1430,19 @@ static struct omap_gpio_reg_offs omap4_gpio_regs = { .fallingdetect = OMAP4_GPIO_FALLINGDETECT, }; -static struct omap_gpio_platform_data omap2_pdata = { +const static struct omap_gpio_platform_data omap2_pdata = { .regs = &omap2_gpio_regs, .bank_width =32 , .dbck_flag = false, }; -static struct omap_gpio_platform_data omap3_pdata = { +const static struct omap_gpio_platform_data omap3_pdata = { .regs = &omap2_gpio_regs, .bank_width =32 , .dbck_flag = true, }; -static struct omap_gpio_platform_data omap4_pdata = { +const static struct omap_gpio_platform_data omap4_pdata = { .regs = &omap4_gpio_regs, .bank_width =32 , .dbck_flag = true,
Signature · 1 line
1.7.10.4
PATCH 11/11 gpio/gpio-omap: make platformdata used as of_device_id.data const
In reply to y at pengutronix.deFrom: Uwe Kleine-König <[email protected]>
--- drivers/gpio/gpio-omap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-omap.c +3 -3
@@ -1430,19 +1430,19 @@ static struct omap_gpio_reg_offs omap4_gpio_regs = { .fallingdetect = OMAP4_GPIO_FALLINGDETECT, }; -static struct omap_gpio_platform_data omap2_pdata = { +const static struct omap_gpio_platform_data omap2_pdata = { .regs = &omap2_gpio_regs, .bank_width =32 , .dbck_flag = false, }; -static struct omap_gpio_platform_data omap3_pdata = { +const static struct omap_gpio_platform_data omap3_pdata = { .regs = &omap2_gpio_regs, .bank_width =32 , .dbck_flag = true, }; -static struct omap_gpio_platform_data omap4_pdata = { +const static struct omap_gpio_platform_data omap4_pdata = { .regs = &omap4_gpio_regs, .bank_width =32 , .dbck_flag = true,
Signature · 7 lines
1.7.10.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
cover make struct of_device_id.data const
In reply to y at pengutronix.deHello,
On Fri, Jul 13, 2012 at 02:32:02PM +0200, y at pengutronix.de wrote:
This is utter non-sense, it was me who sent these mails (and pressed 'y' when git send-email asked if "Uwe Kleine-K?nig <[email protected]>" is the right sender). Please make sure to correct this when replying to the patches.
Sorry for the inconvenience.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
cover make struct of_device_id.data const
In reply to y at pengutronix.deQuoted 8 lines · y at pengutronix.de
From: Uwe Kleine-K?nig <[email protected]>
Hello,
this series' goal is to make struct of_device_id.data const. Conceptually a driver must not modify the data contained there so making it const is the right thing.
Quoted 7 lines
This change might introduce warnings because drivers don't use const to access the data pointed to by of_device_id.data. In most cases the fix is to add some consts.
This series (apart from adding this const in patch 10) fixes all drivers covered by all arm defconfigs (based on v3.5-rc6).
What about other arches?
Rob
Quoted 49 lines
There is one exception though:
drivers/regulator/twl-regulator.c(build inomap2plus_defconfig) now issues:
drivers/regulator/twl-regulator.c: In function 'twlreg_probe':
drivers/regulator/twl-regulator.c:1181: warning: assignment discards qualifiers from pointer target typedrivers/regulator/twl-regulator.c:1190: warning: assignment discards qualifiers from pointer target typethat is because this driver really modifies his .of_match_table in the precence of a traditionally probed device.
I didn't check deeply, but probably the easiest fix is to remove traditional platform support. Don't know if omap is ready for that though.And also patch 11 adds some more consts that are possible now after patch 10.
This series is available in my git tree at:
git://git.pengutronix.de/git/ukl/linux.gitofdeviceiddataBest regards
UweUwe Kleine-K?nig (11):
spi/imx: make spi_imx_data.devtype_data member point to const data serial/imx: make imx_port.devdata member point to const data
ARM: cache-l2x0: add a const qualifier
misc/atmel_tc: make atmel_tc.tcb_config member point to const datagpio/gpio-omap.c: add a const qualifier
i2c/i2c-omap: add a const qualifier
dmaengine:at_hdmac: add a few const qualifiers spi/spi-omap2-mcspi: add a const qualifier mmc/omap_hsmmc: add a const qualifier
of: add const to struct of_device_id.data gpio/gpio-omap: make platformdata used as of_device_id.data constarch/arm/mm/cache-l2x0.c | 2 +- drivers/dma/at_hdmac.c | 4 ++-- drivers/gpio/gpio-omap.c | 8 ++++---- drivers/i2c/busses/i2c-omap.c | 3 ++- drivers/mmc/host/omap_hsmmc.c | 2 +- drivers/spi/spi-imx.c | 2 +- drivers/spi/spi-omap2-mcspi.c | 2 +- drivers/tty/serial/imx.c | 2 +- include/linux/atmel_tc.h | 2 +- include/linux/mod_devicetable.h | 2 +- 10 files changed, 15 insertions(+), 14 deletions(-)
cover make struct of_device_id.data const
Quoted 11 lines · Rob Herring
Quoted 10 lines · y at pengutronix.de
From: Uwe Kleine-K?nig <[email protected]>
this series' goal is to make struct of_device_id.data const. Conceptually a driver must not modify the data contained there so making it const is the right thing.
This change might introduce warnings because drivers don't use const to access the data pointed to by of_device_id.data. In most cases the fix is to add some consts.
Quoted 5 lines
Quoted 3 lines
This series (apart from adding this const in patch 10) fixes all drivers covered by all arm defconfigs (based on v3.5-rc6).
What about other arches?
I didn't looked at them, mainly because I don't have the scripts for arches other than arm to do such testing. Also note that it introduces only some warnings, but no breakage. So adding the const in the merge window might be ok?!
I'm not sure I'll have the capacity to fix other arches now. Maybe only add the const for ARCH=arm for now and I'll address the other archs as time permits even though this is ugly? At least getting in patches 1-9 would be nice to get in to save me from keeping them up to date.
Which other arches do you consider relevant?
$ git grep -l '\<OF\>' arch/*/Kconfig arch/arm/Kconfig arch/c6x/Kconfig arch/microblaze/Kconfig arch/mips/Kconfig arch/openrisc/Kconfig arch/powerpc/Kconfig arch/sparc/Kconfig arch/x86/Kconfig
For most of these I first have to look where to get a toolchain from.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
cover make struct of_device_id.data const
Quoted 16 lines · Uwe Kleine-K?nig
Quoted 15 lines · Rob Herring
Quoted 13 lines · y at pengutronix.de
From: Uwe Kleine-K?nig <[email protected]>
this series' goal is to make struct of_device_id.data const. Conceptually a driver must not modify the data contained there so making it const is the right thing.
This change might introduce warnings because drivers don't use const to access the data pointed to by of_device_id.data. In most cases the fix is to add some consts.
This series (apart from adding this const in patch 10) fixes all drivers covered by all arm defconfigs (based on v3.5-rc6).
Quoted 6 lines
Quoted 1 line
What about other arches?
I didn't looked at them, mainly because I don't have the scripts for arches other than arm to do such testing. Also note that it introduces only some warnings, but no breakage. So adding the const in the merge window might be ok?!
I think it makes sense to change the drivers that are easy to find now:
git grep -A6 of_device_id | grep '\<data\>.*=' | brain
arch/c6x/platforms/plldata.c- { .compatible = "ti,c6455-pll", .data = c6455_setup_clocks },arch/mips/lantiq/irq.c- { .compatible = "lantiq,icu", .data = icu_of_init },arch/powerpc/platforms/83xx/suspend.c- .data = &pmc_types[0],arch/powerpc/platforms/cell/celleb_pci.c- .data = &celleb_fake_pci_spec,arch/powerpc/platforms/cell/celleb_pci.c- .data = &celleb_epci_spec,arch/powerpc/sysdev/fsl_msi.c- .data = (void *)&mpic_msi_feature,drivers/atm/fore200e.c- .data = (void *) &fore200e_bus[1],drivers/char/xilinx_hwicap/xilinx_hwicap.c- { .compatible = "xlnx,opb-hwicap-1.00.b", .data = &buffer_icap_config},
drivers/i2c/busses/i2c-mpc.c- {.compatible = "mpc5200-i2c", .data = &mpc_i2c_data_52xx, },
drivers/macintosh/mediabay.c- .data = &keylargo_mb_ops,
drivers/mfd/da9052-i2c.c- { .compatible = "dlg,da9053-aa", .data = &da9052_i2c_id[1] },
drivers/net/can/mscan/mpc5xxx_can.c- { .compatible = "fsl,mpc5200-mscan", .data = &mpc5200_can_data, },
drivers/scsi/qlogicpti.c- .data = &qpti_template,
drivers/usb/host/fsl-mph-dr-of.c- { .compatible = "fsl-usb2-mph", .data = &fsl_usb2_mpc8xxx_pd, },
drivers/watchdog/mpc8xxx_wdt.c- .data = &(struct mpc8xxx_wdt_type) {I'm optimistic that this list covers the vast majority of the non-ARM drivers, and some of them don't even need any changes. I've done patches for the others below.
--- arch/powerpc/platforms/83xx/suspend.c | 2 +- arch/powerpc/platforms/cell/celleb_pci.c | 2 +- arch/powerpc/sysdev/fsl_msi.c | 8 ++++---- drivers/i2c/busses/i2c-mpc.c | 12 ++++++------ drivers/macintosh/mediabay.c | 8 ++++---- drivers/mfd/da9052-i2c.c | 4 ++-- drivers/net/can/mscan/mpc5xxx_can.c | 6 +++--- drivers/scsi/qlogicpti.c | 2 +- drivers/watchdog/mpc8xxx_wdt.c | 2 +- 10 files changed, 23 insertions(+), 26 deletions(-)
arch/powerpc/platforms/83xx/suspend.c +1 -1
@@ -326,7 +326,7 @@ static int pmc_probe(struct platform_device *ofdev)const struct of_device_id *match;struct device_node *np = ofdev->dev.of_node;struct resource res; -struct pmc_type *type; +const struct pmc_type *type;int ret =0 ; match =of_match_device (pmc_match, &ofdev->dev);
arch/powerpc/platforms/cell/celleb_pci.c +1 -1
@@ -472,7 +472,7 @@ int __init celleb_setup_phb(struct pci_controller *phb) {struct device_node *dev = phb->dn;const struct of_device_id *match; -struct celleb_phb_spec *phb_spec; +const struct celleb_phb_spec *phb_spec;int rc; match =of_match_node (celleb_phb_match, dev);
arch/powerpc/sysdev/fsl_msi.c +4 -4
@@ -368,7 +368,7 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev)int err, i, j, irq_index, count;int rc;const u32 *p; -struct fsl_msi_feature *features; +const struct fsl_msi_feature *features;int len;u32 offset;static const u32 all_avail[] = {0 ,NR_MSI_IRQS };
@@ -502,15 +502,15 @@ static const struct fsl_msi_feature vmpic_msi_feature = {static const struct of_device_id fsl_of_msi_ids[] = { { .compatible ="fsl,mpic-msi" , - .data = (void *)&mpic_msi_feature, + .data = &mpic_msi_feature, }, { .compatible ="fsl,ipic-msi" , - .data = (void *)&ipic_msi_feature, + .data = &ipic_msi_feature, }, { .compatible ="fsl,vmpic-msi" , - .data = (void *)&vmpic_msi_feature, + .data = &vmpic_msi_feature, }, {} };
drivers/i2c/busses/i2c-mpc.c +6 -6
@@ -647,7 +647,7 @@ static int __devinit fsl_i2c_probe(struct platform_device *op) }if (match->data) { -struct mpc_i2c_data *data = match->data; +const struct mpc_i2c_data *data = match->data; data->setup (op->dev.of_node, i2c, clock, data->prescaler); }else {/* Backwards compatibility */
@@ -730,24 +730,24 @@ static int mpc_i2c_resume(struct device *dev)SIMPLE_DEV_PM_OPS (mpc_i2c_pm_ops, mpc_i2c_suspend, mpc_i2c_resume);#endif -static struct mpc_i2c_data mpc_i2c_data_512x__devinitdata = { +static const struct mpc_i2c_data mpc_i2c_data_512x__devinitdata = { .setup = mpc_i2c_setup_512x, }; -static struct mpc_i2c_data mpc_i2c_data_52xx__devinitdata = { +static const struct mpc_i2c_data mpc_i2c_data_52xx__devinitdata = { .setup = mpc_i2c_setup_52xx, }; -static struct mpc_i2c_data mpc_i2c_data_8313__devinitdata = { +static const struct mpc_i2c_data mpc_i2c_data_8313__devinitdata = { .setup = mpc_i2c_setup_8xxx, }; -static struct mpc_i2c_data mpc_i2c_data_8543__devinitdata = { +static const struct mpc_i2c_data mpc_i2c_data_8543__devinitdata = { .setup = mpc_i2c_setup_8xxx, .prescaler =2 , }; -static struct mpc_i2c_data mpc_i2c_data_8544__devinitdata = { +static const struct mpc_i2c_data mpc_i2c_data_8544__devinitdata = { .setup = mpc_i2c_setup_8xxx, .prescaler =3 , };
drivers/macintosh/mediabay.c +4 -4
@@ -63,7 +63,7 @@ struct media_bay_info {int value_count;int timer;struct macio_dev *mdev; -struct mb_ops * ops; +const struct mb_ops * ops;int index;int cached_gpio;int sleeping;
@@ -669,7 +669,7 @@ static int media_bay_resume(struct macio_dev *mdev)/* Definitions of "ops" structures. */ -static struct mb_ops ohare_mb_ops = { +static const struct mb_ops ohare_mb_ops = { .name ="Ohare" , .content = ohare_mb_content, .power = ohare_mb_power,
@@ -678,7 +678,7 @@ static struct mb_ops ohare_mb_ops = { .un_reset_ide = ohare_mb_un_reset_ide, }; -static struct mb_ops heathrow_mb_ops = { +static const struct mb_ops heathrow_mb_ops = { .name ="Heathrow" , .content = heathrow_mb_content, .power = heathrow_mb_power,
@@ -687,7 +687,7 @@ static struct mb_ops heathrow_mb_ops = { .un_reset_ide = heathrow_mb_un_reset_ide, }; -static struct mb_ops keylargo_mb_ops = { +static const struct mb_ops keylargo_mb_ops = { .name ="KeyLargo" , .init = keylargo_mb_init, .content = keylargo_mb_content,
drivers/mfd/da9052-i2c.c +2 -2
@@ -46,7 +46,7 @@ static int da9052_i2c_enable_multiwrite(struct da9052 *da9052)return 0 ; } -static struct i2c_device_id da9052_i2c_id[] = { +static const struct i2c_device_id da9052_i2c_id[] = { {"da9052" ,DA9052 }, {"da9053-aa" ,DA9053_AA }, {"da9053-ba" ,DA9053_BA },
@@ -104,7 +104,7 @@ static int __devinit da9052_i2c_probe(struct i2c_client *client,const struct of_device_id *deviceid; deviceid =of_match_node (dialog_dt_ids, np); - id = (const struct i2c_device_id *)deviceid->data; + id = deviceid->data; }#endif
drivers/net/can/mscan/mpc5xxx_can.c +3 -3
@@ -251,7 +251,7 @@ static struct of_device_id mpc5xxx_can_table[];static int __devinit mpc5xxx_can_probe (struct platform_device *ofdev) {const struct of_device_id *match; -struct mpc5xxx_can_data *data; +const struct mpc5xxx_can_data *data;struct device_node *np = ofdev->dev.of_node;struct net_device *dev;struct mscan_priv *priv;
@@ -380,12 +380,12 @@ static int mpc5xxx_can_resume(struct platform_device *ofdev) }#endif -static struct mpc5xxx_can_data __devinitdata mpc5200_can_data = { +static const struct mpc5xxx_can_data __devinitdata mpc5200_can_data = { .type =MSCAN_TYPE_MPC5200 , .get_clock = mpc52xx_can_get_clock, }; -static struct mpc5xxx_can_data __devinitdata mpc5121_can_data = { +static const struct mpc5xxx_can_data __devinitdata mpc5121_can_data = { .type =MSCAN_TYPE_MPC5121 , .get_clock = mpc512x_can_get_clock, };
drivers/scsi/qlogicpti.c +1 -1
@@ -1305,7 +1305,7 @@ static int __devinit qpti_sbus_probe(struct platform_device *op) match =of_match_device (qpti_match, &op->dev);if (!match)return -EINVAL ; - tpnt = match->data; + tpnt = (void *)match->data;/* Sometimes Antares cards come up not completely * setup, and we get a report of a zero IRQ.
drivers/watchdog/mpc8xxx_wdt.c +1 -1
@@ -193,7 +193,7 @@ static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev)int ret;const struct of_device_id *match;struct device_node *np = ofdev->dev.of_node; -struct mpc8xxx_wdt_type *wdt_type; +const struct mpc8xxx_wdt_type *wdt_type;u32 freq =fsl_get_sys_freq ();bool enabled;
cover make struct of_device_id.data const
Hello,
Quoted 101 lines · Arnd Bergmann
Quoted 16 lines · Uwe Kleine-K?nig
Quoted 15 lines · Rob Herring
Quoted 13 lines · y at pengutronix.de
From: Uwe Kleine-K?nig <[email protected]>
this series' goal is to make struct of_device_id.data const. Conceptually a driver must not modify the data contained there so making it const is the right thing.
This change might introduce warnings because drivers don't use const to access the data pointed to by of_device_id.data. In most cases the fix is to add some consts.
This series (apart from adding this const in patch 10) fixes all drivers covered by all arm defconfigs (based on v3.5-rc6).
Quoted 6 lines
Quoted 1 line
What about other arches?
I didn't looked at them, mainly because I don't have the scripts for arches other than arm to do such testing. Also note that it introduces only some warnings, but no breakage. So adding the const in the merge window might be ok?!
I think it makes sense to change the drivers that are easy to find now:
git grep -A6
of_device_id| grep '\<data\>.*=' | brain
arch/c6x/platforms/plldata.c-{ .compatible = "ti,c6455-pll", .data =c6455_setup_clocks},arch/mips/lantiq/irq.c-{ .compatible = "lantiq,icu", .data =icu_of_init},arch/powerpc/platforms/83xx/suspend.c-.data = &pmc_types[0],arch/powerpc/platforms/cell/celleb_pci.c-.data =&celleb_fake_pci_spec,arch/powerpc/platforms/cell/celleb_pci.c-.data =&celleb_epci_spec,arch/powerpc/sysdev/fsl_msi.c-.data = (void *)&mpic_msi_feature,drivers/atm/fore200e.c-.data = (void *) &fore200e_bus[1],drivers/char/xilinx_hwicap/xilinx_hwicap.c-{ .compatible = "xlnx,opb-hwicap-1.00.b", .data =&buffer_icap_config},drivers/i2c/busses/i2c-mpc.c- {.compatible = "mpc5200-i2c", .data = &mpc_i2c_data_52xx, }, drivers/macintosh/mediabay.c- .data = &keylargo_mb_ops, drivers/mfd/da9052-i2c.c- { .compatible = "dlg,da9053-aa", .data = &da9052_i2c_id[1] }, drivers/net/can/mscan/mpc5xxx_can.c- { .compatible = "fsl,mpc5200-mscan", .data = &mpc5200_can_data, }, drivers/scsi/qlogicpti.c- .data = &qpti_template, drivers/usb/host/fsl-mph-dr-of.c- { .compatible = "fsl-usb2-mph", .data = &fsl_usb2_mpc8xxx_pd, }, drivers/watchdog/mpc8xxx_wdt.c- .data = &(struct mpc8xxx_wdt_type) {I'm optimistic that this list covers the vast majority of the non-ARM drivers, and some of them don't even need any changes. I've done patches for the others below.
Signed-off-by Arnd Bergmann <[email protected]>--- arch/powerpc/platforms/83xx/suspend.c | 2 +- arch/powerpc/platforms/cell/celleb_pci.c | 2 +- arch/powerpc/sysdev/fsl_msi.c | 8 ++++---- drivers/i2c/busses/i2c-mpc.c | 12 ++++++------ drivers/macintosh/mediabay.c | 8 ++++---- drivers/mfd/da9052-i2c.c | 4 ++-- drivers/net/can/mscan/mpc5xxx_can.c | 6 +++--- drivers/scsi/qlogicpti.c | 2 +- drivers/watchdog/mpc8xxx_wdt.c | 2 +- 10 files changed, 23 insertions(+), 26 deletions(-)arch/powerpc/platforms/83xx/suspend.c +1
-1@@ -326,7 +326,7 @@ static int pmc_probe(struct platform_device *ofdev)const struct of_device_id *match;struct device_node *np = ofdev->dev.of_node;struct resource res; -struct pmc_type *type; +const struct pmc_type *type;int ret =0 ; match =of_match_device (pmc_match, &ofdev->dev);arch/powerpc/platforms/cell/celleb_pci.c +1
-1@@ -472,7 +472,7 @@ int __init celleb_setup_phb(struct pci_controller *phb) {struct device_node *dev = phb->dn;const struct of_device_id *match; -struct celleb_phb_spec *phb_spec; +const struct celleb_phb_spec *phb_spec;int rc; match =of_match_node (celleb_phb_match, dev);arch/powerpc/sysdev/fsl_msi.c +1
-1@@ -368,7 +368,7 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev)int err, i, j, irq_index, count;int rc;const u32 *p; -struct fsl_msi_feature *features; +const struct fsl_msi_feature *features;int len;u32 offset;static const u32 all_avail[] = {0 ,NR_MSI_IRQS };
arch/powerpc/sysdev/fsl_msi.c static const struct fsl_msi_feature vmpic_msi_feature = { · line 505
Quoted 5 lines
arch/powerpc/sysdev/fsl_msi.c +1
-1@@ -502,15 +502,15 @@ static const struct fsl_msi_feature vmpic_msi_feature = {static const struct of_device_id fsl_of_msi_ids[] = { { .compatible ="fsl,mpic-msi" , - .data = (void *)&mpic_msi_feature, + .data = &mpic_msi_feature,
This looks unrelated.
Quoted 27 lines
arch/powerpc/sysdev/fsl_msi.c +2
-2}, { .compatible = "fsl,ipic-msi", - .data = (void *)&ipic_msi_feature, + .data = &ipic_msi_feature, }, { .compatible = "fsl,vmpic-msi", - .data = (void *)&vmpic_msi_feature, + .data = &vmpic_msi_feature, }, {} };drivers/i2c/busses/i2c-mpc.c +1
-1@@ -647,7 +647,7 @@ static int __devinit fsl_i2c_probe(struct platform_device *op) }if (match->data) { -struct mpc_i2c_data *data = match->data; +const struct mpc_i2c_data *data = match->data; data->setup (op->dev.of_node, i2c, clock, data->prescaler); }else {/* Backwards compatibility */
drivers/i2c/busses/i2c-mpc.c static int mpc_i2c_resume(struct device *dev) · line 733
Quoted 5 lines
drivers/i2c/busses/i2c-mpc.c +1
-1@@ -730,24 +730,24 @@ static int mpc_i2c_resume(struct device *dev)SIMPLE_DEV_PM_OPS (mpc_i2c_pm_ops, mpc_i2c_suspend, mpc_i2c_resume);#endif -static struct mpc_i2c_data mpc_i2c_data_512x__devinitdata = { +static const struct mpc_i2c_data mpc_i2c_data_512x__devinitdata = {
I guess this results in a warning until after patch 10 is applied? (A few more down below.)
In the meantime I expanded my defconfig build script to handle powerpc, too. I'll check these. I think I'll have to let the build run over night...
Thanks Arnd for your effort.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
cover make struct of_device_id.data const
Quoted 8 lines · Uwe Kleine-K?nig
arch/powerpc/sysdev/fsl_msi.c static const struct fsl_msi_feature vmpic_msi_feature = { · line 505
Quoted 6 lines
arch/powerpc/sysdev/fsl_msi.c +1
-1@@ -502,15 +502,15 @@ static const struct fsl_msi_feature vmpic_msi_feature = {static const struct of_device_id fsl_of_msi_ids[] = { { .compatible ="fsl,mpic-msi" , - .data = (void *)&mpic_msi_feature, + .data = &mpic_msi_feature,This looks unrelated.
Well, the cast to (void *) was used to cast away the const-ness of the "static const struct fsl_msi_feature mpic_msi_feature", so that is no longer needed after the last patch.
Arnd.
cover make struct of_device_id.data const
In reply to Uwe Kleine-KönigOn 07/13/2012 12:49 PM, Uwe Kleine-K?nig wrote:
[snip]
Quoted 6 lines
I guess this results in a warning until after patch 10 is applied? (A few more down below.)
In the meantime I expanded my defconfig build script to handle powerpc, too. I'll check these. I think I'll have to let the build run over night...
I'm not certain but just an allyesconfig build on powerpc should be sufficient rather than building defconfigs. We still dream about doing that on ARM.
Rob
cover make struct of_device_id.data const
In reply to Rob HerringQuoted 13 lines · Rob Herring
Quoted 12 lines · y at pengutronix.de
From: Uwe Kleine-K?nig <[email protected]>
Hello,
this series' goal is to make struct of_device_id.data const. Conceptually a driver must not modify the data contained there so making it const is the right thing.
This change might introduce warnings because drivers don't use const to access the data pointed to by of_device_id.data. In most cases the fix is to add some consts.
Quoted 5 lines
Quoted 3 lines
This series (apart from adding this const in patch 10) fixes all drivers covered by all arm defconfigs (based on v3.5-rc6).
What about other arches?
This whole series is of questionable value to me. While I agree that .data should be const, I don't think changing it has is measurably better than what we have now. Particularly when the series isn't complete for all users. And "building all defconfigs" is not the right way to look for affected users.
g.
cover make struct of_device_id.data const
Hello Grant,
Quoted 14 lines · Grant Likely
Quoted 13 lines · Rob Herring
Quoted 11 lines · y at pengutronix.de
this series' goal is to make struct of_device_id.data const. Conceptually a driver must not modify the data contained there so making it const is the right thing.
This change might introduce warnings because drivers don't use const to access the data pointed to by of_device_id.data. In most cases the fix is to add some consts.
This series (apart from adding this const in patch 10) fixes all drivers covered by all arm defconfigs (based on v3.5-rc6).
Quoted 7 lines
Quoted 1 line
What about other arches?
This whole series is of questionable value to me. While I agree that .data should be const, I don't think changing it has is measurably better than what we have now. Particularly when the series isn't complete for all users. And "building all defconfigs" is not the right way to look for affected users.
As it's not really bad if a user isn't fixed (it only introduces a compiler warning) I think not being 100% sure to have fixed all of them is OK. I plan to check the defconfigs and an allyes build on powerpc and look over the patch that Arnd sent. IMHO this is enough to go on.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |