linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] bq2415x_charger: Fix coding style issues and add new charger in the list of supported chargers
@ 2015-03-05 11:23 Anda-Maria Nicolae
  2015-03-05 11:23 ` [PATCH 1/2] bq2415x_charger: Remove unnecessary else after return Anda-Maria Nicolae
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Anda-Maria Nicolae @ 2015-03-05 11:23 UTC (permalink / raw)
  To: anda-maria.nicolae, sre, dbaryshkov, dwmw2, linux-pm,
	linux-kernel

Hello,

First patch from patchset fixes coding style issues: removes unnecessary else after return.
This way, the coding style complies with checkpatch.pl.

Second patch from patchset updates bq2415x driver to support bq24157s charger.

Thanks,
Anda

Anda-Maria Nicolae (2):
  bq2415x_charger: Remove unnecessary else after return
  bq2415x_charger: Add support for bq24157s

 drivers/power/bq2415x_charger.c |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] bq2415x_charger: Remove unnecessary else after return
  2015-03-05 11:23 [PATCH 0/2] bq2415x_charger: Fix coding style issues and add new charger in the list of supported chargers Anda-Maria Nicolae
@ 2015-03-05 11:23 ` Anda-Maria Nicolae
  2015-03-05 16:13   ` Joe Perches
  2015-03-05 11:23 ` [PATCH 2/2] bq2415x_charger: Add support for bq24157s Anda-Maria Nicolae
  2015-03-07 18:38 ` [PATCH 0/2] bq2415x_charger: Fix coding style issues and add new charger in the list of supported chargers Sebastian Reichel
  2 siblings, 1 reply; 6+ messages in thread
From: Anda-Maria Nicolae @ 2015-03-05 11:23 UTC (permalink / raw)
  To: anda-maria.nicolae, sre, dbaryshkov, dwmw2, linux-pm,
	linux-kernel

Fix coding style to comply with checkpatch.pl

Signed-off-by: Anda-Maria Nicolae <anda-maria.nicolae@intel.com>
---
 drivers/power/bq2415x_charger.c |   24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
index e384844..628a2ed 100644
--- a/drivers/power/bq2415x_charger.c
+++ b/drivers/power/bq2415x_charger.c
@@ -352,8 +352,7 @@ static int bq2415x_exec_command(struct bq2415x_device *bq,
 			BQ2415X_BIT_CE);
 		if (ret < 0)
 			return ret;
-		else
-			return ret > 0 ? 0 : 1;
+		return ret > 0 ? 0 : 1;
 	case BQ2415X_CHARGER_ENABLE:
 		return bq2415x_i2c_write_bit(bq, BQ2415X_REG_CONTROL,
 				0, BQ2415X_BIT_CE);
@@ -426,20 +425,17 @@ static enum bq2415x_chip bq2415x_detect_chip(struct bq2415x_device *bq)
 		case 0:
 			if (bq->chip == BQ24151A)
 				return bq->chip;
-			else
-				return BQ24151;
+			return BQ24151;
 		case 1:
 			if (bq->chip == BQ24150A ||
 				bq->chip == BQ24152 ||
 				bq->chip == BQ24155)
 				return bq->chip;
-			else
-				return BQ24150;
+			return BQ24150;
 		case 2:
 			if (bq->chip == BQ24153A)
 				return bq->chip;
-			else
-				return BQ24153;
+			return BQ24153;
 		default:
 			return BQUNKNOWN;
 		}
@@ -450,8 +446,7 @@ static enum bq2415x_chip bq2415x_detect_chip(struct bq2415x_device *bq)
 		case 0:
 			if (bq->chip == BQ24156A)
 				return bq->chip;
-			else
-				return BQ24156;
+			return BQ24156;
 		case 2:
 			return BQ24158;
 		default:
@@ -480,8 +475,7 @@ static int bq2415x_detect_revision(struct bq2415x_device *bq)
 	case BQ24152:
 		if (ret >= 0 && ret <= 3)
 			return ret;
-		else
-			return -1;
+		return -1;
 	case BQ24153:
 	case BQ24153A:
 	case BQ24156:
@@ -491,13 +485,11 @@ static int bq2415x_detect_revision(struct bq2415x_device *bq)
 			return 0;
 		else if (ret == 1)
 			return 1;
-		else
-			return -1;
+		return -1;
 	case BQ24155:
 		if (ret == 3)
 			return 3;
-		else
-			return -1;
+		return -1;
 	case BQUNKNOWN:
 		return -1;
 	}
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] bq2415x_charger: Add support for bq24157s
  2015-03-05 11:23 [PATCH 0/2] bq2415x_charger: Fix coding style issues and add new charger in the list of supported chargers Anda-Maria Nicolae
  2015-03-05 11:23 ` [PATCH 1/2] bq2415x_charger: Remove unnecessary else after return Anda-Maria Nicolae
@ 2015-03-05 11:23 ` Anda-Maria Nicolae
  2015-03-07 18:38 ` [PATCH 0/2] bq2415x_charger: Fix coding style issues and add new charger in the list of supported chargers Sebastian Reichel
  2 siblings, 0 replies; 6+ messages in thread
From: Anda-Maria Nicolae @ 2015-03-05 11:23 UTC (permalink / raw)
  To: anda-maria.nicolae, sre, dbaryshkov, dwmw2, linux-pm,
	linux-kernel

This patch adds bq24157s charger in the list of supported chargers.
bq24157s is similar to bq24158, except for Bit6 from Special Charger
Voltage/Enable Pin Status register, but this register is currently
not used by bq2415x_charger.

Signed-off-by: Anda-Maria Nicolae <anda-maria.nicolae@intel.com>
---
 drivers/power/bq2415x_charger.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
index 628a2ed..41f6c4c 100644
--- a/drivers/power/bq2415x_charger.c
+++ b/drivers/power/bq2415x_charger.c
@@ -26,6 +26,8 @@
  * http://www.ti.com/product/bq24153
  * http://www.ti.com/product/bq24153a
  * http://www.ti.com/product/bq24155
+ * http://www.ti.com/product/bq24157s
+ * http://www.ti.com/product/bq24158
  */
 
 #include <linux/kernel.h>
@@ -147,6 +149,7 @@ enum bq2415x_chip {
 	BQ24155,
 	BQ24156,
 	BQ24156A,
+	BQ24157S,
 	BQ24158,
 };
 
@@ -162,6 +165,7 @@ static char *bq2415x_chip_name[] = {
 	"bq24155",
 	"bq24156",
 	"bq24156a",
+	"bq24157s",
 	"bq24158",
 };
 
@@ -448,6 +452,8 @@ static enum bq2415x_chip bq2415x_detect_chip(struct bq2415x_device *bq)
 				return bq->chip;
 			return BQ24156;
 		case 2:
+			if (bq->chip == BQ24157S)
+				return bq->chip;
 			return BQ24158;
 		default:
 			return BQUNKNOWN;
@@ -480,6 +486,7 @@ static int bq2415x_detect_revision(struct bq2415x_device *bq)
 	case BQ24153A:
 	case BQ24156:
 	case BQ24156A:
+	case BQ24157S:
 	case BQ24158:
 		if (ret == 3)
 			return 0;
