Commit 830f06c0 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: usbtouchscreen - constify usbtouch_dev_info table

The data in this table is shared between all instances of the
touchscreens so it should not be modified.
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240712051851.3463657-5-dmitry.torokhov@gmail.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent fbb1c922
...@@ -92,7 +92,7 @@ struct usbtouch_usb { ...@@ -92,7 +92,7 @@ struct usbtouch_usb {
struct urb *irq; struct urb *irq;
struct usb_interface *interface; struct usb_interface *interface;
struct input_dev *input; struct input_dev *input;
struct usbtouch_device_info *type; const struct usbtouch_device_info *type;
struct mutex pm_mutex; /* serialize access to open/suspend */ struct mutex pm_mutex; /* serialize access to open/suspend */
bool is_open; bool is_open;
char name[128]; char name[128];
...@@ -130,7 +130,7 @@ enum { ...@@ -130,7 +130,7 @@ enum {
DEVTYPE_ETOUCH, DEVTYPE_ETOUCH,
}; };
static struct usbtouch_device_info usbtouch_dev_info[]; static const struct usbtouch_device_info usbtouch_dev_info[];
/***************************************************************************** /*****************************************************************************
* e2i Part * e2i Part
...@@ -960,13 +960,11 @@ static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt) ...@@ -960,13 +960,11 @@ static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt)
if (ret) if (ret)
dev_warn(dev, "Failed to submit ACK URB: %d\n", ret); dev_warn(dev, "Failed to submit ACK URB: %d\n", ret);
if (!usbtouch->type->max_xc) { if (!input_abs_get_max(usbtouch->input, ABS_X)) {
usbtouch->type->max_xc = 2 * x_len;
input_set_abs_params(usbtouch->input, ABS_X, input_set_abs_params(usbtouch->input, ABS_X,
0, usbtouch->type->max_xc, 0, 0); 0, 2 * x_len, 0, 0);
usbtouch->type->max_yc = 2 * y_len;
input_set_abs_params(usbtouch->input, ABS_Y, 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. * 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) ...@@ -1045,7 +1043,7 @@ static int elo_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
/***************************************************************************** /*****************************************************************************
* the different device descriptors * 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 #ifdef CONFIG_TOUCHSCREEN_USB_ELO
[DEVTYPE_ELO] = { [DEVTYPE_ELO] = {
.min_xc = 0x0, .min_xc = 0x0,
...@@ -1273,10 +1271,10 @@ static struct usbtouch_device_info usbtouch_dev_info[] = { ...@@ -1273,10 +1271,10 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch,
unsigned char *pkt, int len) 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)) if (!type->read_data(usbtouch, pkt))
return; return;
input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch); input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch);
...@@ -1538,7 +1536,7 @@ static int usbtouch_probe(struct usb_interface *intf, ...@@ -1538,7 +1536,7 @@ static int usbtouch_probe(struct usb_interface *intf,
struct input_dev *input_dev; struct input_dev *input_dev;
struct usb_endpoint_descriptor *endpoint; struct usb_endpoint_descriptor *endpoint;
struct usb_device *udev = interface_to_usbdev(intf); struct usb_device *udev = interface_to_usbdev(intf);
struct usbtouch_device_info *type; const struct usbtouch_device_info *type;
int err = -ENOMEM; int err = -ENOMEM;
/* some devices are ignored */ /* some devices are ignored */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment