Skip to contentSkip to conversation

staging: greybus: Remove unnecessary parentheses

PATCH Superseded Payal Kshirsagar 1 participant 2 messages Mar 28, 2019 – Mar 29, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: greybus: Remove unnecessary parentheses

Challenge suggested by coccinelle

This patch removes unnecessary parentheses while returning a value using an expression. Using following semantic patch:

@@
expression e;
@@

return
- (
e
- )
;

---

sdio.c +2 -2
diff -u -p a/sdio.c b/sdio.c
@@ -94,7 +94,7 @@ static void _gb_sdio_set_host_caps(struc
 
 static u32 _gb_sdio_get_host_ocr(u32 ocr)
 {
-	return (((ocr & GB_SDIO_VDD_165_195) ? MMC_VDD_165_195 : 0) |
+	return ((ocr & GB_SDIO_VDD_165_195) ? MMC_VDD_165_195 : 0) |
 		((ocr & GB_SDIO_VDD_20_21) ? MMC_VDD_20_21 : 0) |
 		((ocr & GB_SDIO_VDD_21_22) ? MMC_VDD_21_22 : 0) |
 		((ocr & GB_SDIO_VDD_22_23) ? MMC_VDD_22_23 : 0) |
@@ -111,7 +111,7 @@ static u32 _gb_sdio_get_host_ocr(u32 ocr
 		((ocr & GB_SDIO_VDD_33_34) ? MMC_VDD_33_34 : 0) |
 		((ocr & GB_SDIO_VDD_34_35) ? MMC_VDD_34_35 : 0) |
 		((ocr & GB_SDIO_VDD_35_36) ? MMC_VDD_35_36 : 0)
-		);
+		;
 }
 
 static int gb_sdio_get_caps(struct gb_sdio_host *host)
power_supply.c +2 -2
diff -u -p a/power_supply.c b/power_supply.c
@@ -337,7 +337,7 @@ static int is_psy_prop_writeable(struct
 
 static int is_prop_valint(enum power_supply_property psp)
 {
-	return ((psp < POWER_SUPPLY_PROP_MODEL_NAME) ? 1 : 0);
+	return (psp < POWER_SUPPLY_PROP_MODEL_NAME) ? 1 : 0;
 }
 
 static void next_interval(struct gb_power_supply *gbpsy)
@@ -424,7 +424,7 @@ static void check_changed(struct gb_powe
 static int total_props(struct gb_power_supply *gbpsy)
 {
 	/* this return the intval plus the strval properties */
-	return (gbpsy->properties_count + gbpsy->properties_count_str);
+	return gbpsy->properties_count + gbpsy->properties_count_str;
 }
 
 static void prop_append(struct gb_power_supply *gbpsy,
#1 lore raw
Quoted 61 lines · Payal Kshirsagar

Challenge suggested by coccinelle

This patch removes unnecessary parentheses while returning a value using an expression.
Using following semantic patch:

@@
expression e;
@@

return
- (
e
- )
;

---
diff -u -p a/sdio.c b/sdio.c

sdio.c +2 -2
@@ -94,7 +94,7 @@ static void _gb_sdio_set_host_caps(struc
 
 static u32 _gb_sdio_get_host_ocr(u32 ocr)
 {
-       return (((ocr & GB_SDIO_VDD_165_195) ? MMC_VDD_165_195 : 0) |
+       return ((ocr & GB_SDIO_VDD_165_195) ? MMC_VDD_165_195 : 0) |
                ((ocr & GB_SDIO_VDD_20_21) ? MMC_VDD_20_21 : 0) |
                ((ocr & GB_SDIO_VDD_21_22) ? MMC_VDD_21_22 : 0) |
                ((ocr & GB_SDIO_VDD_22_23) ? MMC_VDD_22_23 : 0) |
@@ -111,7 +111,7 @@ static u32 _gb_sdio_get_host_ocr(u32 ocr
                ((ocr & GB_SDIO_VDD_33_34) ? MMC_VDD_33_34 : 0) |
                ((ocr & GB_SDIO_VDD_34_35) ? MMC_VDD_34_35 : 0) |
                ((ocr & GB_SDIO_VDD_35_36) ? MMC_VDD_35_36 : 0)
-               );
+               ;
 }
 
 static int gb_sdio_get_caps(struct gb_sdio_host *host)

diff -u -p a/power_supply.c b/power_supply.c

power_supply.c +2 -2
@@ -337,7 +337,7 @@ static int is_psy_prop_writeable(struct
 
 static int is_prop_valint(enum power_supply_property psp)
 {
-       return ((psp < POWER_SUPPLY_PROP_MODEL_NAME) ? 1 : 0);
+       return (psp < POWER_SUPPLY_PROP_MODEL_NAME) ? 1 : 0;
 }
 
 static void next_interval(struct gb_power_supply *gbpsy)
@@ -424,7 +424,7 @@ static void check_changed(struct gb_powe
 static int total_props(struct gb_power_supply *gbpsy)
 {
        /* this return the intval plus the strval properties */
-       return (gbpsy->properties_count + gbpsy->properties_count_str);
+       return gbpsy->properties_count + gbpsy->properties_count_str;
 }
 
 static void prop_append(struct gb_power_supply *gbpsy,