[PATCH v1 1/1] cp210x: convert open coded pieces to DIV_ROUND_UP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are places where DIV_ROUND_UP() functionaly is open coded. Replace it by
macro call.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
 drivers/usb/serial/cp210x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 9b90ad7..a45596de 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -338,7 +338,7 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
 	int result, i, length;
 
 	/* Number of integers required to contain the array */
-	length = (((size - 1) | 3) + 1) / 4;
+	length = DIV_ROUND_UP(size, 4);
 
 	buf = kcalloc(length, sizeof(__le32), GFP_KERNEL);
 	if (!buf)
@@ -383,7 +383,7 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
 	int result, i, length;
 
 	/* Number of integers required to contain the array */
-	length = (((size - 1) | 3) + 1) / 4;
+	length = DIV_ROUND_UP(size, 4);
 
 	buf = kmalloc(length * sizeof(__le32), GFP_KERNEL);
 	if (!buf)
-- 
2.7.0.rc3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux