* [PATCH 3/4] thermal: exynos: constify thermal_zone_of_device_ops structures
2017-08-05 20:37 [PATCH 0/4] constify thermal_zone_of_device_ops structures Julia Lawall
@ 2017-08-05 20:37 ` Julia Lawall
2017-08-07 15:21 ` Bartlomiej Zolnierkiewicz
2017-08-05 20:37 ` [PATCH 4/4] thermal: bcm2835: " Julia Lawall
2017-08-08 13:43 ` [PATCH 0/4] " Zhang Rui
2 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2017-08-05 20:37 UTC (permalink / raw)
To: linux-arm-kernel
The thermal_zone_of_device_ops structure is only passed as the fourth
argument to thermal_zone_of_sensor_register, which is declared as const.
Thus the thermal_zone_of_device_ops structure itself can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct thermal_zone_of_device_ops i at p = { ... };
@ok1@
identifier r.i;
expression e1,e2,e3;
position p;
@@
thermal_zone_of_sensor_register(e1,e2,e3,&i at p)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct thermal_zone_of_device_ops e;
@@
e at i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct thermal_zone_of_device_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/thermal/samsung/exynos_tmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 7b8ef09..ed805c7 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -1286,7 +1286,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
return 0;
}
-static struct thermal_zone_of_device_ops exynos_sensor_ops = {
+static const struct thermal_zone_of_device_ops exynos_sensor_ops = {
.get_temp = exynos_get_temp,
.set_emul_temp = exynos_tmu_set_emulation,
};
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/4] thermal: exynos: constify thermal_zone_of_device_ops structures
2017-08-05 20:37 ` [PATCH 3/4] thermal: exynos: " Julia Lawall
@ 2017-08-07 15:21 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 7+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2017-08-07 15:21 UTC (permalink / raw)
To: linux-arm-kernel
On Saturday, August 05, 2017 10:37:16 PM Julia Lawall wrote:
> The thermal_zone_of_device_ops structure is only passed as the fourth
> argument to thermal_zone_of_sensor_register, which is declared as const.
> Thus the thermal_zone_of_device_ops structure itself can be const.
>
> Done with the help of Coccinelle.
>
> // <smpl>
> @r disable optional_qualifier@
> identifier i;
> position p;
> @@
> static struct thermal_zone_of_device_ops i at p = { ... };
>
> @ok1@
> identifier r.i;
> expression e1,e2,e3;
> position p;
> @@
> thermal_zone_of_sensor_register(e1,e2,e3,&i at p)
>
> @bad@
> position p != {r.p,ok1.p};
> identifier r.i;
> struct thermal_zone_of_device_ops e;
> @@
> e at i@p
>
> @depends on !bad disable optional_qualifier@
> identifier r.i;
> @@
> static
> +const
> struct thermal_zone_of_device_ops i = { ... };
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Eduardo/Zhang, Please queue this patch for upstream, thanks!
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/4] thermal: bcm2835: constify thermal_zone_of_device_ops structures
2017-08-05 20:37 [PATCH 0/4] constify thermal_zone_of_device_ops structures Julia Lawall
2017-08-05 20:37 ` [PATCH 3/4] thermal: exynos: " Julia Lawall
@ 2017-08-05 20:37 ` Julia Lawall
2017-08-07 6:41 ` Stefan Wahren
2017-08-08 13:43 ` [PATCH 0/4] " Zhang Rui
2 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2017-08-05 20:37 UTC (permalink / raw)
To: linux-arm-kernel
The thermal_zone_of_device_ops structure is only passed as the fourth
argument to thermal_zone_of_sensor_register, which is declared as const.
Thus the thermal_zone_of_device_ops structure itself can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct thermal_zone_of_device_ops i at p = { ... };
@ok1@
identifier r.i;
expression e1,e2,e3;
position p;
@@
thermal_zone_of_sensor_register(e1,e2,e3,&i at p)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct thermal_zone_of_device_ops e;
@@
e at i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct thermal_zone_of_device_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/thermal/broadcom/bcm2835_thermal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
index e6863c8..a4d6a0e 100644
--- a/drivers/thermal/broadcom/bcm2835_thermal.c
+++ b/drivers/thermal/broadcom/bcm2835_thermal.c
@@ -145,7 +145,7 @@ static void bcm2835_thermal_debugfs(struct platform_device *pdev)
debugfs_create_regset32("regset", 0444, data->debugfsdir, regset);
}
-static struct thermal_zone_of_device_ops bcm2835_thermal_ops = {
+static const struct thermal_zone_of_device_ops bcm2835_thermal_ops = {
.get_temp = bcm2835_thermal_get_temp,
};
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/4] thermal: bcm2835: constify thermal_zone_of_device_ops structures
2017-08-05 20:37 ` [PATCH 4/4] thermal: bcm2835: " Julia Lawall
@ 2017-08-07 6:41 ` Stefan Wahren
0 siblings, 0 replies; 7+ messages in thread
From: Stefan Wahren @ 2017-08-07 6:41 UTC (permalink / raw)
To: linux-arm-kernel
Am 05.08.2017 um 22:37 schrieb Julia Lawall:
> The thermal_zone_of_device_ops structure is only passed as the fourth
> argument to thermal_zone_of_sensor_register, which is declared as const.
> Thus the thermal_zone_of_device_ops structure itself can be const.
>
> Done with the help of Coccinelle.
>
> // <smpl>
> @r disable optional_qualifier@
> identifier i;
> position p;
> @@
> static struct thermal_zone_of_device_ops i at p = { ... };
>
> @ok1@
> identifier r.i;
> expression e1,e2,e3;
> position p;
> @@
> thermal_zone_of_sensor_register(e1,e2,e3,&i at p)
>
> @bad@
> position p != {r.p,ok1.p};
> identifier r.i;
> struct thermal_zone_of_device_ops e;
> @@
> e at i@p
>
> @depends on !bad disable optional_qualifier@
> identifier r.i;
> @@
> static
> +const
> struct thermal_zone_of_device_ops i = { ... };
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
>
> ---
> drivers/thermal/broadcom/bcm2835_thermal.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
> index e6863c8..a4d6a0e 100644
> --- a/drivers/thermal/broadcom/bcm2835_thermal.c
> +++ b/drivers/thermal/broadcom/bcm2835_thermal.c
> @@ -145,7 +145,7 @@ static void bcm2835_thermal_debugfs(struct platform_device *pdev)
> debugfs_create_regset32("regset", 0444, data->debugfsdir, regset);
> }
>
> -static struct thermal_zone_of_device_ops bcm2835_thermal_ops = {
> +static const struct thermal_zone_of_device_ops bcm2835_thermal_ops = {
> .get_temp = bcm2835_thermal_get_temp,
> };
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/4] constify thermal_zone_of_device_ops structures
2017-08-05 20:37 [PATCH 0/4] constify thermal_zone_of_device_ops structures Julia Lawall
2017-08-05 20:37 ` [PATCH 3/4] thermal: exynos: " Julia Lawall
2017-08-05 20:37 ` [PATCH 4/4] thermal: bcm2835: " Julia Lawall
@ 2017-08-08 13:43 ` Zhang Rui
2017-08-08 13:46 ` Julia Lawall
2 siblings, 1 reply; 7+ messages in thread
From: Zhang Rui @ 2017-08-08 13:43 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, 2017-08-05 at 22:37 +0200, Julia Lawall wrote:
> The thermal_zone_of_device_ops structures are only passed as the
> fourth
> argument to thermal_zone_of_sensor_register, which is declared as
> const.
> Thus the thermal_zone_of_device_ops structures themselves can be
> const.
>
> Done with the help of Coccinelle.
I still see the same problem in other thermal drivers, which is not
covered by this patch set. Can we fix them all in one time?
thanks,
rui
>
> ---
>
> ?drivers/thermal/broadcom/bcm2835_thermal.c |????2 +-
> ?drivers/thermal/qoriq_thermal.c????????????|????2 +-
> ?drivers/thermal/samsung/exynos_tmu.c???????|????2 +-
> ?drivers/thermal/zx2967_thermal.c???????????|????2 +-
> ?4 files changed, 4 insertions(+), 4 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/4] constify thermal_zone_of_device_ops structures
2017-08-08 13:43 ` [PATCH 0/4] " Zhang Rui
@ 2017-08-08 13:46 ` Julia Lawall
0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2017-08-08 13:46 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, 8 Aug 2017, Zhang Rui wrote:
> On Sat, 2017-08-05 at 22:37 +0200, Julia Lawall wrote:
> > The thermal_zone_of_device_ops structures are only passed as the
> > fourth
> > argument to thermal_zone_of_sensor_register, which is declared as
> > const.
> > Thus the thermal_zone_of_device_ops structures themselves can be
> > const.
> >
> > Done with the help of Coccinelle.
>
> I still see the same problem in other thermal drivers, which is not
> covered by this patch set. Can we fix them all in one time?
OK.
julia
^ permalink raw reply [flat|nested] 7+ messages in thread