2024-02-18 12:39:36

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 12/12] net: hso: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the hso_type
variable to be a constant structure as well, placing it into read-only
memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
---
drivers/net/usb/hso.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index f088ea2ba6f3..1aeb36119d3f 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2465,7 +2465,7 @@ static void hso_create_rfkill(struct hso_device *hso_dev,
}
}

-static struct device_type hso_type = {
+static const struct device_type hso_type = {
.name = "wwan",
};


--
2.43.0



2024-02-20 11:25:05

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH 12/12] net: hso: constify the struct device_type usage

On Sat, Feb 17, 2024 at 05:13:34PM -0300, Ricardo B. Marliere wrote:
> Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
> core can properly handle constant struct device_type. Move the hso_type
> variable to be a constant structure as well, placing it into read-only
> memory which can not be modified at runtime.
>
> Cc: Greg Kroah-Hartman <[email protected]>
> Signed-off-by: Ricardo B. Marliere <[email protected]>

Reviewed-by: Simon Horman <[email protected]>