Skip to content

Commit 8120e72

Browse files
Tomas Winklergregkh
authored andcommitted
mei: add common prefix to hbm function
1. use mei_hbm_ for basic host bus message function 2. use mei_hbm_cl prefix for host bus messages that operation on behalf of a client Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e46f187 commit 8120e72

File tree

8 files changed

+53
-50
lines changed

8 files changed

+53
-50
lines changed

drivers/misc/mei/amthif.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void mei_amthif_host_init(struct mei_device *dev)
9898

9999
dev->iamthif_msg_buf = msg_buf;
100100

101-
if (mei_connect(dev, &dev->iamthif_cl)) {
101+
if (mei_hbm_cl_connect_req(dev, &dev->iamthif_cl)) {
102102
dev_dbg(&dev->pdev->dev, "Failed to connect to AMTHI client\n");
103103
dev->iamthif_cl.state = MEI_FILE_DISCONNECTED;
104104
dev->iamthif_cl.host_client_id = 0;
@@ -558,7 +558,7 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots)
558558
return -EMSGSIZE;
559559
}
560560
*slots -= mei_data2slots(sizeof(struct hbm_flow_control));
561-
if (mei_send_flow_control(dev, &dev->iamthif_cl)) {
561+
if (mei_hbm_cl_flow_control_req(dev, &dev->iamthif_cl)) {
562562
dev_dbg(&dev->pdev->dev, "iamthif flow control failed\n");
563563
return -EIO;
564564
}
@@ -630,7 +630,8 @@ static bool mei_clear_list(struct mei_device *dev,
630630
if (dev->iamthif_current_cb == cb_pos) {
631631
dev->iamthif_current_cb = NULL;
632632
/* send flow control to iamthif client */
633-
mei_send_flow_control(dev, &dev->iamthif_cl);
633+
mei_hbm_cl_flow_control_req(dev,
634+
&dev->iamthif_cl);
634635
}
635636
/* free all allocated buffers */
636637
mei_io_cb_free(cb_pos);

drivers/misc/mei/hbm.c

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,11 @@ bool mei_hbm_cl_addr_equal(struct mei_cl *cl, void *buf)
5959

6060

6161
/**
62-
* host_start_message - mei host sends start message.
62+
* mei_hbm_start_req - sends start request message.
6363
*
6464
* @dev: the device structure
65-
*
66-
* returns none.
6765
*/
68-
void mei_host_start_message(struct mei_device *dev)
66+
void mei_hbm_start_req(struct mei_device *dev)
6967
{
7068
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
7169
struct hbm_host_version_request *start_req;
@@ -92,13 +90,13 @@ void mei_host_start_message(struct mei_device *dev)
9290
}
9391

9492
/**
95-
* host_enum_clients_message - host sends enumeration client request message.
93+
* mei_hbm_enum_clients_req - sends enumeration client request message.
9694
*
9795
* @dev: the device structure
9896
*
9997
* returns none.
10098
*/
101-
void mei_host_enum_clients_message(struct mei_device *dev)
99+
static void mei_hbm_enum_clients_req(struct mei_device *dev)
102100
{
103101
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
104102
struct hbm_host_enum_request *enum_req;
@@ -120,8 +118,15 @@ void mei_host_enum_clients_message(struct mei_device *dev)
120118
return;
121119
}
122120

121+
/**
122+
* mei_hbm_prop_requsest - request property for a single client
123+
*
124+
* @dev: the device structure
125+
*
126+
* returns none.
127+
*/
123128

124-
int mei_host_client_enumerate(struct mei_device *dev)
129+
static int mei_hbm_prop_req(struct mei_device *dev)
125130
{
126131

127132
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
@@ -191,14 +196,14 @@ static void mei_hbm_stop_req_prepare(struct mei_device *dev,
191196
}
192197

193198
/**
194-
* mei_send_flow_control - sends flow control to fw.
199+
* mei_hbm_cl_flow_control_req - sends flow control requst.
195200
*
196201
* @dev: the device structure
197-
* @cl: private data of the file object
202+
* @cl: client info
198203
*
199204
* This function returns -EIO on write failure
200205
*/
201-
int mei_send_flow_control(struct mei_device *dev, struct mei_cl *cl)
206+
int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl)
202207
{
203208
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
204209
const size_t len = sizeof(struct hbm_flow_control);
@@ -213,14 +218,14 @@ int mei_send_flow_control(struct mei_device *dev, struct mei_cl *cl)
213218
}
214219

215220
/**
216-
* mei_disconnect - sends disconnect message to fw.
221+
* mei_hbm_cl_disconnect_req - sends disconnect message to fw.
217222
*
218223
* @dev: the device structure
219-
* @cl: private data of the file object
224+
* @cl: a client to disconnect from
220225
*
221226
* This function returns -EIO on write failure
222227
*/
223-
int mei_disconnect(struct mei_device *dev, struct mei_cl *cl)
228+
int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl)
224229
{
225230
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
226231
const size_t len = sizeof(struct hbm_client_connect_request);
@@ -232,14 +237,14 @@ int mei_disconnect(struct mei_device *dev, struct mei_cl *cl)
232237
}
233238

234239
/**
235-
* mei_connect - sends connect message to fw.
240+
* mei_hbm_cl_connect_req - send connection request to specific me client
236241
*
237242
* @dev: the device structure
238-
* @cl: private data of the file object
243+
* @cl: a client to connect to
239244
*
240-
* This function returns -EIO on write failure
245+
* returns -EIO on write failure
241246
*/
242-
int mei_connect(struct mei_device *dev, struct mei_cl *cl)
247+
int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl)
243248
{
244249
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
245250
const size_t len = sizeof(struct hbm_client_connect_request);
@@ -251,12 +256,13 @@ int mei_connect(struct mei_device *dev, struct mei_cl *cl)
251256
}
252257

