* [PATCH 00/12] account for const type of of_device_id.data
@ 2018-01-02 13:27 Julia Lawall
2018-01-02 13:27 ` [PATCH 03/12] spi: sirf: " Julia Lawall
2018-01-02 13:28 ` [PATCH 10/12] spi: spi-fsl-dspi: account for const type of of_device_id.data Julia Lawall
0 siblings, 2 replies; 6+ messages in thread
From: Julia Lawall @ 2018-01-02 13:27 UTC (permalink / raw)
To: linux-iio
Cc: kernel-janitors, Peter Meerwald-Stadler, Lars-Peter Clausen,
Hartmut Knaack, linux-mtd, linux-i2c, linux-spi, linux-rockchip,
linux-arm-kernel, linux-pm, linux-kernel, linux-gpio, linux-pci,
linux-arm-msm
Maintain const annotations when putting values into the data field of
an of_device_id structure, and afterwards when extracting them from
the data field of such a structure.
This was done using the following semantic patch:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier i,j;
const struct j *m;
struct i *y;
type T;
expression x,e;
position p;
@@
(
y =@p (T)(of_device_get_match_data(...));
|
x = of_match_node(...);
... when != x = e
(
m = e;
|
y =@p (T)(x->data);
)
)
@s@
identifier r.i,j;
@@
const struct i j = { ... };
@t depends on s disable optional_qualifier@
expression e;
identifier r.i,x,j,n;
struct j *m;
struct i *e1;
position any r.p;
type T;
@@
(
+const
struct i *x;
<+...
(
x =@p
- (T)(e)
+ e
|
x =@p e
)
...+>
|
m->@e1 n =@p
- (T)(e)
+ e
|
m->@e1 n =@p e
)
@disable optional_qualifier@
identifier t.j,t.n,r.i;
@@
struct j {
...
+ const
struct i *n;
...
}
@@
identifier x,s.j;
type T;
@@
struct of_device_id x[] = { ...,
{ .data =
- (T)
&j, }, ...};
// </smpl>
---
drivers/i2c/busses/i2c-rk3x.c | 16 ++++++++--------
drivers/iio/common/ssp_sensors/ssp.h | 2 +-
drivers/iio/common/ssp_sensors/ssp_dev.c | 2 +-
drivers/mtd/spi-nor/fsl-quadspi.c | 8 ++++----
drivers/pci/dwc/pcie-qcom.c | 4 ++--
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 4 ++--
drivers/pinctrl/pinctrl-at91-pio4.c | 4 ++--
drivers/pinctrl/pinctrl-axp209.c | 2 +-
drivers/power/avs/rockchip-io-domain.c | 24 ++++++++++++------------
drivers/power/reset/at91-sama5d2_shdwc.c | 4 ++--
drivers/power/supply/axp20x_ac_power.c | 8 ++++----
drivers/spi/spi-fsl-dspi.c | 7 +++----
drivers/spi/spi-sirf.c | 4 ++--
13 files changed, 44 insertions(+), 44 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 03/12] spi: sirf: account for const type of of_device_id.data 2018-01-02 13:27 [PATCH 00/12] account for const type of of_device_id.data Julia Lawall @ 2018-01-02 13:27 ` Julia Lawall 2018-01-03 12:15 ` Applied "spi: sirf: account for const type of of_device_id.data" to the spi tree Mark Brown 2018-01-03 12:22 ` Mark Brown 2018-01-02 13:28 ` [PATCH 10/12] spi: spi-fsl-dspi: account for const type of of_device_id.data Julia Lawall 1 sibling, 2 replies; 6+ messages in thread From: Julia Lawall @ 2018-01-02 13:27 UTC (permalink / raw) To: Mark Brown Cc: kernel-janitors, Barry Song, linux-spi, linux-arm-kernel, linux-kernel This driver creates various const structures that it stores in the data field of an of_device_id array. Adding const to the declaration of the location that receives the const value from the data field ensures that the compiler will continue to check that the value is not modified. Furthermore, the const-discarding cast on the extraction from the data field is no longer needed. Done using Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- drivers/spi/spi-sirf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -u -p a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c @@ -1072,7 +1072,7 @@ static int spi_sirfsoc_probe(struct plat struct sirfsoc_spi *sspi; struct spi_master *master; struct resource *mem_res; - struct sirf_spi_comp_data *spi_comp_data; + const struct sirf_spi_comp_data *spi_comp_data; int irq; int ret; const struct of_device_id *match; @@ -1092,7 +1092,7 @@ static int spi_sirfsoc_probe(struct plat platform_set_drvdata(pdev, master); sspi = spi_master_get_devdata(master); sspi->fifo_full_offset = ilog2(sspi->fifo_size); - spi_comp_data = (struct sirf_spi_comp_data *)match->data; + spi_comp_data = match->data; sspi->regs = spi_comp_data->regs; sspi->type = spi_comp_data->type; sspi->fifo_level_chk_mask = (sspi->fifo_size / 4) - 1; ^ permalink raw reply [flat|nested] 6+ messages in thread
* Applied "spi: sirf: account for const type of of_device_id.data" to the spi tree 2018-01-02 13:27 ` [PATCH 03/12] spi: sirf: " Julia Lawall @ 2018-01-03 12:15 ` Mark Brown 2018-01-03 12:22 ` Mark Brown 1 sibling, 0 replies; 6+ messages in thread From: Mark Brown @ 2018-01-03 12:15 UTC (permalink / raw) To: Julia Lawall Cc: Mark Brown, Mark Brown, kernel-janitors, Barry Song, linux-spi, linux-arm-kernel, linux-kernel, linux-spi The patch spi: sirf: account for const type of of_device_id.data has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 9e327ce71f3894e7e6b57f5c15a0dfa5be79f44e Mon Sep 17 00:00:00 2001 From: Julia Lawall <Julia.Lawall@lip6.fr> Date: Tue, 2 Jan 2018 14:27:59 +0100 Subject: [PATCH] spi: sirf: account for const type of of_device_id.data This driver creates various const structures that it stores in the data field of an of_device_id array. Adding const to the declaration of the location that receives the const value from the data field ensures that the compiler will continue to check that the value is not modified. Furthermore, the const-discarding cast on the extraction from the data field is no longer needed. Done using Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@kernel.org> --- drivers/spi/spi-sirf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index bbb1a275f718..f009d76f96b1 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c @@ -1072,7 +1072,7 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) struct sirfsoc_spi *sspi; struct spi_master *master; struct resource *mem_res; - struct sirf_spi_comp_data *spi_comp_data; + const struct sirf_spi_comp_data *spi_comp_data; int irq; int ret; const struct of_device_id *match; @@ -1092,7 +1092,7 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, master); sspi = spi_master_get_devdata(master); sspi->fifo_full_offset = ilog2(sspi->fifo_size); - spi_comp_data = (struct sirf_spi_comp_data *)match->data; + spi_comp_data = match->data; sspi->regs = spi_comp_data->regs; sspi->type = spi_comp_data->type; sspi->fifo_level_chk_mask = (sspi->fifo_size / 4) - 1; -- 2.15.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Applied "spi: sirf: account for const type of of_device_id.data" to the spi tree 2018-01-02 13:27 ` [PATCH 03/12] spi: sirf: " Julia Lawall 2018-01-03 12:15 ` Applied "spi: sirf: account for const type of of_device_id.data" to the spi tree Mark Brown @ 2018-01-03 12:22 ` Mark Brown 1 sibling, 0 replies; 6+ messages in thread From: Mark Brown @ 2018-01-03 12:22 UTC (permalink / raw) To: Julia Lawall Cc: Mark Brown, Mark Brown, kernel-janitors, Barry Song, linux-spi, linux-arm-kernel, linux-kernel, linux-spi The patch spi: sirf: account for const type of of_device_id.data has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 9e327ce71f3894e7e6b57f5c15a0dfa5be79f44e Mon Sep 17 00:00:00 2001 From: Julia Lawall <Julia.Lawall@lip6.fr> Date: Tue, 2 Jan 2018 14:27:59 +0100 Subject: [PATCH] spi: sirf: account for const type of of_device_id.data This driver creates various const structures that it stores in the data field of an of_device_id array. Adding const to the declaration of the location that receives the const value from the data field ensures that the compiler will continue to check that the value is not modified. Furthermore, the const-discarding cast on the extraction from the data field is no longer needed. Done using Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@kernel.org> --- drivers/spi/spi-sirf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index bbb1a275f718..f009d76f96b1 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c @@ -1072,7 +1072,7 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) struct sirfsoc_spi *sspi; struct spi_master *master; struct resource *mem_res; - struct sirf_spi_comp_data *spi_comp_data; + const struct sirf_spi_comp_data *spi_comp_data; int irq; int ret; const struct of_device_id *match; @@ -1092,7 +1092,7 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, master); sspi = spi_master_get_devdata(master); sspi->fifo_full_offset = ilog2(sspi->fifo_size); - spi_comp_data = (struct sirf_spi_comp_data *)match->data; + spi_comp_data = match->data; sspi->regs = spi_comp_data->regs; sspi->type = spi_comp_data->type; sspi->fifo_level_chk_mask = (sspi->fifo_size / 4) - 1; -- 2.15.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 10/12] spi: spi-fsl-dspi: account for const type of of_device_id.data 2018-01-02 13:27 [PATCH 00/12] account for const type of of_device_id.data Julia Lawall 2018-01-02 13:27 ` [PATCH 03/12] spi: sirf: " Julia Lawall @ 2018-01-02 13:28 ` Julia Lawall [not found] ` <1514899688-27844-11-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org> 1 sibling, 1 reply; 6+ messages in thread From: Julia Lawall @ 2018-01-02 13:28 UTC (permalink / raw) To: Mark Brown; +Cc: kernel-janitors, linux-spi, linux-kernel This driver creates a number of const structures that it stores in the data field of an of_device_id array. The data field of an of_device_id structure has type const void *, so there is no need for a const-discarding cast when putting const values into such a structure. Done using Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- drivers/spi/spi-fsl-dspi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 02d3ed7..0630962 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -903,10 +903,9 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id) } static const struct of_device_id fsl_dspi_dt_ids[] = { - { .compatible = "fsl,vf610-dspi", .data = (void *)&vf610_data, }, - { .compatible = "fsl,ls1021a-v1.0-dspi", - .data = (void *)&ls1021a_v1_data, }, - { .compatible = "fsl,ls2085a-dspi", .data = (void *)&ls2085a_data, }, + { .compatible = "fsl,vf610-dspi", .data = &vf610_data, }, + { .compatible = "fsl,ls1021a-v1.0-dspi", .data = &ls1021a_v1_data, }, + { .compatible = "fsl,ls2085a-dspi", .data = &ls2085a_data, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids); ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <1514899688-27844-11-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>]
* Applied "spi: spi-fsl-dspi: account for const type of of_device_id.data" to the spi tree [not found] ` <1514899688-27844-11-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org> @ 2018-01-03 12:22 ` Mark Brown 0 siblings, 0 replies; 6+ messages in thread From: Mark Brown @ 2018-01-03 12:22 UTC (permalink / raw) To: Julia Lawall Cc: Mark Brown, Mark Brown, kernel-janitors-u79uwXL29TY76Z2rM5mHXA, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-spi-u79uwXL29TY76Z2rM5mHXA The patch spi: spi-fsl-dspi: account for const type of of_device_id.data has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 230c08b2acf65863ac5905ea1fa93106bdd20af3 Mon Sep 17 00:00:00 2001 From: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org> Date: Tue, 2 Jan 2018 14:28:06 +0100 Subject: [PATCH] spi: spi-fsl-dspi: account for const type of of_device_id.data This driver creates a number of const structures that it stores in the data field of an of_device_id array. The data field of an of_device_id structure has type const void *, so there is no need for a const-discarding cast when putting const values into such a structure. Done using Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org> Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> --- drivers/spi/spi-fsl-dspi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 02d3ed7f2558..0630962ce442 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -903,10 +903,9 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id) } static const struct of_device_id fsl_dspi_dt_ids[] = { - { .compatible = "fsl,vf610-dspi", .data = (void *)&vf610_data, }, - { .compatible = "fsl,ls1021a-v1.0-dspi", - .data = (void *)&ls1021a_v1_data, }, - { .compatible = "fsl,ls2085a-dspi", .data = (void *)&ls2085a_data, }, + { .compatible = "fsl,vf610-dspi", .data = &vf610_data, }, + { .compatible = "fsl,ls1021a-v1.0-dspi", .data = &ls1021a_v1_data, }, + { .compatible = "fsl,ls2085a-dspi", .data = &ls2085a_data, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids); -- 2.15.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-01-03 12:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-02 13:27 [PATCH 00/12] account for const type of of_device_id.data Julia Lawall
2018-01-02 13:27 ` [PATCH 03/12] spi: sirf: " Julia Lawall
2018-01-03 12:15 ` Applied "spi: sirf: account for const type of of_device_id.data" to the spi tree Mark Brown
2018-01-03 12:22 ` Mark Brown
2018-01-02 13:28 ` [PATCH 10/12] spi: spi-fsl-dspi: account for const type of of_device_id.data Julia Lawall
[not found] ` <1514899688-27844-11-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
2018-01-03 12:22 ` Applied "spi: spi-fsl-dspi: account for const type of of_device_id.data" to the spi tree Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).