aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/mei_dev.h
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2013-03-11 12:27:02 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-15 14:10:48 -0400
commitc8c8d080ed94cea6757f2d781b6e360a74b256fd (patch)
tree5fa9937912d66e7d6633c3109fdce1b344c8728f /drivers/misc/mei/mei_dev.h
parent388f7bd24d2ffc945ad08be3a592672c1e32156e (diff)
mei: revamp mei_data2slots
1. Move the mei_data2slots to mei_dev.h as it will be used by the all supported HW. 2. Change return value from u8 to u32 to catch possible overflows 3. Eliminate computing the slots number twice in the same function Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/mei_dev.h')
-rw-r--r--drivers/misc/mei/mei_dev.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index cb80166161f0..09a2af4294a6 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -374,6 +374,17 @@ static inline unsigned long mei_secs_to_jiffies(unsigned long sec)
374 return msecs_to_jiffies(sec * MSEC_PER_SEC); 374 return msecs_to_jiffies(sec * MSEC_PER_SEC);
375} 375}
376 376
377/**
378 * mei_data2slots - get slots - number of (dwords) from a message length
379 * + size of the mei header
380 * @length - size of the messages in bytes
381 * returns - number of slots
382 */
383static inline u32 mei_data2slots(size_t length)
384{
385 return DIV_ROUND_UP(sizeof(struct mei_msg_hdr) + length, 4);
386}
387
377 388
378/* 389/*
379 * mei init function prototypes 390 * mei init function prototypes