Re: [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]

 





On 19/01/16 11:31, Andy Shevchenko wrote:
There are places where DIV_ROUND_UP() functionaly is open coded. Replace it by
macro call.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

Much nicer!

Acked-by: Martyn Welch <martyn.welch@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)

--
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