253258
/**
254-
* mei_client_disconnect_request - disconnects from request irq routine
259+
* mei_client_disconnect_request - disconnect request initiated by me
260+
* host sends disoconnect response
255261
*
256262
* @dev: the device structure.
257-
* @disconnect_req: disconnect request bus message.
263+
* @disconnect_req: disconnect request bus message from the me
258264
*/
259-
static void mei_client_disconnect_request(struct mei_device *dev,
265+
static void mei_hbm_fw_disconnect_req(struct mei_device *dev,
260266
struct hbm_client_connect_request *disconnect_req)
261267
{
262268
struct mei_cl *cl, *next;
@@ -327,7 +333,7 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
327333
if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
328334
dev->init_clients_state == MEI_START_MESSAGE) {
329335
dev->init_clients_timer = 0;
330-
mei_host_enum_clients_message(dev);
336+
mei_hbm_enum_clients_req(dev);
331337
} else {
332338
dev->recvd_msg = false;
333339
dev_dbg(&dev->pdev->dev, "reset due to received hbm: host start\n");
@@ -390,7 +396,8 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
390396
dev->me_client_index++;
391397
dev->me_client_presentation_num++;
392398

393-
mei_host_client_enumerate(dev);
399+
/* request property for the next client */
400+
mei_hbm_prop_req(dev);
394401

395402
break;
396403

@@ -406,7 +413,8 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
406413
dev->init_clients_state =
407414
MEI_CLIENT_PROPERTIES_MESSAGE;
408415

409-
mei_host_client_enumerate(dev);
416+
/* first property reqeust */
417+
mei_hbm_prop_req(dev);
410418
} else {
411419
dev_dbg(&dev->pdev->dev, "reset due to received host enumeration clients response bus message.\n");
412420
mei_reset(dev, 1);
@@ -423,7 +431,7 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
423431
case CLIENT_DISCONNECT_REQ_CMD:
424432
/* search for client */
425433
disconnect_req = (struct hbm_client_connect_request *)mei_msg;
426-
mei_client_disconnect_request(dev, disconnect_req);
434+
mei_hbm_fw_disconnect_req(dev, disconnect_req);
427435
break;
428436

429437
case ME_STOP_REQ_CMD:

drivers/misc/mei/init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,9 @@ int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl)
529529
cb->fop_type = MEI_FOP_CLOSE;
530530
if (dev->mei_host_buffer_is_empty) {
531531
dev->mei_host_buffer_is_empty = false;
532-
if (mei_disconnect(dev, cl)) {
532+
if (mei_hbm_cl_disconnect_req(dev, cl)) {
533533
rets = -ENODEV;
534-
dev_dbg(&dev->pdev->dev, "failed to call mei_disconnect.\n");
534+
dev_err(&dev->pdev->dev, "failed to disconnect.\n");
535535
goto free;
536536
}
537537
mdelay(10); /* Wait for hardware disconnection ready */

drivers/misc/mei/interface.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,15 @@ void mei_watchdog_register(struct mei_device *dev);
6969
*/
7070
void mei_watchdog_unregister(struct mei_device *dev);
7171

72+
int mei_other_client_is_connecting(struct mei_device *dev, struct mei_cl *cl);
7273
int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl);
7374

74-
int mei_send_flow_control(struct mei_device *dev, struct mei_cl *cl);
75+
void mei_hbm_start_req(struct mei_device *dev);
7576

76-
int mei_disconnect(struct mei_device *dev, struct mei_cl *cl);
77-
int mei_other_client_is_connecting(struct mei_device *dev, struct mei_cl *cl);
78-
int mei_connect(struct mei_device *dev, struct mei_cl *cl);
77+
int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl);
78+
int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl);
79+
int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl);
80+
81+
void mei_host_client_init(struct work_struct *work);
7982

