[char-misc-next 2/6] mei: get rid of most of the pci dependencies in mei

2014-09-02 Thread Tomas Winkler
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 
---
 drivers/misc/mei/amthif.c| 68 ++--
 drivers/misc/mei/bus.c   | 10 +++
 drivers/misc/mei/client.c| 46 +++---
 drivers/misc/mei/client.h|  4 +--
 drivers/misc/mei/debugfs.c   |  6 ++--
 drivers/misc/mei/hbm.c   | 66 +-
 drivers/misc/mei/hw-me.c | 30 +--
 drivers/misc/mei/hw-txe.c| 53 --
 drivers/misc/mei/init.c  | 42 +--
 drivers/misc/mei/interrupt.c | 44 ++--
 drivers/misc/mei/main.c  | 40 +-
 drivers/misc/mei/nfc.c   | 43 +---
 drivers/misc/mei/pci-me.c|  2 +-
 drivers/misc/mei/pci-txe.c   |  2 +-
 drivers/misc/mei/wd.c| 34 ++
 15 files changed, 239 insertions(+), 251 deletions(-)

diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index 1f80873..5d47d1b 100644
--- a/drivers/misc/mei/amthif.c
+++ b/drivers/misc/mei/amthif.c
@@ -78,7 +78,7 @@ int mei_amthif_host_init(struct mei_device *dev)
 
me_cl = mei_me_cl_by_uuid(dev, _amthif_guid);
if (!me_cl) {
-   dev_info(>pdev->dev, "amthif: failed to find the client");
+   dev_info(dev->dev, "amthif: failed to find the client");
return -ENOTTY;
}
 
@@ -88,7 +88,7 @@ int mei_amthif_host_init(struct mei_device *dev)
/* Assign iamthif_mtu to the value received from ME  */
 
dev->iamthif_mtu = me_cl->props.max_msg_length;
-   dev_dbg(>pdev->dev, "IAMTHIF_MTU = %d\n", dev->iamthif_mtu);
+   dev_dbg(dev->dev, "IAMTHIF_MTU = %d\n", dev->iamthif_mtu);
 
kfree(dev->iamthif_msg_buf);
dev->iamthif_msg_buf = NULL;
@@ -104,7 +104,7 @@ int mei_amthif_host_init(struct mei_device *dev)
ret = mei_cl_link(cl, MEI_IAMTHIF_HOST_CLIENT_ID);
 
