kunit: make kunit_bus_type const

Message ID 20240214-bus_cleanup-kunit-v1-1-1a38323eed73@marliere.net
State New
Headers
Series kunit: make kunit_bus_type const |

Commit Message

Ricardo B. Marliere Feb. 14, 2024, 7:15 p.m. UTC
  Since commit d492cc2573a0 ("driver core: device.h: make struct
bus_type a const *"), the driver core can properly handle constant
struct bus_type, move the kunit_bus_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>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
---
 lib/kunit/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 76021a887a50892fd969cd42a5f3467f5696e50e
change-id: 20240214-bus_cleanup-kunit-840cd37b0e10

Best regards,
  

Comments

Greg KH Feb. 15, 2024, 7:39 a.m. UTC | #1
On Wed, Feb 14, 2024 at 04:15:00PM -0300, Ricardo B. Marliere wrote:
> Since commit d492cc2573a0 ("driver core: device.h: make struct
> bus_type a const *"), the driver core can properly handle constant
> struct bus_type, move the kunit_bus_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>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  
David Gow Feb. 19, 2024, 11:39 p.m. UTC | #2
On Thu, 15 Feb 2024 at 03:14, Ricardo B. Marliere <ricardo@marliere.net> wrote:
>
> Since commit d492cc2573a0 ("driver core: device.h: make struct
> bus_type a const *"), the driver core can properly handle constant
> struct bus_type, move the kunit_bus_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>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> ---

Looks good here: thanks very much.

Reviewed-by: David Gow <davidgow@google.com>

Cheers,
-- David
  

Patch

diff --git a/lib/kunit/device.c b/lib/kunit/device.c
index f5371287b375..d23b8fb166d8 100644
--- a/lib/kunit/device.c
+++ b/lib/kunit/device.c
@@ -35,7 +35,7 @@  struct kunit_device {
 
 #define to_kunit_device(d) container_of_const(d, struct kunit_device, dev)
 
-static struct bus_type kunit_bus_type = {
+static const struct bus_type kunit_bus_type = {
 	.name		= "kunit",
 };