summaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/interface.h
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2012-07-04 19:24:52 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-10 14:58:35 -0700
commit7bdf72d3d8059a50214069ea4b87c2174645f40f (patch)
treeb54edc0497ab402791422a50905e59fc49f71f51 /drivers/misc/mei/interface.h
parent7cb1ba9b679afe5fc335205fd6fb25fd3e51e33a (diff)
mei: introduce mei_data2slots wrapper
Introduce mei_data2slots wrapper for sake of readability. This wrapper close up the open code for computing slots from a message length: rond up dwords count from payload and header byte size Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/interface.h')
-rw-r--r--drivers/misc/mei/interface.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/misc/mei/interface.h b/drivers/misc/mei/interface.h
index cd9b778e8dc..fb5c7db4723 100644
--- a/drivers/misc/mei/interface.h
+++ b/drivers/misc/mei/interface.h
@@ -50,6 +50,12 @@ static inline size_t mei_hbuf_max_data(const struct mei_device *dev)
return dev->hbuf_depth * sizeof(u32) - sizeof(struct mei_msg_hdr);
}
+/* get slots (dwords) from a message length + header (bytes) */
+static inline unsigned char mei_data2slots(size_t length)
+{
+ return DIV_ROUND_UP(sizeof(struct mei_msg_hdr) + length, 4);
+}
+
int mei_count_full_read_slots(struct mei_device *dev);