Skip to contentSkip to conversation

staging: most: hdm-usb: Use macro DIV_ROUND_UP

PATCH Superseded Bhaktipriya Shridhar 2 participants 6 messages Feb 21, 2016 – Feb 22, 2016

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 staging: most: hdm-usb: Use macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)). It clarifies the divisor calculations. This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

---
 drivers/staging/most/hdm-usb/hdm_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/most/hdm-usb/hdm_usb.c +1 -1
index 3ee9e6f..29ffe51 100644
@@ -40,7 +40,7 @@
 #define MAX_SUFFIX_LEN		10
 #define MAX_STRING_LEN		80
 #define MAX_BUF_SIZE		0xFFFF
-#define CEILING(x, y)		(((x) + (y) - 1) / (y))
+#define CEILING(x, y)		(DIV_ROUND_UP(x, (y)))
 
 #define USB_VENDOR_ID_SMSC	0x0424  /* VID: SMSC */
 #define USB_DEV_ID_BRDG		0xC001  /* PID: USB Bridge */

--
2.1.4

#1 lore raw
Quoted 25 lines · Bhaktipriya Shridhar

The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)). It clarifies the divisor calculations. This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

---
 drivers/staging/most/hdm-usb/hdm_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/most/hdm-usb/hdm_usb.c +0 -0
index 3ee9e6f..29ffe51 100644

drivers/staging/most/hdm-usb/hdm_usb.c line 43

Quoted 5 lines
drivers/staging/most/hdm-usb/hdm_usb.c +1 -1
@@ -40,7 +40,7 @@
 #define MAX_SUFFIX_LEN		10
 #define MAX_STRING_LEN		80
 #define MAX_BUF_SIZE		0xFFFF
-#define CEILING(x, y)		(((x) + (y) - 1) / (y))
+#define CEILING(x, y)		(DIV_ROUND_UP(x, (y)))

Maybe it would be better to just drop CEILING completely? You could lok at where it is used, and see if there would be any conceptul loss in just calling DIV_ROUND_UP.

julia

Quoted 13 lines
drivers/staging/most/hdm-usb/hdm_usb.c +0 -1
 #define USB_VENDOR_ID_SMSC	0x0424  /* VID: SMSC */
 #define USB_DEV_ID_BRDG		0xC001  /* PID: USB Bridge */
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160221183624.GA3428%40Karyakshetra.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw

Hello Julia,

Like you suggested, I have dropped the macro CEILING altogether and have replaced
it with DIV_ROUND_UP.

Should I resend the patchset or should I just send a v2 for this patch?

Thanks,
Bhaktipriya

Quoted 54 lines · Julia Lawall
Quoted 25 lines · Bhaktipriya Shridhar

The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)). It clarifies the divisor calculations. This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

---
 drivers/staging/most/hdm-usb/hdm_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/most/hdm-usb/hdm_usb.c +0 -0
index 3ee9e6f..29ffe51 100644

drivers/staging/most/hdm-usb/hdm_usb.c line 43

Quoted 5 lines
drivers/staging/most/hdm-usb/hdm_usb.c +1 -1
@@ -40,7 +40,7 @@
 #define MAX_SUFFIX_LEN               10
 #define MAX_STRING_LEN               80
 #define MAX_BUF_SIZE         0xFFFF
-#define CEILING(x, y)                (((x) + (y) - 1) / (y))
+#define CEILING(x, y)                (DIV_ROUND_UP(x, (y)))

Maybe it would be better to just drop CEILING completely? You could lok at where it is used, and see if there would be any conceptul loss in just calling DIV_ROUND_UP.

julia

Quoted 13 lines
drivers/staging/most/hdm-usb/hdm_usb.c +0 -1
 #define USB_VENDOR_ID_SMSC   0x0424  /* VID: SMSC */
 #define USB_DEV_ID_BRDG              0xC001  /* PID: USB Bridge */
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160221183624.GA3428%40Karyakshetra.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
Quoted 7 lines · Bhaktipriya Shridhar

Hello Julia,

Like you suggested, I have dropped the macro CEILING altogether and have replaced
it with DIV_ROUND_UP.

Should I resend the patchset or should I just send a v2 for this patch?

