Skip to contentSkip to conversation

misc:ad525x_dpot: Fix missing blank after declaration coding style issue in ad525x_dpot.c

PATCH In review Mohammad Jamal 2 participants 3 messages Dec 16, 2014

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

PATCH 1/2 misc:ad525x_dpot: Fix missing blank after declaration coding style issue in ad525x_dpot.c

This is a patch to ad525x_dpot.c file that fixes up a missing blank line after declaration warning found by checkpatch.pl issue

---
 drivers/misc/ad525x_dpot.c |    1 +
 1 file changed, 1 insertion(+)
drivers/misc/ad525x_dpot.c +1 -0
index a43053d..32f9072 100644
@@ -176,6 +176,7 @@ static s32 dpot_read_i2c(struct dpot_data *dpot, u8 reg)
 {
 	int value;
 	unsigned ctrl = 0;
+
 	switch (dpot->uid) {
 	case DPOT_UID(AD5246_ID):
 	case DPOT_UID(AD5247_ID):
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 misc: ad52x_dpot: fix break is not useful after a goto or return coding style issue in ad525x_dpot.c

This is a patch to the ad525x_dpot.c that fixes up the break after return warning coding style issue found by the checkpatch.pl tool

---
 drivers/misc/ad525x_dpot.c |    6 ------
 1 file changed, 6 deletions(-)
drivers/misc/ad525x_dpot.c +0 -6
index 32f9072..15e8807 100644
@@ -334,7 +334,6 @@ static s32 dpot_write_i2c(struct dpot_data *dpot, u8 reg, u16 value)
 	case DPOT_UID(AD5246_ID):
 	case DPOT_UID(AD5247_ID):
 		return dpot_write_d8(dpot, value);
-		break;
 
 	case DPOT_UID(AD5245_ID):
 	case DPOT_UID(AD5241_ID):
@@ -346,7 +345,6 @@ static s32 dpot_write_i2c(struct dpot_data *dpot, u8 reg, u16 value)
 		ctrl = ((reg & DPOT_RDAC_MASK) == DPOT_RDAC0) ?
 			0 : DPOT_AD5282_RDAC_AB;
 		return dpot_write_r8d8(dpot, ctrl, value);
-		break;
 	case DPOT_UID(AD5171_ID):
 	case DPOT_UID(AD5273_ID):
 		if (reg & DPOT_ADDR_OTP) {
@@ -356,7 +354,6 @@ static s32 dpot_write_i2c(struct dpot_data *dpot, u8 reg, u16 value)
 			ctrl = DPOT_AD5273_FUSE;
 		}
 		return dpot_write_r8d8(dpot, ctrl, value);
-		break;
 	case DPOT_UID(AD5172_ID):
 	case DPOT_UID(AD5173_ID):
 		ctrl = ((reg & DPOT_RDAC_MASK) == DPOT_RDAC0) ?
@@ -368,7 +365,6 @@ static s32 dpot_write_i2c(struct dpot_data *dpot, u8 reg, u16 value)
 			ctrl |= DPOT_AD5170_2_3_FUSE;
 		}
 		return dpot_write_r8d8(dpot, ctrl, value);
-		break;
 	case DPOT_UID(AD5170_ID):
 		if (reg & DPOT_ADDR_OTP) {
 			tmp = dpot_read_r8d16(dpot, tmp);
@@ -377,7 +373,6 @@ static s32 dpot_write_i2c(struct dpot_data *dpot, u8 reg, u16 value)
 			ctrl = DPOT_AD5170_2_3_FUSE;
 		}
 		return dpot_write_r8d8(dpot, ctrl, value);
-		break;
 	case DPOT_UID(AD5272_ID):
 	case DPOT_UID(AD5274_ID):
 		dpot_write_r8d8(dpot, DPOT_AD5270_1_2_4_CTRLREG << 2,
@@ -392,7 +387,6 @@ static s32 dpot_write_i2c(struct dpot_data *dpot, u8 reg, u16 value)
 
 		return dpot_write_r8d8(dpot, (DPOT_AD5270_1_2_4_RDAC << 2) |
 				       (value >> 8), value & 0xFF);
-		break;
 	default:
 		if (reg & DPOT_ADDR_CMD)
 			return dpot_write_d8(dpot, reg);
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to Mohammad Jamal
Quoted 1 line · Mohammad Jamal

This is a patch to ad525x_dpot.c file that fixes up a missing blank line after declaration warning found by checkpatch.pl issue

Hello Mohammad.

Thanks for the patch.

Here are some small comments:

Please run your patches through scripts/checkpatch.pl before sending them.

This submission has an overly long commit message line. Please limit line lengths to ~70 characters.

The "This is a patch to <foo> that fixes up " is not useful. The "found by checkpatch.pl issue" is not particularly useful.

A simpler form might have used:

Subject: [PATCH] ad525x_dpot: Add a blank line after declaration

with a commit log of somthing like:

Use a more common kernel style.

Quoted 1 line

Add a space between your name and the open angle bracket in the email address too please.

Sometimes, it's good to do all the similar types of changes at the same time instead of multiple patches for trivial bits.

Using:

$ ./scripts/checkpatch.pl -f --strict --types=line_spacing,braces --fix-inplace drivers/misc/ad525x_dpot.c

produces this:

drivers/misc/ad525x_dpot.c +1 -2
index a43053d..ddfe38f 100644
@@ -176,6 +176,7 @@ static s32 dpot_read_i2c(struct dpot_data *dpot, u8 reg)
 {
 	int value;
 	unsigned ctrl = 0;
+
 	switch (dpot->uid) {
 	case DPOT_UID(AD5246_ID):
 	case DPOT_UID(AD5247_ID):
@@ -427,7 +428,6 @@ static ssize_t sysfs_show_reg(struct device *dev,
 			test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask) ?
 			"enabled" : "disabled");
 
-
 	mutex_lock(&data->update_lock);
 	value = dpot_read(data, reg);
 	mutex_unlock(&data->update_lock);
@@ -763,7 +763,6 @@ int ad_dpot_remove(struct device *dev)
 }
 EXPORT_SYMBOL(ad_dpot_remove);
 
-
 MODULE_AUTHOR("Chris Verges <[email protected]>, "
 	      "Michael Hennerich <[email protected]>");
 MODULE_DESCRIPTION("Digital potentiometer driver");

This could be submitted with some commit message like:

Subject: [PATCH] ad525x_dpot: Add & remove blank lines

Use a more common kernel style.

Signed-off-by <you>

cheers, Joe