[PATCH] counter: constify the struct device_type usage

Ricardo B. Marliere posted 1 patch 1 year, 11 months ago
drivers/counter/counter-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] counter: constify the struct device_type usage
Posted by Ricardo B. Marliere 1 year, 11 months ago
Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the
counter_device_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 <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
---
 drivers/counter/counter-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/counter/counter-core.c b/drivers/counter/counter-core.c
index 29df0985f2ba..893b4f0726d2 100644
--- a/drivers/counter/counter-core.c
+++ b/drivers/counter/counter-core.c
@@ -49,7 +49,7 @@ static void counter_device_release(struct device *dev)
 	kfree(container_of(counter, struct counter_device_allochelper, counter));
 }
 
-static struct device_type counter_device_type = {
+static const struct device_type counter_device_type = {
 	.name = "counter_device",
 	.release = counter_device_release,
 };

---
base-commit: b6dce0452a0276339392bc5eeb722370a466ba25
change-id: 20240219-device_cleanup-counter-ca191517686c

Best regards,
-- 
Ricardo B. Marliere <ricardo@marliere.net>
Re: [PATCH] counter: constify the struct device_type usage
Posted by William Breathitt Gray 1 year, 11 months ago
On Mon, 19 Feb 2024 16:52:52 -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
> counter_device_type variable to be a constant structure as well, placing it
> into read-only memory which can not be modified at runtime.
> 
> 

Applied, thanks!

[1/1] counter: constify the struct device_type usage
      commit: 3bb282ef1149a08a94bc5321b758825bc99c84c0

William Breathitt Gray <william.gray@linaro.org>