* [PATCH 1/3] HID: make hid_bus_type const
@ 2023-12-20 7:38 Greg Kroah-Hartman
2023-12-20 7:38 ` [PATCH 2/3] HID: make ishtp_cl_bus_type const Greg Kroah-Hartman
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-12-20 7:38 UTC (permalink / raw)
To: jikos, benjamin.tissoires; +Cc: linux-kernel, Greg Kroah-Hartman, linux-input
Now that the driver core can properly handle constant struct bus_type,
move the hid_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hid/hid-core.c | 2 +-
include/linux/hid.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index e0181218ad85..de7a477d6665 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2749,7 +2749,7 @@ static int hid_uevent(const struct device *dev, struct kobj_uevent_env *env)
return 0;
}
-struct bus_type hid_bus_type = {
+const struct bus_type hid_bus_type = {
.name = "hid",
.dev_groups = hid_dev_groups,
.drv_groups = hid_drv_groups,
diff --git a/include/linux/hid.h b/include/linux/hid.h
index bf43f3ff6664..7c26db874ff0 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -912,7 +912,7 @@ extern bool hid_ignore(struct hid_device *);
extern int hid_add_device(struct hid_device *);
extern void hid_destroy_device(struct hid_device *);
-extern struct bus_type hid_bus_type;
+extern const struct bus_type hid_bus_type;
extern int __must_check __hid_register_driver(struct hid_driver *,
struct module *, const char *mod_name);
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] HID: make ishtp_cl_bus_type const
2023-12-20 7:38 [PATCH 1/3] HID: make hid_bus_type const Greg Kroah-Hartman
@ 2023-12-20 7:38 ` Greg Kroah-Hartman
2023-12-20 12:55 ` srinivas pandruvada
2023-12-20 7:38 ` [PATCH 3/3] HID: bpf: make bus_type const in struct hid_bpf_ops Greg Kroah-Hartman
2024-01-02 10:30 ` [PATCH 1/3] HID: make hid_bus_type const Jiri Kosina
2 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-12-20 7:38 UTC (permalink / raw)
To: jikos, benjamin.tissoires
Cc: linux-kernel, Greg Kroah-Hartman, Srinivas Pandruvada,
linux-input
Now that the driver core can properly handle constant struct bus_type,
move the ishtp_cl_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c b/drivers/hid/intel-ish-hid/ishtp/bus.c
index 7fc738a22375..aa6cb033bb06 100644
--- a/drivers/hid/intel-ish-hid/ishtp/bus.c
+++ b/drivers/hid/intel-ish-hid/ishtp/bus.c
@@ -378,7 +378,7 @@ static const struct dev_pm_ops ishtp_cl_bus_dev_pm_ops = {
.restore = ishtp_cl_device_resume,
};
-static struct bus_type ishtp_cl_bus_type = {
+static const struct bus_type ishtp_cl_bus_type = {
.name = "ishtp",
.dev_groups = ishtp_cl_dev_groups,
.probe = ishtp_cl_device_probe,
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] HID: bpf: make bus_type const in struct hid_bpf_ops
2023-12-20 7:38 [PATCH 1/3] HID: make hid_bus_type const Greg Kroah-Hartman
2023-12-20 7:38 ` [PATCH 2/3] HID: make ishtp_cl_bus_type const Greg Kroah-Hartman
@ 2023-12-20 7:38 ` Greg Kroah-Hartman
2024-01-02 10:30 ` [PATCH 1/3] HID: make hid_bus_type const Jiri Kosina
2 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-12-20 7:38 UTC (permalink / raw)
To: jikos, benjamin.tissoires; +Cc: linux-kernel, Greg Kroah-Hartman, linux-input
The struct bus_type pointer in hid_bpf_ops just passes the pointer to
the driver core, and the driver core can handle, and expects, a constant
pointer, so also make the pointer constant in hid_bpf_ops.
Part of the process of moving all usages of struct bus_type to be
constant to move them all to read-only memory.
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/linux/hid_bpf.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/hid_bpf.h b/include/linux/hid_bpf.h
index e9afb61e6ee0..840cd254172d 100644
--- a/include/linux/hid_bpf.h
+++ b/include/linux/hid_bpf.h
@@ -115,7 +115,7 @@ struct hid_bpf_ops {
size_t len, enum hid_report_type rtype,
enum hid_class_request reqtype);
struct module *owner;
- struct bus_type *bus_type;
+ const struct bus_type *bus_type;
};
extern struct hid_bpf_ops *hid_bpf_ops;
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] HID: make ishtp_cl_bus_type const
2023-12-20 7:38 ` [PATCH 2/3] HID: make ishtp_cl_bus_type const Greg Kroah-Hartman
@ 2023-12-20 12:55 ` srinivas pandruvada
0 siblings, 0 replies; 6+ messages in thread
From: srinivas pandruvada @ 2023-12-20 12:55 UTC (permalink / raw)
To: Greg Kroah-Hartman, jikos, benjamin.tissoires; +Cc: linux-kernel, linux-input
On Wed, 2023-12-20 at 08:38 +0100, Greg Kroah-Hartman wrote:
> Now that the driver core can properly handle constant struct
> bus_type,
> move the ishtp_cl_bus_type variable to be a constant structure as
> well,
> placing it into read-only memory which can not be modified at
> runtime.
>
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: Jiri Kosina <jikos@kernel.org>
> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> Cc: linux-input@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
> drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c
> b/drivers/hid/intel-ish-hid/ishtp/bus.c
> index 7fc738a22375..aa6cb033bb06 100644
> --- a/drivers/hid/intel-ish-hid/ishtp/bus.c
> +++ b/drivers/hid/intel-ish-hid/ishtp/bus.c
> @@ -378,7 +378,7 @@ static const struct dev_pm_ops
> ishtp_cl_bus_dev_pm_ops = {
> .restore = ishtp_cl_device_resume,
> };
>
> -static struct bus_type ishtp_cl_bus_type = {
> +static const struct bus_type ishtp_cl_bus_type = {
> .name = "ishtp",
> .dev_groups = ishtp_cl_dev_groups,
> .probe = ishtp_cl_device_probe,
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] HID: make hid_bus_type const
2023-12-20 7:38 [PATCH 1/3] HID: make hid_bus_type const Greg Kroah-Hartman
2023-12-20 7:38 ` [PATCH 2/3] HID: make ishtp_cl_bus_type const Greg Kroah-Hartman
2023-12-20 7:38 ` [PATCH 3/3] HID: bpf: make bus_type const in struct hid_bpf_ops Greg Kroah-Hartman
@ 2024-01-02 10:30 ` Jiri Kosina
2024-01-04 15:51 ` Greg Kroah-Hartman
2 siblings, 1 reply; 6+ messages in thread
From: Jiri Kosina @ 2024-01-02 10:30 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: benjamin.tissoires, linux-kernel, linux-input
On Wed, 20 Dec 2023, Greg Kroah-Hartman wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the hid_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
I have applied all three patches to hid.git now. Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] HID: make hid_bus_type const
2024-01-02 10:30 ` [PATCH 1/3] HID: make hid_bus_type const Jiri Kosina
@ 2024-01-04 15:51 ` Greg Kroah-Hartman
0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2024-01-04 15:51 UTC (permalink / raw)
To: Jiri Kosina; +Cc: benjamin.tissoires, linux-kernel, linux-input
On Tue, Jan 02, 2024 at 11:30:05AM +0100, Jiri Kosina wrote:
> On Wed, 20 Dec 2023, Greg Kroah-Hartman wrote:
>
> > Now that the driver core can properly handle constant struct bus_type,
> > move the hid_bus_type variable to be a constant structure as well,
> > placing it into read-only memory which can not be modified at runtime.
>
> I have applied all three patches to hid.git now. Thanks,
Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-01-04 15:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-20 7:38 [PATCH 1/3] HID: make hid_bus_type const Greg Kroah-Hartman
2023-12-20 7:38 ` [PATCH 2/3] HID: make ishtp_cl_bus_type const Greg Kroah-Hartman
2023-12-20 12:55 ` srinivas pandruvada
2023-12-20 7:38 ` [PATCH 3/3] HID: bpf: make bus_type const in struct hid_bpf_ops Greg Kroah-Hartman
2024-01-02 10:30 ` [PATCH 1/3] HID: make hid_bus_type const Jiri Kosina
2024-01-04 15:51 ` Greg Kroah-Hartman
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).