aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/main.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2014-09-29 09:31:42 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-29 11:56:01 -0400
commit2bf94cabb199f73402a5ddefa4a7bf1a82aaeda5 (patch)
tree334572e3557836eab69581513b36fc4d7ba9dfdd /drivers/misc/mei/main.c
parent3a7e9b6c661a23429b4a106d1ffa8aa5ce6c62bb (diff)
mei: get rid of most of the pci dependencies in mei
For purpose of adding testing HW we would like to get rid of pci dependency in generic mei code This patch provides only straight forward changes FW status and prob quirks need to be handled separately Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/main.c')
-rw-r--r--drivers/misc/mei/main.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 244fb6bf7463..4d738c881878 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -63,7 +63,7 @@ static int mei_open(struct inode *inode, struct file *file)
63 63
64 err = -ENODEV; 64 err = -ENODEV;
65 if (dev->dev_state != MEI_DEV_ENABLED) { 65 if (dev->dev_state != MEI_DEV_ENABLED) {
66 dev_dbg(&dev->pdev->dev, "dev_state != MEI_ENABLED dev_state = %s\n", 66 dev_dbg(dev->dev, "dev_state != MEI_ENABLED dev_state = %s\n",
67 mei_dev_state_str(dev->dev_state)); 67 mei_dev_state_str(dev->dev_state));
68 goto err_unlock; 68 goto err_unlock;
69 } 69 }
@@ -211,7 +211,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
211 211
212 err = mei_cl_read_start(cl, length); 212 err = mei_cl_read_start(cl, length);
213 if (err && err != -EBUSY) { 213 if (err && err != -EBUSY) {
214 dev_dbg(&dev->pdev->dev, 214 dev_dbg(dev->dev,
215 "mei start read failure with status = %d\n", err); 215 "mei start read failure with status = %d\n", err);
216 rets = err; 216 rets = err;
217 goto out; 217 goto out;
@@ -254,7 +254,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
254 } 254 }
255 /* now copy the data to user space */ 255 /* now copy the data to user space */
256copy_buffer: 256copy_buffer:
257 dev_dbg(&dev->pdev->dev, "buf.size = %d buf.idx= %ld\n", 257 dev_dbg(dev->dev, "buf.size = %d buf.idx= %ld\n",
258 cb->response_buffer.size, cb->buf_idx); 258 cb->response_buffer.size, cb->buf_idx);
259 if (length == 0 || ubuf == NULL || *offset > cb->buf_idx) { 259 if (length == 0 || ubuf == NULL || *offset > cb->buf_idx) {
260 rets = -EMSGSIZE; 260 rets = -EMSGSIZE;
@@ -266,7 +266,7 @@ copy_buffer:
266 length = min_t(size_t, length, cb->buf_idx - *offset); 266 length = min_t(size_t, length, cb->buf_idx - *offset);
267 267
268 if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) { 268 if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) {
269 dev_dbg(&dev->pdev->dev, "failed to copy data to userland\n"); 269 dev_dbg(dev->dev, "failed to copy data to userland\n");
270 rets = -EFAULT; 270 rets = -EFAULT;
271 goto free; 271 goto free;
272 } 272 }
@@ -285,7 +285,7 @@ free:
285 cl->reading_state = MEI_IDLE; 285 cl->reading_state = MEI_IDLE;
286 cl->read_cb = NULL; 286 cl->read_cb = NULL;
287out: 287out:
288 dev_dbg(&dev->pdev->dev, "end mei read rets= %d\n", rets); 288 dev_dbg(dev->dev, "end mei read rets= %d\n", rets);
289 mutex_unlock(&dev->device_lock); 289 mutex_unlock(&dev->device_lock);
290 return rets; 290 return rets;
291} 291}
@@ -338,7 +338,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
338 } 338 }
339 339
340 if (cl->state != MEI_FILE_CONNECTED) { 340 if (cl->state != MEI_FILE_CONNECTED) {
341 dev_err(&dev->pdev->dev, "host client = %d, is not connected to ME client = %d", 341 dev_err(dev->dev, "host client = %d, is not connected to ME client = %d",
342 cl->host_client_id, cl->me_client_id); 342 cl->host_client_id, cl->me_client_id);
343 rets = -ENODEV; 343 rets = -ENODEV;
344 goto out; 344 goto out;
@@ -386,7 +386,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
386 386
387 rets = copy_from_user(write_cb->request_buffer.data, ubuf, length); 387 rets = copy_from_user(write_cb->request_buffer.data, ubuf, length);
388 if (rets) { 388 if (rets) {
389 dev_dbg(&dev->pdev->dev, "failed to copy data from userland\n"); 389 dev_dbg(dev->dev, "failed to copy data from userland\n");
390 rets = -EFAULT; 390 rets = -EFAULT;
391 goto out; 391 goto out;
392 } 392 }
@@ -395,7 +395,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
395 rets = mei_amthif_write(dev, write_cb); 395 rets = mei_amthif_write(dev, write_cb);
396 396
397 if (rets) { 397 if (rets) {
398 dev_err(&dev->pdev->dev, 398 dev_err(dev->dev,
399 "amthif write failed with status = %d\n", rets); 399 "amthif write failed with status = %d\n", rets);
400 goto out; 400 goto out;
401 } 401 }
@@ -448,7 +448,7 @@ static int mei_ioctl_connect_client(struct file *file,
448 /* find ME client we're trying to connect to */ 448 /* find ME client we're trying to connect to */
449 me_cl = mei_me_cl_by_uuid(dev, &data->in_client_uuid); 449 me_cl = mei_me_cl_by_uuid(dev, &data->in_client_uuid);
450 if (!me_cl || me_cl->props.fixed_address) { 450 if (!me_cl || me_cl->props.fixed_address) {
451 dev_dbg(&dev->pdev->dev, "Cannot connect to FW Client UUID = %pUl\n", 451 dev_dbg(dev->dev, "Cannot connect to FW Client UUID = %pUl\n",
452 &data->in_client_uuid); 452 &data->in_client_uuid);
453 rets = -ENOTTY; 453 rets = -ENOTTY;
454 goto end; 454 goto end;
@@ -457,18 +457,18 @@ static int mei_ioctl_connect_client(struct file *file,
457 cl->me_client_id = me_cl->client_id; 457 cl->me_client_id = me_cl->client_id;
458 cl->cl_uuid = me_cl->props.protocol_name; 458 cl->cl_uuid = me_cl->props.protocol_name;
459 459
460 dev_dbg(&dev->pdev->dev, "Connect to FW Client ID = %d\n", 460 dev_dbg(dev->dev, "Connect to FW Client ID = %d\n",
461 cl->me_client_id); 461 cl->me_client_id);
462 dev_dbg(&dev->pdev->dev, "FW Client - Protocol Version = %d\n", 462 dev_dbg(dev->dev, "FW Client - Protocol Version = %d\n",
463 me_cl->props.protocol_version); 463 me_cl->props.protocol_version);
464 dev_dbg(&dev->pdev->dev, "FW Client - Max Msg Len = %d\n", 464 dev_dbg(dev->dev, "FW Client - Max Msg Len = %d\n",
465 me_cl->props.max_msg_length); 465 me_cl->props.max_msg_length);
466 466
467 /* if we're connecting to amthif client then we will use the 467 /* if we're connecting to amthif client then we will use the
468 * existing connection 468 * existing connection
469 */ 469 */
470 if (uuid_le_cmp(data->in_client_uuid, mei_amthif_guid) == 0) { 470 if (uuid_le_cmp(data->in_client_uuid, mei_amthif_guid) == 0) {
471 dev_dbg(&dev->pdev->dev, "FW Client is amthi\n"); 471 dev_dbg(dev->dev, "FW Client is amthi\n");
472 if (dev->iamthif_cl.state != MEI_FILE_CONNECTED) { 472 if (dev->iamthif_cl.state != MEI_FILE_CONNECTED) {
473 rets = -ENODEV; 473 rets = -ENODEV;
474 goto end; 474 goto end;
@@ -493,7 +493,7 @@ static int mei_ioctl_connect_client(struct file *file,
493 client = &data->out_client_properties; 493 client = &data->out_client_properties;
494 client->max_msg_length = me_cl->props.max_msg_length; 494 client->max_msg_length = me_cl->props.max_msg_length;
495 client->protocol_version = me_cl->props.protocol_version; 495 client->protocol_version = me_cl->props.protocol_version;
496 dev_dbg(&dev->pdev->dev, "Can connect?\n"); 496 dev_dbg(dev->dev, "Can connect?\n");
497 497
498 498
499 rets = mei_cl_connect(cl, file); 499 rets = mei_cl_connect(cl, file);
@@ -524,7 +524,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
524 524
525 dev = cl->dev; 525 dev = cl->dev;
526 526
527 dev_dbg(&dev->pdev->dev, "IOCTL cmd = 0x%x", cmd); 527 dev_dbg(dev->dev, "IOCTL cmd = 0x%x", cmd);
528 528
529 mutex_lock(&dev->device_lock); 529 mutex_lock(&dev->device_lock);
530 if (dev->dev_state != MEI_DEV_ENABLED) { 530 if (dev->dev_state != MEI_DEV_ENABLED) {
@@ -534,10 +534,10 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
534 534
535 switch (cmd) { 535 switch (cmd) {
536 case IOCTL_MEI_CONNECT_CLIENT: 536 case IOCTL_MEI_CONNECT_CLIENT:
537 dev_dbg(&dev->pdev->dev, ": IOCTL_MEI_CONNECT_CLIENT.\n"); 537 dev_dbg(dev->dev, ": IOCTL_MEI_CONNECT_CLIENT.\n");
538 if (copy_from_user(&connect_data, (char __user *)data, 538 if (copy_from_user(&connect_data, (char __user *)data,
539 sizeof(struct mei_connect_client_data))) { 539 sizeof(struct mei_connect_client_data))) {
540 dev_dbg(&dev->pdev->dev, "failed to copy data from userland\n"); 540 dev_dbg(dev->dev, "failed to copy data from userland\n");
541 rets = -EFAULT; 541 rets = -EFAULT;
542 goto out; 542 goto out;
543 } 543 }
@@ -549,7 +549,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
549 /* if all is ok, copying the data back to user. */ 549 /* if all is ok, copying the data back to user. */
550 if (copy_to_user((char __user *)data, &connect_data, 550 if (copy_to_user((char __user *)data, &connect_data,
551 sizeof(struct mei_connect_client_data))) { 551 sizeof(struct mei_connect_client_data))) {
552 dev_dbg(&dev->pdev->dev, "failed to copy data to userland\n"); 552 dev_dbg(dev->dev, "failed to copy data to userland\n");
553 rets = -EFAULT; 553 rets = -EFAULT;
554 goto out; 554 goto out;
555 } 555 }
@@ -557,7 +557,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
557 break; 557 break;
558 558
559 default: 559 default:
560 dev_err(&dev->pdev->dev, ": unsupported ioctl %d.\n", cmd); 560 dev_err(dev->dev, ": unsupported ioctl %d.\n", cmd);
561 rets = -ENOIOCTLCMD; 561 rets = -ENOIOCTLCMD;
562 } 562 }
563 563
@@ -671,7 +671,7 @@ static int mei_minor_get(struct mei_device *dev)
671 if (ret >= 0) 671 if (ret >= 0)
672 dev->minor = ret; 672 dev->minor = ret;
673 else if (ret == -ENOSPC) 673 else if (ret == -ENOSPC)
674 dev_err(&dev->pdev->dev, "too many mei devices\n"); 674 dev_err(dev->dev, "too many mei devices\n");
675 675
676 mutex_unlock(&mei_minor_lock); 676 mutex_unlock(&mei_minor_lock);
677 return ret; 677 return ret;