[PATCH 08/16] staging: ks7010: rewrite hif_align_size inline function

Sergio Paracuellos sergio.paracuellos at gmail.com
Fri Apr 6 10:38:15 UTC 2018


This commit rewrites hif_align_size inline function to
improve readability. It also change parameters and return
type from int to size_t which is the correct and the one
which is being used when this function is called from
several points of the code.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos at gmail.com>
---
 drivers/staging/ks7010/ks_hostif.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h
index edbae62..0ebed53 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -650,11 +650,13 @@ int ks_wlan_hw_power_save(struct ks_wlan_private *priv);
 
 #define KS7010_SIZE_ALIGNMENT	32
 
-static
-inline int hif_align_size(int size)
+static inline size_t hif_align_size(size_t size)
 {
-	return (size % KS7010_SIZE_ALIGNMENT) ? size + KS7010_SIZE_ALIGNMENT -
-	    (size % KS7010_SIZE_ALIGNMENT) : size;
+	if (size % KS7010_SIZE_ALIGNMENT)
+		return size + KS7010_SIZE_ALIGNMENT -
+			(size % KS7010_SIZE_ALIGNMENT);
+
+	return size;
 }
 
 #endif /* __KERNEL__ */
-- 
2.7.4



More information about the devel mailing list