From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org
Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org
Subject: [PATCH 5/8] Input: usbtouchscreen - constify usbtouch_dev_info table
Date: Thu, 11 Jul 2024 22:18:47 -0700 [thread overview]
Message-ID: <20240712051851.3463657-5-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20240712051851.3463657-1-dmitry.torokhov@gmail.com>
The data in this table is shared between all instances of the
touchscreens so it should not be modified.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/touchscreen/usbtouchscreen.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index f8a67834a695..813a04ba75a2 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -92,7 +92,7 @@ struct usbtouch_usb {
struct urb *irq;
struct usb_interface *interface;
struct input_dev *input;
- struct usbtouch_device_info *type;
+ const struct usbtouch_device_info *type;
struct mutex pm_mutex; /* serialize access to open/suspend */
bool is_open;
char name[128];
@@ -130,7 +130,7 @@ enum {
DEVTYPE_ETOUCH,
};
-static struct usbtouch_device_info usbtouch_dev_info[];
+static const struct usbtouch_device_info usbtouch_dev_info[];
/*****************************************************************************
* e2i Part
@@ -960,13 +960,11 @@ static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt)
if (ret)
dev_warn(dev, "Failed to submit ACK URB: %d\n", ret);
- if (!usbtouch->type->max_xc) {
- usbtouch->type->max_xc = 2 * x_len;
+ if (!input_abs_get_max(usbtouch->input, ABS_X)) {
input_set_abs_params(usbtouch->input, ABS_X,
- 0, usbtouch->type->max_xc, 0, 0);
- usbtouch->type->max_yc = 2 * y_len;
+ 0, 2 * x_len, 0, 0);
input_set_abs_params(usbtouch->input, ABS_Y,
- 0, usbtouch->type->max_yc, 0, 0);
+ 0, 2 * y_len, 0, 0);
}
/*
* The device reports state of IR sensors on X and Y axes.
@@ -1045,7 +1043,7 @@ static int elo_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
/*****************************************************************************
* the different device descriptors
*/
-static struct usbtouch_device_info usbtouch_dev_info[] = {
+static const struct usbtouch_device_info usbtouch_dev_info[] = {
#ifdef CONFIG_TOUCHSCREEN_USB_ELO
[DEVTYPE_ELO] = {
.min_xc = 0x0,
@@ -1273,10 +1271,10 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch,
unsigned char *pkt, int len)
{
- struct usbtouch_device_info *type = usbtouch->type;
+ const struct usbtouch_device_info *type = usbtouch->type;
if (!type->read_data(usbtouch, pkt))
- return;
+ return;
input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch);
@@ -1538,7 +1536,7 @@ static int usbtouch_probe(struct usb_interface *intf,
struct input_dev *input_dev;
struct usb_endpoint_descriptor *endpoint;
struct usb_device *udev = interface_to_usbdev(intf);
- struct usbtouch_device_info *type;
+ const struct usbtouch_device_info *type;
int err = -ENOMEM;
/* some devices are ignored */
--
2.45.2.993.g49e7a77208-goog
next prev parent reply other threads:[~2024-07-12 5:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-12 5:18 [PATCH 1/8] Input: usbtouchscreen - use driver core to instantiate device attributes Dmitry Torokhov
2024-07-12 5:18 ` [PATCH 2/8] Input: usbtouchscreen - remove custom USB_DEVICE_HID_CLASS macro Dmitry Torokhov
2024-07-12 7:29 ` Greg KH
2024-07-12 5:18 ` [PATCH 3/8] Input: usbtouchscreen - move the driver ID table Dmitry Torokhov
2024-07-12 7:29 ` Greg KH
2024-07-12 5:18 ` [PATCH 4/8] Input: usbtouchscreen - move process_pkt() into main device structure Dmitry Torokhov
2024-07-12 7:29 ` Greg KH
2024-07-12 5:18 ` Dmitry Torokhov [this message]
2024-07-12 7:28 ` [PATCH 5/8] Input: usbtouchscreen - constify usbtouch_dev_info table Greg KH
2024-07-12 5:18 ` [PATCH 6/8] Input: usbtouchscreen - split device info table into individual pieces Dmitry Torokhov
2024-07-12 7:28 ` Greg KH
2024-07-12 5:18 ` [PATCH 7/8] Input: usbtouchscreen - use guard notation when acquiring mutexes Dmitry Torokhov
2024-07-12 7:28 ` Greg KH
2024-07-12 5:18 ` [PATCH 8/8] Input: usbtouchscreen - switch to using __free() cleanup facility Dmitry Torokhov
2024-07-12 7:27 ` Greg KH
2024-07-12 7:27 ` [PATCH 1/8] Input: usbtouchscreen - use driver core to instantiate device attributes Greg KH
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=20240712051851.3463657-5-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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