hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/hid/intel-ish-hid/ishtp-hid-client.c
....@@ -1,28 +1,21 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * ISHTP client driver for HID (ISH)
34 *
45 * Copyright (c) 2014-2016, Intel Corporation.
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms and conditions of the GNU General Public License,
8
- * version 2, as published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope it will be useful, but WITHOUT
11
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13
- * more details.
146 */
157
168 #include <linux/module.h>
179 #include <linux/hid.h>
10
+#include <linux/intel-ish-client-if.h>
1811 #include <linux/sched.h>
19
-#include "ishtp/ishtp-dev.h"
20
-#include "ishtp/client.h"
2112 #include "ishtp-hid.h"
2213
2314 /* Rx ring buffer pool size */
2415 #define HID_CL_RX_RING_SIZE 32
2516 #define HID_CL_TX_RING_SIZE 16
17
+
18
+#define cl_data_to_dev(client_data) ishtp_device(client_data->cl_device)
2619
2720 /**
2821 * report_bad_packets() - Report bad packets
....@@ -37,9 +30,9 @@
3730 size_t cur_pos, size_t payload_len)
3831 {
3932 struct hostif_msg *recv_msg = recv_buf;
40
- struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data;
33
+ struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
4134
42
- dev_err(&client_data->cl_device->dev, "[hid-ish]: BAD packet %02X\n"
35
+ dev_err(cl_data_to_dev(client_data), "[hid-ish]: BAD packet %02X\n"
4336 "total_bad=%u cur_pos=%u\n"
4437 "[%02X %02X %02X %02X]\n"
4538 "payload_len=%u\n"
....@@ -69,13 +62,15 @@
6962 unsigned char *payload;
7063 struct device_info *dev_info;
7164 int i, j;
72
- size_t payload_len, total_len, cur_pos;
65
+ size_t payload_len, total_len, cur_pos, raw_len;
7366 int report_type;
7467 struct report_list *reports_list;
7568 char *reports;
7669 size_t report_len;
77
- struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data;
70
+ struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
7871 int curr_hid_dev = client_data->cur_hid_dev;
72
+ struct ishtp_hid_data *hid_data = NULL;
73
+ struct hid_device *hid = NULL;
7974
8075 payload = recv_buf + sizeof(struct hostif_msg_hdr);
8176 total_len = data_len;
....@@ -83,12 +78,12 @@
8378
8479 do {
8580 if (cur_pos + sizeof(struct hostif_msg) > total_len) {
86
- dev_err(&client_data->cl_device->dev,
81
+ dev_err(cl_data_to_dev(client_data),
8782 "[hid-ish]: error, received %u which is less than data header %u\n",
8883 (unsigned int)data_len,
8984 (unsigned int)sizeof(struct hostif_msg_hdr));
9085 ++client_data->bad_recv_cnt;
91
- ish_hw_reset(hid_ishtp_cl->dev);
86
+ ish_hw_reset(ishtp_get_ishtp_device(hid_ishtp_cl));
9287 break;
9388 }
9489
....@@ -101,7 +96,7 @@
10196 ++client_data->bad_recv_cnt;
10297 report_bad_packet(hid_ishtp_cl, recv_msg, cur_pos,
10398 payload_len);
104
- ish_hw_reset(hid_ishtp_cl->dev);
99
+ ish_hw_reset(ishtp_get_ishtp_device(hid_ishtp_cl));
105100 break;
106101 }
107102
....@@ -116,18 +111,18 @@
116111 report_bad_packet(hid_ishtp_cl, recv_msg,
117112 cur_pos,
118113 payload_len);
119
- ish_hw_reset(hid_ishtp_cl->dev);
114
+ ish_hw_reset(ishtp_get_ishtp_device(hid_ishtp_cl));
120115 break;
121116 }
122117 client_data->hid_dev_count = (unsigned int)*payload;
123118 if (!client_data->hid_devices)
124119 client_data->hid_devices = devm_kcalloc(
125
- &client_data->cl_device->dev,
120
+ cl_data_to_dev(client_data),
126121 client_data->hid_dev_count,
127122 sizeof(struct device_info),
128123 GFP_KERNEL);
129124 if (!client_data->hid_devices) {
130
- dev_err(&client_data->cl_device->dev,
125
+ dev_err(cl_data_to_dev(client_data),
131126 "Mem alloc failed for hid device info\n");
132127 wake_up_interruptible(&client_data->init_wait);
133128 break;
....@@ -135,7 +130,7 @@
135130 for (i = 0; i < client_data->hid_dev_count; ++i) {
136131 if (1 + sizeof(struct device_info) * i >=
137132 payload_len) {
138
- dev_err(&client_data->cl_device->dev,
133
+ dev_err(cl_data_to_dev(client_data),
139134 "[hid-ish]: [ENUM_DEVICES]: content size %zu is bigger than payload_len %zu\n",
140135 1 + sizeof(struct device_info)
141136 * i, payload_len);
....@@ -165,12 +160,12 @@
165160 report_bad_packet(hid_ishtp_cl, recv_msg,
166161 cur_pos,
167162 payload_len);
168
- ish_hw_reset(hid_ishtp_cl->dev);
163
+ ish_hw_reset(ishtp_get_ishtp_device(hid_ishtp_cl));
169164 break;
170165 }
171166 if (!client_data->hid_descr[curr_hid_dev])
172167 client_data->hid_descr[curr_hid_dev] =
173
- devm_kmalloc(&client_data->cl_device->dev,
168
+ devm_kmalloc(cl_data_to_dev(client_data),
174169 payload_len, GFP_KERNEL);
175170 if (client_data->hid_descr[curr_hid_dev]) {
176171 memcpy(client_data->hid_descr[curr_hid_dev],
....@@ -190,12 +185,12 @@
190185 report_bad_packet(hid_ishtp_cl, recv_msg,
191186 cur_pos,
192187 payload_len);
193
- ish_hw_reset(hid_ishtp_cl->dev);
188
+ ish_hw_reset(ishtp_get_ishtp_device(hid_ishtp_cl));
194189 break;
195190 }
196191 if (!client_data->report_descr[curr_hid_dev])
197192 client_data->report_descr[curr_hid_dev] =
198
- devm_kmalloc(&client_data->cl_device->dev,
193
+ devm_kmalloc(cl_data_to_dev(client_data),
199194 payload_len, GFP_KERNEL);
200195 if (client_data->report_descr[curr_hid_dev]) {
201196 memcpy(client_data->report_descr[curr_hid_dev],
....@@ -219,18 +214,31 @@
219214 /* Get index of device that matches this id */
220215 for (i = 0; i < client_data->num_hid_devices; ++i) {
221216 if (recv_msg->hdr.device_id ==
222
- client_data->hid_devices[i].dev_id)
223
- if (client_data->hid_sensor_hubs[i]) {
224
- hid_input_report(
225
- client_data->hid_sensor_hubs[
226
- i],
227
- report_type, payload,
228
- payload_len, 0);
229
- ishtp_hid_wakeup(
230
- client_data->hid_sensor_hubs[
231
- i]);
217
+ client_data->hid_devices[i].dev_id) {
218
+ hid = client_data->hid_sensor_hubs[i];
219
+ if (!hid)
232220 break;
221
+
222
+ hid_data = hid->driver_data;
223
+ if (hid_data->raw_get_req) {
224
+ raw_len =
225
+ (hid_data->raw_buf_size <
226
+ payload_len) ?
227
+ hid_data->raw_buf_size :
228
+ payload_len;
229
+
230
+ memcpy(hid_data->raw_buf,
231
+ payload, raw_len);
232
+ } else {
233
+ hid_input_report
234
+ (hid, report_type,
235
+ payload, payload_len,
236
+ 0);
233237 }
238
+
239
+ ishtp_hid_wakeup(hid);
240
+ break;
241
+ }
234242 }
235243 break;
236244
....@@ -295,7 +303,7 @@
295303 ++client_data->bad_recv_cnt;
296304 report_bad_packet(hid_ishtp_cl, recv_msg, cur_pos,
297305 payload_len);
298
- ish_hw_reset(hid_ishtp_cl->dev);
306
+ ish_hw_reset(ishtp_get_ishtp_device(hid_ishtp_cl));
299307 break;
300308
301309 }
....@@ -320,23 +328,14 @@
320328 */
321329 static void ish_cl_event_cb(struct ishtp_cl_device *device)
322330 {
323
- struct ishtp_cl *hid_ishtp_cl = device->driver_data;
331
+ struct ishtp_cl *hid_ishtp_cl = ishtp_get_drvdata(device);
324332 struct ishtp_cl_rb *rb_in_proc;
325333 size_t r_length;
326
- unsigned long flags;
327334
328335 if (!hid_ishtp_cl)
329336 return;
330337
331
- spin_lock_irqsave(&hid_ishtp_cl->in_process_spinlock, flags);
332
- while (!list_empty(&hid_ishtp_cl->in_process_list.list)) {
333
- rb_in_proc = list_entry(
334
- hid_ishtp_cl->in_process_list.list.next,
335
- struct ishtp_cl_rb, list);
336
- list_del_init(&rb_in_proc->list);
337
- spin_unlock_irqrestore(&hid_ishtp_cl->in_process_spinlock,
338
- flags);
339
-
338
+ while ((rb_in_proc = ishtp_cl_rx_get_rb(hid_ishtp_cl)) != NULL) {
340339 if (!rb_in_proc->buffer.data)
341340 return;
342341
....@@ -346,9 +345,7 @@
346345 process_recv(hid_ishtp_cl, rb_in_proc->buffer.data, r_length);
347346
348347 ishtp_cl_io_rb_recycle(rb_in_proc);
349
- spin_lock_irqsave(&hid_ishtp_cl->in_process_spinlock, flags);
350348 }
351
- spin_unlock_irqrestore(&hid_ishtp_cl->in_process_spinlock, flags);
352349 }
353350
354351 /**
....@@ -486,7 +483,7 @@
486483 static int ishtp_enum_enum_devices(struct ishtp_cl *hid_ishtp_cl)
487484 {
488485 struct hostif_msg msg;
489
- struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data;
486
+ struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
490487 int retry_count;
491488 int rv;
492489
....@@ -512,18 +509,18 @@
512509 sizeof(struct hostif_msg));
513510 }
514511 if (!client_data->enum_devices_done) {
515
- dev_err(&client_data->cl_device->dev,
512
+ dev_err(cl_data_to_dev(client_data),
516513 "[hid-ish]: timed out waiting for enum_devices\n");
517514 return -ETIMEDOUT;
518515 }
519516 if (!client_data->hid_devices) {
520
- dev_err(&client_data->cl_device->dev,
517
+ dev_err(cl_data_to_dev(client_data),
521518 "[hid-ish]: failed to allocate HID dev structures\n");
522519 return -ENOMEM;
523520 }
524521
525522 client_data->num_hid_devices = client_data->hid_dev_count;
526
- dev_info(&hid_ishtp_cl->device->dev,
523
+ dev_info(ishtp_device(client_data->cl_device),
527524 "[hid-ish]: enum_devices_done OK, num_hid_devices=%d\n",
528525 client_data->num_hid_devices);
529526
....@@ -542,7 +539,7 @@
542539 static int ishtp_get_hid_descriptor(struct ishtp_cl *hid_ishtp_cl, int index)
543540 {
544541 struct hostif_msg msg;
545
- struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data;
542
+ struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
546543 int rv;
547544
548545 /* Get HID descriptor */
....@@ -560,13 +557,13 @@
560557 client_data->hid_descr_done,
561558 3 * HZ);
562559 if (!client_data->hid_descr_done) {
563
- dev_err(&client_data->cl_device->dev,
560
+ dev_err(cl_data_to_dev(client_data),
564561 "[hid-ish]: timed out for hid_descr_done\n");
565562 return -EIO;
566563 }
567564
568565 if (!client_data->hid_descr[index]) {
569
- dev_err(&client_data->cl_device->dev,
566
+ dev_err(cl_data_to_dev(client_data),
570567 "[hid-ish]: allocation HID desc fail\n");
571568 return -ENOMEM;
572569 }
....@@ -589,7 +586,7 @@
589586 int index)
590587 {
591588 struct hostif_msg msg;
592
- struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data;
589
+ struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
593590 int rv;
594591
595592 /* Get report descriptor */
....@@ -607,12 +604,12 @@
607604 client_data->report_descr_done,
608605 3 * HZ);
609606 if (!client_data->report_descr_done) {
610
- dev_err(&client_data->cl_device->dev,
607
+ dev_err(cl_data_to_dev(client_data),
611608 "[hid-ish]: timed out for report descr\n");
612609 return -EIO;
613610 }
614611 if (!client_data->report_descr[index]) {
615
- dev_err(&client_data->cl_device->dev,
612
+ dev_err(cl_data_to_dev(client_data),
616613 "[hid-ish]: failed to alloc report descr\n");
617614 return -ENOMEM;
618615 }
....@@ -637,44 +634,42 @@
637634 static int hid_ishtp_cl_init(struct ishtp_cl *hid_ishtp_cl, int reset)
638635 {
639636 struct ishtp_device *dev;
640
- unsigned long flags;
641
- struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data;
637
+ struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
638
+ struct ishtp_fw_client *fw_client;
642639 int i;
643640 int rv;
644641
645
- dev_dbg(&client_data->cl_device->dev, "%s\n", __func__);
642
+ dev_dbg(cl_data_to_dev(client_data), "%s\n", __func__);
646643 hid_ishtp_trace(client_data, "%s reset flag: %d\n", __func__, reset);
647644
648
- rv = ishtp_cl_link(hid_ishtp_cl, ISHTP_HOST_CLIENT_ID_ANY);
645
+ rv = ishtp_cl_link(hid_ishtp_cl);
649646 if (rv) {
650
- dev_err(&client_data->cl_device->dev,
647
+ dev_err(cl_data_to_dev(client_data),
651648 "ishtp_cl_link failed\n");
652649 return -ENOMEM;
653650 }
654651
655652 client_data->init_done = 0;
656653
657
- dev = hid_ishtp_cl->dev;
654
+ dev = ishtp_get_ishtp_device(hid_ishtp_cl);
658655
659656 /* Connect to FW client */
660
- hid_ishtp_cl->rx_ring_size = HID_CL_RX_RING_SIZE;
661
- hid_ishtp_cl->tx_ring_size = HID_CL_TX_RING_SIZE;
657
+ ishtp_set_tx_ring_size(hid_ishtp_cl, HID_CL_TX_RING_SIZE);
658
+ ishtp_set_rx_ring_size(hid_ishtp_cl, HID_CL_RX_RING_SIZE);
662659
663
- spin_lock_irqsave(&dev->fw_clients_lock, flags);
664
- i = ishtp_fw_cl_by_uuid(dev, &hid_ishtp_guid);
665
- if (i < 0) {
666
- spin_unlock_irqrestore(&dev->fw_clients_lock, flags);
667
- dev_err(&client_data->cl_device->dev,
660
+ fw_client = ishtp_fw_cl_get_client(dev, &hid_ishtp_guid);
661
+ if (!fw_client) {
662
+ dev_err(cl_data_to_dev(client_data),
668663 "ish client uuid not found\n");
669
- return i;
664
+ return -ENOENT;
670665 }
671
- hid_ishtp_cl->fw_client_id = dev->fw_clients[i].client_id;
672
- spin_unlock_irqrestore(&dev->fw_clients_lock, flags);
673
- hid_ishtp_cl->state = ISHTP_CL_CONNECTING;
666
+ ishtp_cl_set_fw_client_id(hid_ishtp_cl,
667
+ ishtp_get_fw_client_id(fw_client));
668
+ ishtp_set_connection_state(hid_ishtp_cl, ISHTP_CL_CONNECTING);
674669
675670 rv = ishtp_cl_connect(hid_ishtp_cl);
676671 if (rv) {
677
- dev_err(&client_data->cl_device->dev,
672
+ dev_err(cl_data_to_dev(client_data),
678673 "client connect fail\n");
679674 goto err_cl_unlink;
680675 }
....@@ -682,7 +677,7 @@
682677 hid_ishtp_trace(client_data, "%s client connected\n", __func__);
683678
684679 /* Register read callback */
685
- ishtp_register_event_cb(hid_ishtp_cl->device, ish_cl_event_cb);
680
+ ishtp_register_event_cb(client_data->cl_device, ish_cl_event_cb);
686681
687682 rv = ishtp_enum_enum_devices(hid_ishtp_cl);
688683 if (rv)
....@@ -705,7 +700,7 @@
705700 if (!reset) {
706701 rv = ishtp_hid_probe(i, client_data);
707702 if (rv) {
708
- dev_err(&client_data->cl_device->dev,
703
+ dev_err(cl_data_to_dev(client_data),
709704 "[hid-ish]: HID probe for #%u failed: %d\n",
710705 i, rv);
711706 goto err_cl_disconnect;
....@@ -720,7 +715,7 @@
720715 return 0;
721716
722717 err_cl_disconnect:
723
- hid_ishtp_cl->state = ISHTP_CL_DISCONNECTING;
718
+ ishtp_set_connection_state(hid_ishtp_cl, ISHTP_CL_DISCONNECTING);
724719 ishtp_cl_disconnect(hid_ishtp_cl);
725720 err_cl_unlink:
726721 ishtp_cl_unlink(hid_ishtp_cl);
....@@ -757,16 +752,16 @@
757752
758753 hid_ishtp_trace(client_data, "%s hid_ishtp_cl %p\n", __func__,
759754 hid_ishtp_cl);
760
- dev_dbg(&cl_device->dev, "%s\n", __func__);
755
+ dev_dbg(ishtp_device(client_data->cl_device), "%s\n", __func__);
761756
762757 hid_ishtp_cl_deinit(hid_ishtp_cl);
763758
764
- hid_ishtp_cl = ishtp_cl_allocate(cl_device->ishtp_dev);
759
+ hid_ishtp_cl = ishtp_cl_allocate(cl_device);
765760 if (!hid_ishtp_cl)
766761 return;
767762
768
- cl_device->driver_data = hid_ishtp_cl;
769
- hid_ishtp_cl->client_data = client_data;
763
+ ishtp_set_drvdata(cl_device, hid_ishtp_cl);
764
+ ishtp_set_client_data(hid_ishtp_cl, client_data);
770765 client_data->hid_ishtp_cl = hid_ishtp_cl;
771766
772767 client_data->num_hid_devices = 0;
....@@ -775,14 +770,16 @@
775770 rv = hid_ishtp_cl_init(hid_ishtp_cl, 1);
776771 if (!rv)
777772 break;
778
- dev_err(&client_data->cl_device->dev, "Retry reset init\n");
773
+ dev_err(cl_data_to_dev(client_data), "Retry reset init\n");
779774 }
780775 if (rv) {
781
- dev_err(&client_data->cl_device->dev, "Reset Failed\n");
776
+ dev_err(cl_data_to_dev(client_data), "Reset Failed\n");
782777 hid_ishtp_trace(client_data, "%s Failed hid_ishtp_cl %p\n",
783778 __func__, hid_ishtp_cl);
784779 }
785780 }
781
+
782
+void (*hid_print_trace)(void *unused, const char *format, ...);
786783
787784 /**
788785 * hid_ishtp_cl_probe() - ISHTP client driver probe
....@@ -801,21 +798,18 @@
801798 if (!cl_device)
802799 return -ENODEV;
803800
804
- if (uuid_le_cmp(hid_ishtp_guid,
805
- cl_device->fw_client->props.protocol_name) != 0)
806
- return -ENODEV;
807
-
808
- client_data = devm_kzalloc(&cl_device->dev, sizeof(*client_data),
801
+ client_data = devm_kzalloc(ishtp_device(cl_device),
802
+ sizeof(*client_data),
809803 GFP_KERNEL);
810804 if (!client_data)
811805 return -ENOMEM;
812806
813
- hid_ishtp_cl = ishtp_cl_allocate(cl_device->ishtp_dev);
807
+ hid_ishtp_cl = ishtp_cl_allocate(cl_device);
814808 if (!hid_ishtp_cl)
815809 return -ENOMEM;
816810
817
- cl_device->driver_data = hid_ishtp_cl;
818
- hid_ishtp_cl->client_data = client_data;
811
+ ishtp_set_drvdata(cl_device, hid_ishtp_cl);
812
+ ishtp_set_client_data(hid_ishtp_cl, client_data);
819813 client_data->hid_ishtp_cl = hid_ishtp_cl;
820814 client_data->cl_device = cl_device;
821815
....@@ -823,6 +817,8 @@
823817 init_waitqueue_head(&client_data->ishtp_resume_wait);
824818
825819 INIT_WORK(&client_data->work, hid_ishtp_cl_reset_handler);
820
+
821
+ hid_print_trace = ishtp_trace_callback(cl_device);
826822
827823 rv = hid_ishtp_cl_init(hid_ishtp_cl, 0);
828824 if (rv) {
....@@ -844,14 +840,14 @@
844840 */
845841 static int hid_ishtp_cl_remove(struct ishtp_cl_device *cl_device)
846842 {
847
- struct ishtp_cl *hid_ishtp_cl = cl_device->driver_data;
848
- struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data;
843
+ struct ishtp_cl *hid_ishtp_cl = ishtp_get_drvdata(cl_device);
844
+ struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
849845
850846 hid_ishtp_trace(client_data, "%s hid_ishtp_cl %p\n", __func__,
851847 hid_ishtp_cl);
852848
853
- dev_dbg(&cl_device->dev, "%s\n", __func__);
854
- hid_ishtp_cl->state = ISHTP_CL_DISCONNECTING;
849
+ dev_dbg(ishtp_device(cl_device), "%s\n", __func__);
850
+ ishtp_set_connection_state(hid_ishtp_cl, ISHTP_CL_DISCONNECTING);
855851 ishtp_cl_disconnect(hid_ishtp_cl);
856852 ishtp_put_device(cl_device);
857853 ishtp_hid_remove(client_data);
....@@ -874,8 +870,8 @@
874870 */
875871 static int hid_ishtp_cl_reset(struct ishtp_cl_device *cl_device)
876872 {
877
- struct ishtp_cl *hid_ishtp_cl = cl_device->driver_data;
878
- struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data;
873
+ struct ishtp_cl *hid_ishtp_cl = ishtp_get_drvdata(cl_device);
874
+ struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
879875
880876 hid_ishtp_trace(client_data, "%s hid_ishtp_cl %p\n", __func__,
881877 hid_ishtp_cl);
....@@ -884,8 +880,6 @@
884880
885881 return 0;
886882 }
887
-
888
-#define to_ishtp_cl_device(d) container_of(d, struct ishtp_cl_device, dev)
889883
890884 /**
891885 * hid_ishtp_cl_suspend() - ISHTP client driver suspend
....@@ -897,9 +891,9 @@
897891 */
898892 static int hid_ishtp_cl_suspend(struct device *device)
899893 {
900
- struct ishtp_cl_device *cl_device = to_ishtp_cl_device(device);
901
- struct ishtp_cl *hid_ishtp_cl = cl_device->driver_data;
902
- struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data;
894
+ struct ishtp_cl_device *cl_device = ishtp_dev_to_cl_device(device);
895
+ struct ishtp_cl *hid_ishtp_cl = ishtp_get_drvdata(cl_device);
896
+ struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
903897
904898 hid_ishtp_trace(client_data, "%s hid_ishtp_cl %p\n", __func__,
905899 hid_ishtp_cl);
....@@ -918,9 +912,9 @@
918912 */
919913 static int hid_ishtp_cl_resume(struct device *device)
920914 {
921
- struct ishtp_cl_device *cl_device = to_ishtp_cl_device(device);
922
- struct ishtp_cl *hid_ishtp_cl = cl_device->driver_data;
923
- struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data;
915
+ struct ishtp_cl_device *cl_device = ishtp_dev_to_cl_device(device);
916
+ struct ishtp_cl *hid_ishtp_cl = ishtp_get_drvdata(cl_device);
917
+ struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
924918
925919 hid_ishtp_trace(client_data, "%s hid_ishtp_cl %p\n", __func__,
926920 hid_ishtp_cl);
....@@ -935,6 +929,7 @@
935929
936930 static struct ishtp_cl_driver hid_ishtp_cl_driver = {
937931 .name = "ish-hid",
932
+ .guid = &hid_ishtp_guid,
938933 .probe = hid_ishtp_cl_probe,
939934 .remove = hid_ishtp_cl_remove,
940935 .reset = hid_ishtp_cl_reset,
....@@ -946,7 +941,7 @@
946941 int rv;
947942
948943 /* Register ISHTP client device driver with ISHTP Bus */
949
- rv = ishtp_cl_driver_register(&hid_ishtp_cl_driver);
944
+ rv = ishtp_cl_driver_register(&hid_ishtp_cl_driver, THIS_MODULE);
950945
951946 return rv;
952947