8083
#endif /* _MEI_INTERFACE_H_ */

drivers/misc/mei/interrupt.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static int _mei_irq_thread_close(struct mei_device *dev, s32 *slots,
157157

158158
*slots -= mei_data2slots(sizeof(struct hbm_client_connect_request));
159159

160-
if (mei_disconnect(dev, cl)) {
160+
if (mei_hbm_cl_disconnect_req(dev, cl)) {
161161
cl->status = 0;
162162
cb_pos->buf_idx = 0;
163163
list_move_tail(&cb_pos->list, &cmpl_list->list);
@@ -407,7 +407,7 @@ static int _mei_irq_thread_read(struct mei_device *dev, s32 *slots,
407407

408408
*slots -= mei_data2slots(sizeof(struct hbm_flow_control));
409409

410-
if (mei_send_flow_control(dev, cl)) {
410+
if (mei_hbm_cl_flow_control_req(dev, cl)) {
411411
cl->status = -ENODEV;
412412
cb_pos->buf_idx = 0;
413413
list_move_tail(&cb_pos->list, &cmpl_list->list);
@@ -443,8 +443,8 @@ static int _mei_irq_thread_ioctl(struct mei_device *dev, s32 *slots,
443443
}
444444

445445
cl->state = MEI_FILE_CONNECTING;
446-
*slots -= mei_data2slots(sizeof(struct hbm_client_connect_request));
447-
if (mei_connect(dev, cl)) {
446+
*slots -= mei_data2slots(sizeof(struct hbm_client_connect_request));
447+
if (mei_hbm_cl_connect_req(dev, cl)) {
448448
cl->status = -ENODEV;
449449
cb_pos->buf_idx = 0;
450450
list_del(&cb_pos->list);
@@ -927,7 +927,7 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id)
927927
/* link is established
928928
* start sending messages.
929929
*/
930-
mei_host_start_message(dev);
930+
mei_hbm_start_req(dev);
931931
mutex_unlock(&dev->device_lock);
932932
return IRQ_HANDLED;
933933
} else {

drivers/misc/mei/iorw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ int mei_ioctl_connect_client(struct file *file,
258258
&& !mei_other_client_is_connecting(dev, cl)) {
259259
dev_dbg(&dev->pdev->dev, "Sending Connect Message\n");
260260
dev->mei_host_buffer_is_empty = false;
261-
if (mei_connect(dev, cl)) {
261+
if (mei_hbm_cl_connect_req(dev, cl)) {
262262
dev_dbg(&dev->pdev->dev, "Sending connect message - failed\n");
263263
rets = -ENODEV;
264264
goto end;
@@ -350,7 +350,7 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl)
350350
cl->read_cb = cb;
351351
if (dev->mei_host_buffer_is_empty) {
352352
dev->mei_host_buffer_is_empty = false;
353-
if (mei_send_flow_control(dev, cl)) {
353+
if (mei_hbm_cl_flow_control_req(dev, cl)) {
354354
rets = -ENODEV;
355355
goto err;
356356
}

drivers/misc/mei/mei_dev.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -383,15 +383,6 @@ static inline bool mei_cl_cmp_id(const struct mei_cl *cl1,
383383
}
384384

385385

386-
387-
/*
388-
* MEI Host Client Functions
389-
*/
390-
void mei_host_start_message(struct mei_device *dev);
391-
void mei_host_enum_clients_message(struct mei_device *dev);
392-
int mei_host_client_enumerate(struct mei_device *dev);
393-
void mei_host_client_init(struct work_struct *work);
394-
395386
/*
396387
* MEI interrupt functions prototype
397388
*/

drivers/misc/mei/wd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ int mei_wd_host_init(struct mei_device *dev)
7979
return -ENOENT;
8080
}
8181

82-
if (mei_connect(dev, &dev->wd_cl)) {
82+
if (mei_hbm_cl_connect_req(dev, &dev->wd_cl)) {
8383
dev_err(&dev->pdev->dev, "wd: failed to connect to the client\n");
8484
dev->wd_cl.state = MEI_FILE_DISCONNECTED;
8585
dev->wd_cl.host_client_id = 0;

0 commit comments

Comments
 (0)