Normally, if you send a patchset and then you change any patch in it, you have to resend the whole thing. If your previous patch set was a bunch of different files for DIV_ROUND_UP and you are now going to add a bunch of different files for CEILING -> DIV_ROUND_UP, perhaps it would make more sense to make a v3 for the original patch set just dropping this change, and then ake a new patch set for the CEILING change. But if the CEILING change is only in one file, maybe a v3 with teh current set of changes is OK.

julia

Quoted 60 lines

Thanks,
Bhaktipriya

Quoted 54 lines · Julia Lawall
Quoted 25 lines · Bhaktipriya Shridhar

The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)). It clarifies the divisor calculations. This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

---
 drivers/staging/most/hdm-usb/hdm_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/most/hdm-usb/hdm_usb.c +0 -0
index 3ee9e6f..29ffe51 100644

drivers/staging/most/hdm-usb/hdm_usb.c line 43

Quoted 5 lines
drivers/staging/most/hdm-usb/hdm_usb.c +1 -1
@@ -40,7 +40,7 @@
 #define MAX_SUFFIX_LEN               10
 #define MAX_STRING_LEN               80
 #define MAX_BUF_SIZE         0xFFFF
-#define CEILING(x, y)                (((x) + (y) - 1) / (y))
+#define CEILING(x, y)                (DIV_ROUND_UP(x, (y)))

Maybe it would be better to just drop CEILING completely? You could lok at where it is used, and see if there would be any conceptul loss in just calling DIV_ROUND_UP.

julia

Quoted 13 lines
drivers/staging/most/hdm-usb/hdm_usb.c +0 -1
 #define USB_VENDOR_ID_SMSC   0x0424  /* VID: SMSC */
 #define USB_DEV_ID_BRDG              0xC001  /* PID: USB Bridge */
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160221183624.GA3428%40Karyakshetra.
For more options, visit https://groups.google.com/d/optout.

#4 lore raw

Hello Julia,

Quoted 11 lines · Julia Lawall
Quoted 7 lines · Bhaktipriya Shridhar

Hello Julia,

Like you suggested, I have dropped the macro CEILING altogether and have replaced
it with DIV_ROUND_UP.

Should I resend the patchset or should I just send a v2 for this patch?

Quoted 8 lines

Normally, if you send a patchset and then you change any patch in it, you have to resend the whole thing. If your previous patch set was a bunch of different files for DIV_ROUND_UP and you are now going to add a bunch of different files for CEILING -> DIV_ROUND_UP, perhaps it would make more sense to make a v3 for the original patch set just dropping this change, and then ake a new patch set for the CEILING change. But if the CEILING change is only in one file, maybe a v3 with teh current set of changes is OK.

Yes, the CEILING change is in a single file. Patches 1,2,4 are unchanged. Hence, I'm sending just a v2 for patch 3/4.
Is the following subject fine for v2, patch 3/4

[PATCH v2 3/4] staging: most: hdm-usb: Use macro DIV_ROUND_UP

Thanks,
Bhaktipriya

#5 lore raw
Quoted 24 lines · Bhaktipriya Shridhar

Hello Julia,

Quoted 11 lines · Julia Lawall
Quoted 7 lines · Bhaktipriya Shridhar

Hello Julia,

Like you suggested, I have dropped the macro CEILING altogether and have replaced
it with DIV_ROUND_UP.

Should I resend the patchset or should I just send a v2 for this patch?

Quoted 8 lines

Normally, if you send a patchset and then you change any patch in it, you have to resend the whole thing. If your previous patch set was a bunch of different files for DIV_ROUND_UP and you are now going to add a bunch of different files for CEILING -> DIV_ROUND_UP, perhaps it would make more sense to make a v3 for the original patch set just dropping this change, and then ake a new patch set for the CEILING change. But if the CEILING change is only in one file, maybe a v3 with teh current set of changes is OK.

Quoted 5 lines

Yes, the CEILING change is in a single file. Patches 1,2,4 are unchanged. Hence, I'm sending just a v2 for patch 3/4.
Is the following subject fine for v2, patch 3/4

[PATCH v2 3/4] staging: most: hdm-usb: Use macro DIV_ROUND_UP

No, you have to resend the whole patch set, even the unchanged parts.

julia

Quoted 11 lines

Thanks,
Bhaktipriya

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAFNHFT897nR%2Bk6oasfO8b9-B36vNmvGEiUvC9DO9GMtBAvfS7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.