From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Ricardo B. Marliere" <ricardo@marliere.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Sasha Levin <sashal@kernel.org>,
linux-input@vger.kernel.org
Subject: [PATCH AUTOSEL 6.6 66/75] Input: make input_class constant
Date: Fri, 29 Mar 2024 08:42:47 -0400 [thread overview]
Message-ID: <20240329124330.3089520-66-sashal@kernel.org> (raw)
In-Reply-To: <20240329124330.3089520-1-sashal@kernel.org>
From: "Ricardo B. Marliere" <ricardo@marliere.net>
[ Upstream commit a4735d40a5da96a637af6e5bf9f6ec8b9d996acd ]
Since commit 43a7206b0963 ("driver core: class: make class_register() take
a const *"), the driver core allows for struct class to be in read-only
memory, so move the input_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at boot time.
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Link: https://lore.kernel.org/r/20240305-class_cleanup-input-v1-1-0c3d950c25db@marliere.net
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/input/input.c | 2 +-
include/linux/input.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 8c5fdb0f858ab..aa4683567d180 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1918,7 +1918,7 @@ static char *input_devnode(const struct device *dev, umode_t *mode)
return kasprintf(GFP_KERNEL, "input/%s", dev_name(dev));
}
-struct class input_class = {
+const struct class input_class = {
.name = "input",
.devnode = input_devnode,
};
diff --git a/include/linux/input.h b/include/linux/input.h
index 49790c1bd2c43..fa656f30081f6 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -514,7 +514,7 @@ void input_enable_softrepeat(struct input_dev *dev, int delay, int period);
bool input_device_enabled(struct input_dev *dev);
-extern struct class input_class;
+extern const struct class input_class;
/**
* struct ff_device - force-feedback part of an input device
--
2.43.0
next prev parent reply other threads:[~2024-03-29 12:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240329124330.3089520-1-sashal@kernel.org>
2024-03-29 12:41 ` [PATCH AUTOSEL 6.6 02/75] Input: synaptics-rmi4 - fail probing if memory allocation for "phys" fails Sasha Levin
2024-03-29 12:42 ` [PATCH AUTOSEL 6.6 43/75] HID: input: avoid polling stylus battery on Chromebook Pompom Sasha Levin
2024-03-29 12:42 ` [PATCH AUTOSEL 6.6 56/75] input/touchscreen: imagis: Correct the maximum touch area value Sasha Levin
2024-03-29 12:42 ` [PATCH AUTOSEL 6.6 57/75] input/touchscreen: imagis: Add support for Imagis IST3038B Sasha Levin
2024-03-29 12:42 ` [PATCH AUTOSEL 6.6 58/75] input/touchscreen: imagis: add support for IST3032C Sasha Levin
2024-03-29 12:42 ` Sasha Levin [this message]
2024-03-29 12:42 ` [PATCH AUTOSEL 6.6 67/75] Input: imagis - use FIELD_GET where applicable Sasha Levin
2024-03-29 12:42 ` [PATCH AUTOSEL 6.6 68/75] Input: imagis - add touch key support Sasha Levin
2024-03-29 12:42 ` [PATCH AUTOSEL 6.6 69/75] Input: allocate keycode for Display refresh rate toggle Sasha Levin
2024-03-29 12:42 ` [PATCH AUTOSEL 6.6 70/75] platform/x86: touchscreen_dmi: Add an extra entry for a variant of the Chuwi Vi8 tablet Sasha Levin
2024-03-29 12:42 ` [PATCH AUTOSEL 6.6 74/75] Input: xpad - add support for Snakebyte GAMEPADs Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240329124330.3089520-66-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ricardo@marliere.net \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).