summaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/hw-me.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2018-07-23 12:21:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-24 14:16:57 +0200
commit9fc5f0f8ad28405145b30fd3b905e368063ee14c (patch)
tree27822d572c0e2844039967fe38046a606d49df06 /drivers/misc/mei/hw-me.c
parentMerge tag 'fsi-updates-2018-07-24' of git://git.kernel.org/pub/scm/linux/kern... (diff)
downloadlinux-9fc5f0f8ad28405145b30fd3b905e368063ee14c.tar.xz
linux-9fc5f0f8ad28405145b30fd3b905e368063ee14c.zip
mei: cleanup slots to data conversions
Cleanup conversions between slots and data. Define MEI_SLOT_SIZE instead of using 4 or sizeof(u32) across the source code. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/hw-me.c')
-rw-r--r--drivers/misc/mei/hw-me.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index 5bbea13ab171..016b7c956f18 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -511,7 +511,7 @@ static int mei_me_hbuf_empty_slots(struct mei_device *dev)
*/
static size_t mei_me_hbuf_max_len(const struct mei_device *dev)
{
- return dev->hbuf_depth * sizeof(u32) - sizeof(struct mei_msg_hdr);
+ return mei_slots2data(dev->hbuf_depth) - sizeof(struct mei_msg_hdr);
}
@@ -549,7 +549,7 @@ static int mei_me_hbuf_write(struct mei_device *dev,
mei_me_hcbww_write(dev, *((u32 *) header));
- for (i = 0; i < length / 4; i++)
+ for (i = 0; i < length / MEI_SLOT_SIZE; i++)
mei_me_hcbww_write(dev, reg_buf[i]);
rem = length & 0x3;
@@ -604,11 +604,11 @@ static int mei_me_count_full_read_slots(struct mei_device *dev)
* Return: always 0
*/
static int mei_me_read_slots(struct mei_device *dev, unsigned char *buffer,
- unsigned long buffer_length)
+ unsigned long buffer_length)
{
u32 *reg_buf = (u32 *)buffer;
- for (; buffer_length >= sizeof(u32); buffer_length -= sizeof(u32))
+ for (; buffer_length >= MEI_SLOT_SIZE; buffer_length -= MEI_SLOT_SIZE)
*reg_buf++ = mei_me_mecbrw_read(dev);
if (buffer_length > 0) {