@@ -70,6 +70,8 @@ static void amd_sfh_work(struct work_struct *work)
70
70
struct amd_input_data * in_data = cli_data -> in_data ;
71
71
struct request_list * req_node ;
72
72
u8 current_index , sensor_index ;
73
+ struct amd_mp2_ops * mp2_ops ;
74
+ struct amd_mp2_dev * mp2 ;
73
75
u8 report_id , node_type ;
74
76
u8 report_size = 0 ;
75
77
@@ -81,9 +83,11 @@ static void amd_sfh_work(struct work_struct *work)
81
83
node_type = req_node -> report_type ;
82
84
kfree (req_node );
83
85
86
+ mp2 = container_of (in_data , struct amd_mp2_dev , in_data );
87
+ mp2_ops = mp2 -> mp2_ops ;
84
88
if (node_type == HID_FEATURE_REPORT ) {
85
- report_size = get_feature_report (sensor_index , report_id ,
86
- cli_data -> feature_report [current_index ]);
89
+ report_size = mp2_ops -> get_feat_rep (sensor_index , report_id ,
90
+ cli_data -> feature_report [current_index ]);
87
91
if (report_size )
88
92
hid_input_report (cli_data -> hid_sensor_hubs [current_index ],
89
93
cli_data -> report_type [current_index ],
@@ -92,7 +96,7 @@ static void amd_sfh_work(struct work_struct *work)
92
96
pr_err ("AMDSFH: Invalid report size\n" );
93
97
94
98
} else if (node_type == HID_INPUT_REPORT ) {
95
- report_size = get_input_report (current_index , sensor_index , report_id , in_data );
99
+ report_size = mp2_ops -> get_in_rep (current_index , sensor_index , report_id , in_data );
96
100
if (report_size )
97
101
hid_input_report (cli_data -> hid_sensor_hubs [current_index ],
98
102
cli_data -> report_type [current_index ],
@@ -109,13 +113,15 @@ static void amd_sfh_work_buffer(struct work_struct *work)
109
113
{
110
114
struct amdtp_cl_data * cli_data = container_of (work , struct amdtp_cl_data , work_buffer .work );
111
115
struct amd_input_data * in_data = cli_data -> in_data ;
116
+ struct amd_mp2_dev * mp2 ;
112
117
u8 report_size ;
113
118
int i ;
114
119
115
120
for (i = 0 ; i < cli_data -> num_hid_devices ; i ++ ) {
116
121
if (cli_data -> sensor_sts [i ] == SENSOR_ENABLED ) {
117
- report_size = get_input_report
118
- (i , cli_data -> sensor_idx [i ], cli_data -> report_id [i ], in_data );
122
+ mp2 = container_of (in_data , struct amd_mp2_dev , in_data );
123
+ report_size = mp2 -> mp2_ops -> get_in_rep (i , cli_data -> sensor_idx [i ],
124
+ cli_data -> report_id [i ], in_data );
119
125
hid_input_report (cli_data -> hid_sensor_hubs [i ], HID_INPUT_REPORT ,
120
126
in_data -> input_report [i ], report_size , 0 );
121
127
}
@@ -153,6 +159,7 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
153
159
{
154
160
struct amd_input_data * in_data = & privdata -> in_data ;
155
161
struct amdtp_cl_data * cl_data = privdata -> cl_data ;
162
+ struct amd_mp2_ops * mp2_ops = privdata -> mp2_ops ;
156
163
struct amd_mp2_sensor_info info ;
157
164
struct request_list * req_list ;
158
165
struct device * dev ;
@@ -163,6 +170,7 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
163
170
164
171
req_list = & cl_data -> req_list ;
165
172
dev = & privdata -> pdev -> dev ;
173
+ amd_sfh_set_desc_ops (mp2_ops );
166
174
167
175
cl_data -> num_hid_devices = amd_mp2_get_sensor_num (privdata , & cl_data -> sensor_idx [0 ]);
168
176
@@ -179,17 +187,17 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
179
187
cl_data -> sensor_requested_cnt [i ] = 0 ;
180
188
cl_data -> cur_hid_dev = i ;
181
189
cl_idx = cl_data -> sensor_idx [i ];
182
- cl_data -> report_descr_sz [i ] = get_descr_sz (cl_idx , descr_size );
190
+ cl_data -> report_descr_sz [i ] = mp2_ops -> get_desc_sz (cl_idx , descr_size );
183
191
if (!cl_data -> report_descr_sz [i ]) {
184
192
rc = - EINVAL ;
185
193
goto cleanup ;
186
194
}
187
- feature_report_size = get_descr_sz (cl_idx , feature_size );
195
+ feature_report_size = mp2_ops -> get_desc_sz (cl_idx , feature_size );
188
196
if (!feature_report_size ) {
189
197
rc = - EINVAL ;
190
198
goto cleanup ;
191
199
}
192
- input_report_size = get_descr_sz (cl_idx , input_size );
200
+ input_report_size = mp2_ops -> get_desc_sz (cl_idx , input_size );
193
201
if (!input_report_size ) {
194
202
rc = - EINVAL ;
195
203
goto cleanup ;
@@ -214,17 +222,17 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
214
222
rc = - ENOMEM ;
215
223
goto cleanup ;
216
224
}
217
- rc = get_report_descriptor (cl_idx , cl_data -> report_descr [i ]);
225
+ rc = mp2_ops -> get_rep_desc (cl_idx , cl_data -> report_descr [i ]);
218
226
if (rc )
219
227
return rc ;
220
- privdata -> mp2_ops -> start (privdata , info );
228
+ mp2_ops -> start (privdata , info );
221
229
status = amd_sfh_wait_for_response
222
230
(privdata , cl_data -> sensor_idx [i ], SENSOR_ENABLED );
223
231
if (status == SENSOR_ENABLED ) {
224
232
cl_data -> sensor_sts [i ] = SENSOR_ENABLED ;
225
233
rc = amdtp_hid_probe (cl_data -> cur_hid_dev , cl_data );
226
234
if (rc ) {
227
- privdata -> mp2_ops -> stop (privdata , cl_data -> sensor_idx [i ]);
235
+ mp2_ops -> stop (privdata , cl_data -> sensor_idx [i ]);
228
236
status = amd_sfh_wait_for_response
229
237
(privdata , cl_data -> sensor_idx [i ], SENSOR_DISABLED );
230
238
if (status != SENSOR_ENABLED )
@@ -240,8 +248,7 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
240
248
cl_data -> sensor_idx [i ], get_sensor_name (cl_data -> sensor_idx [i ]),
241
249
cl_data -> sensor_sts [i ]);
242
250
}
243
- if (privdata -> mp2_ops -> discovery_status &&
244
- privdata -> mp2_ops -> discovery_status (privdata ) == 0 ) {
251
+ if (mp2_ops -> discovery_status && mp2_ops -> discovery_status (privdata ) == 0 ) {
245
252
amd_sfh_hid_client_deinit (privdata );
246
253
for (i = 0 ; i < cl_data -> num_hid_devices ; i ++ ) {
247
254
devm_kfree (dev , cl_data -> feature_report [i ]);
0 commit comments