@@ -1716,6 +1723,7 @@ static const struct i2c_device_id bq2415x_i2c_id_table[] = {
 	{ "bq24155", BQ24155 },
 	{ "bq24156", BQ24156 },
 	{ "bq24156a", BQ24156A },
+	{ "bq24157s", BQ24157S },
 	{ "bq24158", BQ24158 },
 	{},
 };
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] bq2415x_charger: Remove unnecessary else after return
  2015-03-05 11:23 ` [PATCH 1/2] bq2415x_charger: Remove unnecessary else after return Anda-Maria Nicolae
@ 2015-03-05 16:13   ` Joe Perches
  2015-03-05 16:31     ` Nicolae, Anda-maria
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2015-03-05 16:13 UTC (permalink / raw)
  To: Anda-Maria Nicolae; +Cc: sre, dbaryshkov, dwmw2, linux-pm, linux-kernel

On Thu, 2015-03-05 at 13:23 +0200, Anda-Maria Nicolae wrote:
> Fix coding style to comply with checkpatch.pl

I think these are unnecessary changes.

The current version of checkpatch should not emit
a warning for the original code.

> diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
[]
> @@ -352,8 +352,7 @@ static int bq2415x_exec_command(struct bq2415x_device *bq,
>  			BQ2415X_BIT_CE);
>  		if (ret < 0)
>  			return ret;
> -		else
> -			return ret > 0 ? 0 : 1;
> +		return ret > 0 ? 0 : 1;

maybe return !ret

>  	case BQ2415X_CHARGER_ENABLE:
>  		return bq2415x_i2c_write_bit(bq, BQ2415X_REG_CONTROL,
>  				0, BQ2415X_BIT_CE);
> @@ -426,20 +425,17 @@ static enum bq2415x_chip bq2415x_detect_chip(struct bq2415x_device *bq)
>  		case 0:
>  			if (bq->chip == BQ24151A)
>  				return bq->chip;
> -			else
> -				return BQ24151;
> +			return BQ24151;
>  		case 1:
>  			if (bq->chip == BQ24150A ||
>  				bq->chip == BQ24152 ||
>  				bq->chip == BQ24155)
>  				return bq->chip;
> -			else
> -				return BQ24150;
> +			return BQ24150;
>  		case 2:
>  			if (bq->chip == BQ24153A)
>  				return bq->chip;
> -			else
> -				return BQ24153;
> +			return BQ24153;
>  		default:
>  			return BQUNKNOWN;
>  		}
> @@ -450,8 +446,7 @@ static enum bq2415x_chip bq2415x_detect_chip(struct bq2415x_device *bq)
>  		case 0:
>  			if (bq->chip == BQ24156A)
>  				return bq->chip;
> -			else
> -				return BQ24156;
> +			return BQ24156;
>  		case 2:
>  			return BQ24158;
>  		default:
> @@ -480,8 +475,7 @@ static int bq2415x_detect_revision(struct bq2415x_device *bq)
>  	case BQ24152:
>  		if (ret >= 0 && ret <= 3)
>  			return ret;
> -		else
> -			return -1;
> +		return -1;
>  	case BQ24153:
>  	case BQ24153A:
>  	case BQ24156:
> @@ -491,13 +485,11 @@ static int bq2415x_detect_revision(struct bq2415x_device *bq)
>  			return 0;
>  		else if (ret == 1)
>  			return 1;
> -		else
> -			return -1;
> +		return -1;
>  	case BQ24155:
>  		if (ret == 3)
>  			return 3;
> -		else
> -			return -1;
> +		return -1;
>  	case BQUNKNOWN:
>  		return -1;
>  	}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 1/2] bq2415x_charger: Remove unnecessary else after return
  2015-03-05 16:13   ` Joe Perches
@ 2015-03-05 16:31     ` Nicolae, Anda-maria
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolae, Anda-maria @ 2015-03-05 16:31 UTC (permalink / raw)
  To: Joe Perches
  Cc: sre@kernel.org, dbaryshkov@gmail.com, dwmw2@infradead.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org

Thanks for feedback :).

You are right, checkpatch.pl does not complain about issues in existing code. 
I did these changes so that existing code has similar coding style with the newly added code. 
This way, in the entire driver we will have the same coding style.

Regards,
Anda

________________________________________
From: Joe Perches [joe@perches.com]
Sent: Thursday, March 05, 2015 6:13 PM
To: Nicolae, Anda-maria
Cc: sre@kernel.org; dbaryshkov@gmail.com; dwmw2@infradead.org; linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] bq2415x_charger: Remove unnecessary else after return

On Thu, 2015-03-05 at 13:23 +0200, Anda-Maria Nicolae wrote:
> Fix coding style to comply with checkpatch.pl

I think these are unnecessary changes.

The current version of checkpatch should not emit
a warning for the original code.

> diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
[]
> @@ -352,8 +352,7 @@ static int bq2415x_exec_command(struct bq2415x_device *bq,
>                       BQ2415X_BIT_CE);
>               if (ret < 0)
>                       return ret;
> -             else
> -                     return ret > 0 ? 0 : 1;
> +             return ret > 0 ? 0 : 1;

maybe return !ret

>       case BQ2415X_CHARGER_ENABLE:
>               return bq2415x_i2c_write_bit(bq, BQ2415X_REG_CONTROL,
>                               0, BQ2415X_BIT_CE);
> @@ -426,20 +425,17 @@ static enum bq2415x_chip bq2415x_detect_chip(struct bq2415x_device *bq)
>               case 0:
>                       if (bq->chip == BQ24151A)
>                               return bq->chip;
> -                     else
> -                             return BQ24151;
> +                     return BQ24151;
>               case 1:
>                       if (bq->chip == BQ24150A ||
>                               bq->chip == BQ24152 ||
>                               bq->chip == BQ24155)
>                               return bq->chip;
> -                     else
> -                             return BQ24150;
> +                     return BQ24150;
>               case 2:
>                       if (bq->chip == BQ24153A)
>                               return bq->chip;
> -                     else
> -                             return BQ24153;
> +                     return BQ24153;
>               default:
>                       return BQUNKNOWN;
>               }
> @@ -450,8 +446,7 @@ static enum bq2415x_chip bq2415x_detect_chip(struct bq2415x_device *bq)
>               case 0:
>                       if (bq->chip == BQ24156A)
>                               return bq->chip;
> -                     else
> -                             return BQ24156;
> +                     return BQ24156;
>               case 2:
>                       return BQ24158;
>               default:
> @@ -480,8 +475,7 @@ static int bq2415x_detect_revision(struct bq2415x_device *bq)
>       case BQ24152:
>               if (ret >= 0 && ret <= 3)
>                       return ret;
> -             else
> -                     return -1;
> +             return -1;
>       case BQ24153:
>       case BQ24153A:
>       case BQ24156:
> @@ -491,13 +485,11 @@ static int bq2415x_detect_revision(struct bq2415x_device *bq)
>                       return 0;
>               else if (ret == 1)
>                       return 1;
> -             else
> -                     return -1;
> +             return -1;
>       case BQ24155:
>               if (ret == 3)
>                       return 3;
> -             else
> -                     return -1;
> +             return -1;
>       case BQUNKNOWN:
>               return -1;
>       }




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] bq2415x_charger: Fix coding style issues and add new charger in the list of supported chargers
  2015-03-05 11:23 [PATCH 0/2] bq2415x_charger: Fix coding style issues and add new charger in the list of supported chargers Anda-Maria Nicolae
  2015-03-05 11:23 ` [PATCH 1/2] bq2415x_charger: Remove unnecessary else after return Anda-Maria Nicolae
  2015-03-05 11:23 ` [PATCH 2/2] bq2415x_charger: Add support for bq24157s Anda-Maria Nicolae
@ 2015-03-07 18:38 ` Sebastian Reichel
  2 siblings, 0 replies; 6+ messages in thread
From: Sebastian Reichel @ 2015-03-07 18:38 UTC (permalink / raw)
  To: Anda-Maria Nicolae; +Cc: dbaryshkov, dwmw2, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

Hi,

On Thu, Mar 05, 2015 at 01:23:55PM +0200, Anda-Maria Nicolae wrote:
> Hello,
> 
> First patch from patchset fixes coding style issues: removes unnecessary else after return.
> This way, the coding style complies with checkpatch.pl.
> 
> Second patch from patchset updates bq2415x driver to support bq24157s charger.

Thanks, applied:

http://git.infradead.org/battery-2.6.git/commit/0e1392d9df3dca4c1774a0c61fd85fce81cb88cd

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-07 18:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-05 11:23 [PATCH 0/2] bq2415x_charger: Fix coding style issues and add new charger in the list of supported chargers Anda-Maria Nicolae
2015-03-05 11:23 ` [PATCH 1/2] bq2415x_charger: Remove unnecessary else after return Anda-Maria Nicolae
2015-03-05 16:13   ` Joe Perches
2015-03-05 16:31     ` Nicolae, Anda-maria
2015-03-05 11:23 ` [PATCH 2/2] bq2415x_charger: Add support for bq24157s Anda-Maria Nicolae
2015-03-07 18:38 ` [PATCH 0/2] bq2415x_charger: Fix coding style issues and add new charger in the list of supported chargers Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).