Skip to contentSkip to conversation

staging:mt7621-mmc: Prefer using BIT macro

PATCH In review Bhanusree Pola 5 participants 5 messages Feb 19, 2019 – Feb 20, 2019

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

PATCH 1/1 staging:mt7621-mmc: Prefer using BIT macro

Use BIT(x) instead of (1<<x), reported by checkpatch.pl.

---
 drivers/staging/mt7621-mmc/mt6575_sd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/mt7621-mmc/mt6575_sd.h +1 -1
index 4e287c140acb..038a484a9476 100644
@@ -363,7 +363,7 @@ enum {
 #define MSDC_CKGEN_MSDC_DLY_SEL   (0x1F << 10)
 #define MSDC_INT_DAT_LATCH_CK_SEL  (0x7 << 7)
 #define MSDC_CKGEN_MSDC_CK_SEL     (0x1 << 6)
-#define CARD_READY_FOR_DATA             (1 << 8)
+#define CARD_READY_FOR_DATA		BIT(8)
 #define CARD_CURRENT_STATE(x)           ((x & 0x00001E00) >> 9)
 
 /*--------------------------------------------------------------------------*/
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 12 lines · Bhanusree Pola

Use BIT(x) instead of (1<<x), reported by checkpatch.pl.

---
 drivers/staging/mt7621-mmc/mt6575_sd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/mt7621-mmc/mt6575_sd.h +0 -0
index 4e287c140acb..038a484a9476 100644

drivers/staging/mt7621-mmc/mt6575_sd.h enum { · line 366

Quoted 5 lines
drivers/staging/mt7621-mmc/mt6575_sd.h +1 -1
@@ -363,7 +363,7 @@ enum {
 #define MSDC_CKGEN_MSDC_DLY_SEL   (0x1F << 10)
 #define MSDC_INT_DAT_LATCH_CK_SEL  (0x7 << 7)
 #define MSDC_CKGEN_MSDC_CK_SEL     (0x1 << 6)
-#define CARD_READY_FOR_DATA             (1 << 8)
+#define CARD_READY_FOR_DATA		BIT(8)

To be honest, I'm not sure if this is the right thing to do here, given that all other defines use the shift operator.

Apart from that git grep tells me that CARD_READY_FOR_DATA is not used in the driver. Maybe that would be a better first patch: check if the defines are used in the driver and delete all these that are not used :)

Regards,
Matthias

Quoted 4 lines
drivers/staging/mt7621-mmc/mt6575_sd.h +0 -0
 #define CARD_CURRENT_STATE(x)           ((x & 0x00001E00) >> 9)
 
 /*--------------------------------------------------------------------------*/
#2 lore raw
Quoted 24 lines · Matthias Brugger
Quoted 12 lines · Bhanusree Pola

Use BIT(x) instead of (1<<x), reported by checkpatch.pl.

---
 drivers/staging/mt7621-mmc/mt6575_sd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/mt7621-mmc/mt6575_sd.h +0 -0
index 4e287c140acb..038a484a9476 100644

drivers/staging/mt7621-mmc/mt6575_sd.h enum { · line 366

Quoted 5 lines
drivers/staging/mt7621-mmc/mt6575_sd.h +1 -1
@@ -363,7 +363,7 @@ enum {
 #define MSDC_CKGEN_MSDC_DLY_SEL   (0x1F << 10)
 #define MSDC_INT_DAT_LATCH_CK_SEL  (0x7 << 7)
 #define MSDC_CKGEN_MSDC_CK_SEL     (0x1 << 6)
-#define CARD_READY_FOR_DATA             (1 << 8)
+#define CARD_READY_FOR_DATA		BIT(8)

To be honest, I'm not sure if this is the right thing to do here, given that all other defines use the shift operator.

Quoted 3 lines

Apart from that git grep tells me that CARD_READY_FOR_DATA is not used in the driver. Maybe that would be a better first patch: check if the defines are used in the driver and delete all these that are not used :)

I think that Greg has expressed the desire to keep them in the past, but perhaps that was only for names that fit into a series, eg 1 << 0, 1 << 1, 1 << 2, etc. This one seems different from the ones defined nearby it at least.

julia

Quoted 16 lines

Regards,
Matthias

drivers/staging/mt7621-mmc/mt6575_sd.h enum { · line 369

Quoted 4 lines
drivers/staging/mt7621-mmc/mt6575_sd.h +0 -0
 #define CARD_CURRENT_STATE(x)           ((x & 0x00001E00) >> 9)
 
 /*--------------------------------------------------------------------------*/

--
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/3d66e3f3-74d3-2da7-57cb-8b04427ae680%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
In reply to Bhanusree Pola
Quoted 12 lines · Bhanusree Pola

Use BIT(x) instead of (1<<x), reported by checkpatch.pl.

---
 drivers/staging/mt7621-mmc/mt6575_sd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/mt7621-mmc/mt6575_sd.h +0 -0
index 4e287c140acb..038a484a9476 100644

drivers/staging/mt7621-mmc/mt6575_sd.h enum { · line 365

Quoted 3 lines
drivers/staging/mt7621-mmc/mt6575_sd.h +0 -0
@@ -363,7 +363,7 @@ enum {
 #define MSDC_CKGEN_MSDC_DLY_SEL   (0x1F << 10)
 #define MSDC_INT_DAT_LATCH_CK_SEL  (0x7 << 7)
 #define MSDC_CKGEN_MSDC_CK_SEL     (0x1 << 6)

This could also be changed as well ? Likewise others present(if any) in the header file.

FYI, a simple cocci script could also be written to complete this task.

Now that I see this patch has been already been applied, so its fine for now and an explicit "Patch applied." from Greg would have been better IMHO.

Times up for Ack-by and discussions Matthias.

Quoted 3 lines
drivers/staging/mt7621-mmc/mt6575_sd.h +1 -1
-#define CARD_READY_FOR_DATA             (1 << 8)
+#define CARD_READY_FOR_DATA		BIT(8)
 #define CARD_CURRENT_STATE(x)           ((x & 0x00001E00) >> 9)
Signature · 4 lines
Himanshu Jha
Undergraduate Student
Department of Electronics & Communication
Guru Tegh Bahadur Institute of Technology
#4 lore raw
Quoted 4 lines · Himanshu Jha

Now that I see this patch has been already been applied, so its fine for now and an explicit "Patch applied." from Greg would have been better IMHO.

Patch authors get that type of email from my scripts, I do not send them to the mailing lists as it would just be too noisy.

thanks,

greg k-h