if (ret < 0) {
-   dev_err(>pdev->dev,
+   dev_err(dev->dev,
"amthif: failed link client %d\n", ret);
return ret;
}
@@ -164,11 +164,11 @@ int mei_amthif_read(struct mei_device *dev, struct file 
*file,
 
/* Only possible if we are in timeout */
if (!cl) {
-   dev_err(>pdev->dev, "bad file ext.\n");
+   dev_err(dev->dev, "bad file ext.\n");
return -ETIME;
}
 
-   dev_dbg(>pdev->dev, "checking amthif data\n");
+   dev_dbg(dev->dev, "checking amthif data\n");
cb = mei_amthif_find_read_list_entry(dev, file);
 
/* Check for if we can block or not*/
@@ -176,7 +176,7 @@ int mei_amthif_read(struct mei_device *dev, struct file 
*file,
return -EAGAIN;
 
 
-   dev_dbg(>pdev->dev, "waiting for amthif data\n");
+   dev_dbg(dev->dev, "waiting for amthif data\n");
while (cb == NULL) {
/* unlock the Mutex */
mutex_unlock(>device_lock);
@@ -190,21 +190,21 @@ int mei_amthif_read(struct mei_device *dev, struct file 
*file,
if (wait_ret)
return -ERESTARTSYS;
 
-   dev_dbg(>pdev->dev, "woke up from sleep\n");
+   dev_dbg(dev->dev, "woke up from sleep\n");
}
 
 
-   dev_dbg(>pdev->dev, "Got amthif data\n");
+   dev_dbg(dev->dev, "Got amthif data\n");
dev->iamthif_timer = 0;
 
if (cb) {
timeout = cb->read_time +
mei_secs_to_jiffies(MEI_IAMTHIF_READ_TIMER);
-   dev_dbg(>pdev->dev, "amthif timeout = %lud\n",
+   dev_dbg(dev->dev, "amthif timeout = %lud\n",
timeout);
 
if  (time_after(jiffies, timeout)) {
-   dev_dbg(>pdev->dev, "amthif Time out\n");
+   dev_dbg(dev->dev, "amthif Time out\n");
/* 15 sec for the message has expired */
list_del(>list);
rets = -ETIME;
@@ -224,16 +224,16 @@ int mei_amthif_read(struct mei_device *dev, struct file 
*file,
 * remove message from deletion list
 */
 
-   dev_dbg(>pdev->dev, "amthif cb->response_buffer size - %d\n",
+   dev_dbg(dev->dev, "amthif cb->response_buffer size - %d\n",
cb->response_buffer.size);
-   dev_dbg(>pdev->dev, "amthif cb->buf_idx - %lu\n", cb->buf_idx);
+   dev_dbg(dev->dev, "amthif cb->buf_idx - %lu\n", cb->buf_idx);
 
/* length is being truncated to PAGE_SIZE, however,
 * the buf_idx may point beyond */
length = min_t(size_t, length, (cb->buf_idx - *offset));
 
if (copy_to_user(ubuf, 

[char-misc-next 2/6] mei: get rid of most of the pci dependencies in mei

2014-09-02 Thread Tomas Winkler
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.wink...@intel.com
---
 drivers/misc/mei/amthif.c| 68 ++--
 drivers/misc/mei/bus.c   | 10 +++
 drivers/misc/mei/client.c| 46 +++---
 drivers/misc/mei/client.h|  4 +--
 drivers/misc/mei/debugfs.c   |  6 ++--
 drivers/misc/mei/hbm.c   | 66 +-
 drivers/misc/mei/hw-me.c | 30 +--
 drivers/misc/mei/hw-txe.c| 53 --
 drivers/misc/mei/init.c  | 42 +--
 drivers/misc/mei/interrupt.c | 44 ++--
 drivers/misc/mei/main.c  | 40 +-
 drivers/misc/mei/nfc.c   | 43 +---
 drivers/misc/mei/pci-me.c|  2 +-
 drivers/misc/mei/pci-txe.c   |  2 +-
 drivers/misc/mei/wd.c| 34 ++
 15 files changed, 239 insertions(+), 251 deletions(-)

diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index 1f80873..5d47d1b 100644
--- a/drivers/misc/mei/amthif.c
+++ b/drivers/misc/mei/amthif.c
@@ -78,7 +78,7 @@ int mei_amthif_host_init(struct mei_device *dev)
 
me_cl = mei_me_cl_by_uuid(dev, mei_amthif_guid);
if (!me_cl) {
-   dev_info(dev-pdev-dev, amthif: failed to find the client);
+   dev_info(dev-dev, amthif: failed to find the client);
return -ENOTTY;
}
 
@@ -88,7 +88,7 @@ int mei_amthif_host_init(struct mei_device *dev)
/* Assign iamthif_mtu to the value received from ME  */
 
dev-iamthif_mtu = me_cl-props.max_msg_length;
-   dev_dbg(dev-pdev-dev, IAMTHIF_MTU = %d\n, dev-iamthif_mtu);
+   dev_dbg(dev-dev, IAMTHIF_MTU = %d\n, dev-iamthif_mtu);
 
kfree(dev-iamthif_msg_buf);
dev-iamthif_msg_buf = NULL;
@@ -104,7 +104,7 @@ int mei_amthif_host_init(struct mei_device *dev)
ret = mei_cl_link(cl, MEI_IAMTHIF_HOST_CLIENT_ID);
 
if (ret  0) {
-   dev_err(dev-pdev-dev,
+   dev_err(dev-dev,
amthif: failed link client %d\n, ret);
return ret;
}
@@ -164,11 +164,11 @@ int mei_amthif_read(struct mei_device *dev, struct file 
*file,
 
/* Only possible if we are in timeout */
if (!cl) {
-   dev_err(dev-pdev-dev, bad file ext.\n);
+   dev_err(dev-dev, bad file ext.\n);
return -ETIME;
}
 
-   dev_dbg(dev-pdev-dev, checking amthif data\n);
+   dev_dbg(dev-dev, checking amthif data\n);
cb = mei_amthif_find_read_list_entry(dev, file);
 
/* Check for if we can block or not*/
@@ -176,7 +176,7 @@ int mei_amthif_read(struct mei_device *dev, struct file 
*file,
return -EAGAIN;
 
 
-   dev_dbg(dev-pdev-dev, waiting for amthif data\n);
+   dev_dbg(dev-dev, waiting for amthif data\n);
while (cb == NULL) {
/* unlock the Mutex */
mutex_unlock(dev-device_lock);
@@ -190,21 +190,21 @@ int mei_amthif_read(struct mei_device *dev, struct file 
*file,
if (wait_ret)
return -ERESTARTSYS;
 
-   dev_dbg(dev-pdev-dev, woke up from sleep\n);
+   dev_dbg(dev-dev, woke up from sleep\n);
}
 
 
-   dev_dbg(dev-pdev-dev, Got amthif data\n);
+   dev_dbg(dev-dev, Got amthif data\n);
dev-iamthif_timer = 0;
 
if (cb) {
timeout = cb-read_time +
mei_secs_to_jiffies(MEI_IAMTHIF_READ_TIMER);
-   dev_dbg(dev-pdev-dev, amthif timeout = %lud\n,
+   dev_dbg(dev-dev, amthif timeout = %lud\n,
timeout);
 
if  (time_after(jiffies, timeout)) {
-   dev_dbg(dev-pdev-dev, amthif Time out\n);
+   dev_dbg(dev-dev, amthif Time out\n);
/* 15 sec for the message has expired */
list_del(cb-list);
rets = -ETIME;
@@ -224,16 +224,16 @@ int mei_amthif_read(struct mei_device *dev, struct file 
*file,
 * remove message from deletion list
 */
 
-   dev_dbg(dev-pdev-dev, amthif cb-response_buffer size - %d\n,
+   dev_dbg(dev-dev, amthif cb-response_buffer size - %d\n,
cb-response_buffer.size);
-   dev_dbg(dev-pdev-dev, amthif cb-buf_idx - %lu\n, cb-buf_idx);
+   dev_dbg(dev-dev, amthif cb-buf_idx - %lu\n, cb-buf_idx);
 
/* length is being truncated to PAGE_SIZE, however,
 * the buf_idx may point beyond */
length = min_t(size_t, length, (cb-buf_idx - *offset));
 
if (copy_to_user(ubuf, cb-response_buffer.data + *offset,