Skip to contentSkip to conversation

staging: sm750fb: replace macro with builtin fn

PATCH In review Elizabeth Ferdman 2 participants 4 messages Oct 2, 2016 – Oct 9, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: sm750fb: replace macro with builtin fn

Drop a local macro definition and replace its uses with a standard macro function from linux/kernel.h: DIV_ROUND_CLOSEST, to avoid reproducing code.

---
Changes in v2:
- Use "with" not w in the subject line
- Specify the name of the builtin macro in the description
- Explain why this change is necessary

 drivers/staging/sm750fb/ddk750_chip.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/sm750fb/ddk750_chip.c +2 -4
index 3a0afe1..839d673 100644
@@ -6,8 +6,6 @@
 #include "ddk750_chip.h"
 #include "ddk750_power.h"
 
-/* n / d + 1 / 2 = (2n + d) / 2d */
-#define roundedDiv(num, denom)	((2 * (num) + (denom)) / (2 * (denom)))
 #define MHz(x) ((x) * 1000000)
 
 logical_chip_type_t sm750_get_chip_type(void)
@@ -102,7 +100,7 @@ static void setMemoryClock(unsigned int frequency)
 			frequency = MHz(336);
 
 		/* Calculate the divisor */
-		divisor = roundedDiv(get_mxclk_freq(), frequency);
+		divisor = DIV_ROUND_CLOSEST(get_mxclk_freq(), frequency);
 
 		/* Set the corresponding divisor in the register. */
 		reg = PEEK32(CURRENT_GATE) & ~CURRENT_GATE_M2XCLK_MASK;
@@ -152,7 +150,7 @@ static void setMasterClock(unsigned int frequency)
 			frequency = MHz(190);
 
 		/* Calculate the divisor */
-		divisor = roundedDiv(get_mxclk_freq(), frequency);
+		divisor = DIV_ROUND_CLOSEST(get_mxclk_freq(), frequency);
 
 		/* Set the corresponding divisor in the register. */
 		reg = PEEK32(CURRENT_GATE) & ~CURRENT_GATE_MCLK_MASK;
Signature · 1 line
2.1.4
maintainer
#1 lore raw
Quoted 10 lines · Elizabeth Ferdman

Drop a local macro definition and replace its uses with a standard macro function from linux/kernel.h: DIV_ROUND_CLOSEST, to avoid reproducing code.

---
Changes in v2:
- Use "with" not w in the subject line
- Specify the name of the builtin macro in the description
- Explain why this change is necessary

Someone else already sent this patch in and got it accepted before you did, sorry.

greg k-h

#2 lore raw
Quoted 12 lines · Greg KH
Quoted 10 lines · Elizabeth Ferdman

Drop a local macro definition and replace its uses with a standard macro function from linux/kernel.h: DIV_ROUND_CLOSEST, to avoid reproducing code.

---
Changes in v2:
- Use "with" not w in the subject line
- Specify the name of the builtin macro in the description
- Explain why this change is necessary

Quoted 2 lines

Someone else already sent this patch in and got it accepted before you did, sorry.

Is there any easy way to monitor what's currently being sent? I found lkml.org and mail-archive.com/[email protected]. The latter is a nicer one to look at. Just wondering what you use.

thanks,
liz

Quoted 2 lines

greg k-h

maintainer
#3 lore raw
Quoted 13 lines · Elizabeth Ferdman
Quoted 12 lines · Greg KH
Quoted 10 lines · Elizabeth Ferdman

Drop a local macro definition and replace its uses with a standard macro function from linux/kernel.h: DIV_ROUND_CLOSEST, to avoid reproducing code.

---
Changes in v2:
- Use "with" not w in the subject line
- Specify the name of the builtin macro in the description
- Explain why this change is necessary

Quoted 6 lines
Quoted 2 lines

Someone else already sent this patch in and got it accepted before you did, sorry.

Is there any easy way to monitor what's currently being sent? I found lkml.org and mail-archive.com/[email protected]. The latter is a nicer one to look at. Just wondering what you use.

lkml is not something you really need to read, it's a firehose :)

staging patches come in on the driverdevel mailing list, the address for it is in the MAINTAINERS file. You can subscribe to it, that is the easiest thing to do, to see what is also being sent at the same time.

thanks,

greg k-h