2024-04-23 02:41:54

by Kunwu Chan

[permalink] [raw]
Subject: [PATCH] mei: bus: constify the struct mei_cl_bus_type usage

Now that the driver core can properly handle constant struct bus_type,
move the mei_cl_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Signed-off-by: Kunwu Chan <[email protected]>
---
drivers/misc/mei/bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index f9bcff197615..99393f610cdf 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -1327,7 +1327,7 @@ static int mei_cl_device_uevent(const struct device *dev, struct kobj_uevent_env
return 0;
}

-static struct bus_type mei_cl_bus_type = {
+static const struct bus_type mei_cl_bus_type = {
.name = "mei",
.dev_groups = mei_cldev_groups,
.match = mei_cl_device_match,
--
2.40.1



2024-04-23 19:45:22

by Winkler, Tomas

[permalink] [raw]
Subject: RE: [PATCH] mei: bus: constify the struct mei_cl_bus_type usage


>
> Now that the driver core can properly handle constant struct bus_type,
> move the mei_cl_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
>
> Signed-off-by: Kunwu Chan <[email protected]>
LGTM
> ---
> drivers/misc/mei/bus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index
> f9bcff197615..99393f610cdf 100644
> --- a/drivers/misc/mei/bus.c
> +++ b/drivers/misc/mei/bus.c
> @@ -1327,7 +1327,7 @@ static int mei_cl_device_uevent(const struct device
> *dev, struct kobj_uevent_env
> return 0;
> }
>
> -static struct bus_type mei_cl_bus_type = {
> +static const struct bus_type mei_cl_bus_type = {
> .name = "mei",
> .dev_groups = mei_cldev_groups,
> .match = mei_cl_device_match,
> --
> 2.40.1


2024-04-23 19:57:20

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] mei: bus: constify the struct mei_cl_bus_type usage

On Tue, Apr 23, 2024 at 07:45:08PM +0000, Winkler, Tomas wrote:
>
> >
> > Now that the driver core can properly handle constant struct bus_type,
> > move the mei_cl_bus_type variable to be a constant structure as well,
> > placing it into read-only memory which can not be modified at runtime.
> >
> > Signed-off-by: Kunwu Chan <[email protected]>
> LGTM

Can you provide a "Acked-by:"?

2024-04-23 20:05:34

by Winkler, Tomas

[permalink] [raw]
Subject: RE: [PATCH] mei: bus: constify the struct mei_cl_bus_type usage



> -----Original Message-----
> From: [email protected] <[email protected]>
> Sent: Tuesday, April 23, 2024 10:57 PM
> To: Winkler, Tomas <[email protected]>
> Cc: Kunwu Chan <[email protected]>; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH] mei: bus: constify the struct mei_cl_bus_type usage
>
> On Tue, Apr 23, 2024 at 07:45:08PM +0000, Winkler, Tomas wrote:
> >
> > >
> > > Now that the driver core can properly handle constant struct
> > > bus_type, move the mei_cl_bus_type variable to be a constant
> > > structure as well, placing it into read-only memory which can not be
> modified at runtime.
> > >
> > > Signed-off-by: Kunwu Chan <[email protected]>
Acked-by: Tomas Winkler <[email protected]>
> > LGTM
> Can you provide a "Acked-by:"?