mei: reenable mei_hcsr_set abstraction
Now when mei_hcsr_set is local to hw-me.c
we can benefit form the fact that it wraps
H_IS removal from the host csr.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index 49b558d..3190027 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -90,13 +90,10 @@
*
* @dev: the device structure
*/
-void mei_hcsr_set(struct mei_device *dev)
+static inline void mei_hcsr_set(struct mei_device *dev, u32 hcsr)
{
-
- if ((dev->host_hw_state & H_IS) == H_IS)
- dev->host_hw_state &= ~H_IS;
- mei_reg_write(dev, H_CSR, dev->host_hw_state);
- dev->host_hw_state = mei_hcsr_read(dev);
+ hcsr &= ~H_IS;
+ mei_reg_write(dev, H_CSR, hcsr);
}
/**
@@ -120,8 +117,7 @@
{
u32 hcsr = mei_hcsr_read(dev);
hcsr |= H_IE;
- hcsr &= ~H_IS;
- mei_reg_write(dev, H_CSR, hcsr);
+ mei_hcsr_set(dev, hcsr);
}
/**
@@ -133,8 +129,7 @@
{
u32 hcsr = mei_hcsr_read(dev);
hcsr &= ~H_IE;
- hcsr &= ~H_IS;
- mei_reg_write(dev, H_CSR, hcsr);
+ mei_hcsr_set(dev, hcsr);
}
/**
@@ -156,16 +151,12 @@
else
hcsr &= ~H_IE;
- hcsr &= ~H_IS;
+ mei_hcsr_set(dev, hcsr);
- mei_reg_write(dev, H_CSR, hcsr);
- hcsr = mei_hcsr_read(dev);
-
+ hcsr = mei_hcsr_read(dev) | H_IG;
hcsr &= ~H_RST;
- hcsr |= H_IG;
- hcsr &= ~H_IS;
- mei_reg_write(dev, H_CSR, hcsr);
+ mei_hcsr_set(dev, hcsr);
hcsr = mei_hcsr_read(dev);
@@ -182,7 +173,7 @@
void mei_host_set_ready(struct mei_device *dev)
{
dev->host_hw_state |= H_IE | H_IG | H_RDY;
- mei_hcsr_set(dev);
+ mei_hcsr_set(dev, dev->host_hw_state);
}
/**
* mei_host_is_ready - check whether the host has turned ready
@@ -295,6 +286,7 @@
unsigned long rem, dw_cnt;
unsigned long length = header->length;
u32 *reg_buf = (u32 *)buf;
+ u32 hcsr;
int i;
int empty_slots;
@@ -319,9 +311,8 @@
mei_reg_write(dev, H_CB_WW, reg);
}
- dev->host_hw_state = mei_hcsr_read(dev);
- dev->host_hw_state |= H_IG;
- mei_hcsr_set(dev);
+ hcsr = mei_hcsr_read(dev) | H_IG;
+ mei_hcsr_set(dev, hcsr);
dev->me_hw_state = mei_mecsr_read(dev);
if (!mei_me_is_ready(dev))
return -EIO;
@@ -366,6 +357,7 @@
unsigned long buffer_length)
{
u32 *reg_buf = (u32 *)buffer;
+ u32 hcsr;
for (; buffer_length >= sizeof(u32); buffer_length -= sizeof(u32))
*reg_buf++ = mei_mecbrw_read(dev);
@@ -375,7 +367,7 @@
memcpy(reg_buf, ®, buffer_length);
}
- dev->host_hw_state |= H_IG;
- mei_hcsr_set(dev);
+ hcsr = mei_hcsr_read(dev) | H_IG;
+ mei_hcsr_set(dev, hcsr);
}
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index 7b43659..ae4c5ff 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -387,7 +387,6 @@
void mei_hw_reset(struct mei_device *dev, bool intr_enable);
u32 mei_hcsr_read(const struct mei_device *dev);
-void mei_hcsr_set(struct mei_device *dev);
u32 mei_mecsr_read(const struct mei_device *dev);
u32 mei_mecbrw_read(const struct mei_device *dev);