Skip to contentSkip to conversation

auxdisplay: remove unnecessary braces

PATCH In review [email protected] 2 participants 2 messages Sep 23, 2018 – Oct 6, 2018

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

PATCH v2 1/1 auxdisplay: remove unnecessary braces

From: Ben Moore <[email protected]>

I have removed some unnecessary braces from if statements. As well as inspecting the other driverfiles for similar style issues.

---
 drivers/auxdisplay/ht16k33.c | 4 ++--
 drivers/auxdisplay/panel.c   | 5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/auxdisplay/ht16k33.c +2 -2
index a43276c76fc6..854bb2b90368 100644
@@ -479,9 +479,9 @@ static int ht16k33_probe(struct i2c_client *client,
 
 	err = of_property_read_u32(node, "default-brightness-level",
 				   &dft_brightness);
-	if (err) {
+	if (err)
 		dft_brightness = MAX_BRIGHTNESS;
-	} else if (dft_brightness > MAX_BRIGHTNESS) {
+	else if (dft_brightness > MAX_BRIGHTNESS) {
 		dev_warn(&client->dev,
 			 "invalid default brightness level: %u, using %u\n",
 			 dft_brightness, MAX_BRIGHTNESS);
drivers/auxdisplay/panel.c +2 -3
index 3b25a643058c..f769431fbb52 100644
@@ -695,11 +695,10 @@ static void lcd_send_serial(int byte)
 	for (bit = 0; bit < 8; bit++) {
 		clear_bit(LCD_BIT_CL, bits);	/* CLK low */
 		panel_set_bits();
-		if (byte & 1) {
+		if (byte & 1)
 			set_bit(LCD_BIT_DA, bits);
-		} else {
+		else
 			clear_bit(LCD_BIT_DA, bits);
-		}
 
 		panel_set_bits();
 		udelay(2);  /* maintain the data during 2 us before CLK up */

--
2.11.0

#1 lore raw

Hi Ben,

Quoted 3 lines · On Sun, Sep 23, 2018 at 7:26 PM <[email protected]> wrote:

I have removed some unnecessary braces from if statements. As well as inspecting the other driverfiles for similar style issues.

Thanks for the new version!

drivers/auxdisplay/ht16k33.c static int ht16k33_probe(struct i2c_client *client, · line 484

Quoted 5 lines
drivers/auxdisplay/ht16k33.c +2 -2
-       if (err) {
+       if (err)
                dft_brightness = MAX_BRIGHTNESS;
-       } else if (dft_brightness > MAX_BRIGHTNESS) {
+       else if (dft_brightness > MAX_BRIGHTNESS) {

This one breaks the braces-if-the-other-branch-has-them that Geert told you about:

https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces

drivers/auxdisplay/panel.c static void lcd_send_serial(int byte) · line 702

Quoted 7 lines
drivers/auxdisplay/panel.c +2 -3
-               if (byte & 1) {
+               if (byte & 1)
                        set_bit(LCD_BIT_DA, bits);
-               } else {
+               else
                        clear_bit(LCD_BIT_DA, bits);
-               }

This one seems fine.

Cheers,
Miguel