linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Input: struct bus_type cleanup
@ 2024-02-10 15:15 Ricardo B. Marliere
  2024-02-10 15:15 ` [PATCH 1/2] Input: synaptics-rmi4 - make rmi_bus_type const Ricardo B. Marliere
  2024-02-10 15:15 ` [PATCH 2/2] Input: serio - make serio_bus const Ricardo B. Marliere
  0 siblings, 2 replies; 5+ messages in thread
From: Ricardo B. Marliere @ 2024-02-10 15:15 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-kernel, Greg Kroah-Hartman,
	Ricardo B. Marliere

This series is part of an effort to cleanup the users of the driver
core, as can be seen in many recent patches authored by Greg across the
tree (e.g. [1]).

---
[1]: https://lore.kernel.org/lkml/?q=f%3Agregkh%40linuxfoundation.org+s%3A%22make%22+and+s%3A%22const%22

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>

---
Ricardo B. Marliere (2):
      Input: synaptics-rmi4 - make rmi_bus_type const
      Input: serio - make serio_bus const

 drivers/input/rmi4/rmi_bus.c | 2 +-
 drivers/input/rmi4/rmi_bus.h | 2 +-
 drivers/input/serio/serio.c  | 2 +-
 include/linux/serio.h        | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
---
base-commit: d03f030115fe930de1222fef294730ba21b93045
change-id: 20240210-bus_cleanup-input2-e7ef5a63e8c4

Best regards,
-- 
Ricardo B. Marliere <ricardo@marliere.net>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] Input: synaptics-rmi4 - make rmi_bus_type const
  2024-02-10 15:15 [PATCH 0/2] Input: struct bus_type cleanup Ricardo B. Marliere
@ 2024-02-10 15:15 ` Ricardo B. Marliere
  2024-03-03 23:07   ` Dmitry Torokhov
  2024-02-10 15:15 ` [PATCH 2/2] Input: serio - make serio_bus const Ricardo B. Marliere
  1 sibling, 1 reply; 5+ messages in thread
From: Ricardo B. Marliere @ 2024-02-10 15:15 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-kernel, Greg Kroah-Hartman,
	Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type,
move the variable rmi_bus_type 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>
---
 drivers/input/rmi4/rmi_bus.c | 2 +-
 drivers/input/rmi4/rmi_bus.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
index 1b45b1d3077d..343030290d78 100644
--- a/drivers/input/rmi4/rmi_bus.c
+++ b/drivers/input/rmi4/rmi_bus.c
@@ -344,7 +344,7 @@ static int rmi_bus_match(struct device *dev, struct device_driver *drv)
 	return physical || rmi_function_match(dev, drv);
 }
 
-struct bus_type rmi_bus_type = {
+const struct bus_type rmi_bus_type = {
 	.match		= rmi_bus_match,
 	.name		= "rmi4",
 };
diff --git a/drivers/input/rmi4/rmi_bus.h b/drivers/input/rmi4/rmi_bus.h
index 25df6320f9f1..ea46ad9447ec 100644
--- a/drivers/input/rmi4/rmi_bus.h
+++ b/drivers/input/rmi4/rmi_bus.h
@@ -185,7 +185,7 @@ static inline int rmi_write_block(struct rmi_device *d, u16 addr,
 
 int rmi_for_each_dev(void *data, int (*func)(struct device *dev, void *data));
 
-extern struct bus_type rmi_bus_type;
+extern const struct bus_type rmi_bus_type;
 
 int rmi_of_property_read_u32(struct device *dev, u32 *result,
 				const char *prop, bool optional);

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] Input: serio - make serio_bus const
  2024-02-10 15:15 [PATCH 0/2] Input: struct bus_type cleanup Ricardo B. Marliere
  2024-02-10 15:15 ` [PATCH 1/2] Input: synaptics-rmi4 - make rmi_bus_type const Ricardo B. Marliere
@ 2024-02-10 15:15 ` Ricardo B. Marliere
  2024-03-03 23:07   ` Dmitry Torokhov
  1 sibling, 1 reply; 5+ messages in thread
From: Ricardo B. Marliere @ 2024-02-10 15:15 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-kernel, Greg Kroah-Hartman,
	Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type,
move the serio_bus 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>
---
 drivers/input/serio/serio.c | 2 +-
 include/linux/serio.h       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 767fc9efb4a8..a8838b522627 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -1007,7 +1007,7 @@ irqreturn_t serio_interrupt(struct serio *serio,
 }
 EXPORT_SYMBOL(serio_interrupt);
 
-struct bus_type serio_bus = {
+const struct bus_type serio_bus = {
 	.name		= "serio",
 	.drv_groups	= serio_driver_groups,
 	.match		= serio_bus_match,
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 6c27d413da92..7ca41af93b37 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -15,7 +15,7 @@
 #include <linux/mod_devicetable.h>
 #include <uapi/linux/serio.h>
 
-extern struct bus_type serio_bus;
+extern const struct bus_type serio_bus;
 
 struct serio {
 	void *port_data;

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] Input: synaptics-rmi4 - make rmi_bus_type const
  2024-02-10 15:15 ` [PATCH 1/2] Input: synaptics-rmi4 - make rmi_bus_type const Ricardo B. Marliere
@ 2024-03-03 23:07   ` Dmitry Torokhov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2024-03-03 23:07 UTC (permalink / raw)
  To: Ricardo B. Marliere; +Cc: linux-input, linux-kernel, Greg Kroah-Hartman

On Sat, Feb 10, 2024 at 12:15:01PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the variable rmi_bus_type 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>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] Input: serio - make serio_bus const
  2024-02-10 15:15 ` [PATCH 2/2] Input: serio - make serio_bus const Ricardo B. Marliere
@ 2024-03-03 23:07   ` Dmitry Torokhov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2024-03-03 23:07 UTC (permalink / raw)
  To: Ricardo B. Marliere; +Cc: linux-input, linux-kernel, Greg Kroah-Hartman

On Sat, Feb 10, 2024 at 12:15:02PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the serio_bus 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>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-03 23:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-10 15:15 [PATCH 0/2] Input: struct bus_type cleanup Ricardo B. Marliere
2024-02-10 15:15 ` [PATCH 1/2] Input: synaptics-rmi4 - make rmi_bus_type const Ricardo B. Marliere
2024-03-03 23:07   ` Dmitry Torokhov
2024-02-10 15:15 ` [PATCH 2/2] Input: serio - make serio_bus const Ricardo B. Marliere
2024-03-03 23:07   ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).