All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Murphy <dmurphy@ti.com>
To: "Andrew F. Davis" <afd@ti.com>,
	"Pali Rohár" <pali.rohar@gmail.com>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Dmitry Eremin-Solenikov" <dbaryshkov@gmail.com>,
	"David Woodhouse" <dwmw2@infradead.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/8] power: bq27x00_battery: Checkpatch fixes
Date: Thu, 23 Jul 2015 11:04:29 -0500	[thread overview]
Message-ID: <55B1108D.3000505@ti.com> (raw)
In-Reply-To: <1437601920-13045-5-git-send-email-afd@ti.com>

On 07/22/2015 04:51 PM, Andrew F. Davis wrote:
> Remove space before tab.
> Remove unnecessary line continuations.
> Add braces to else statement.
> Remove unnecessary parentheses.
> Remove unneeded blank lines.
> Remove unnecessary 'out of memory' message.
> Add missing line after declarations.
> Change use of printk to pr_err.
>
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
>  drivers/power/bq27x00_battery.c | 24 +++++++++++-------------
>  1 file changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
> index 9cdad19..8287261f 100644
> --- a/drivers/power/bq27x00_battery.c
> +++ b/drivers/power/bq27x00_battery.c
> @@ -108,7 +108,7 @@ struct bq27x00_reg_cache {
>  };
>  
>  struct bq27x00_device_info {
> -	struct device 		*dev;
> +	struct device		*dev;
>  	int			id;
>  	enum bq27x00_chip	chip;
>  
> @@ -202,8 +202,8 @@ static enum power_supply_property bq27510_battery_props[] = {
>  
>  static unsigned int poll_interval = 360;
>  module_param(poll_interval, uint, 0644);
> -MODULE_PARM_DESC(poll_interval, "battery poll interval in seconds - " \
> -				"0 disables polling");
> +MODULE_PARM_DESC(poll_interval,
> +		 "battery poll interval in seconds - 0 disables polling");
>  
>  /*
>   * Common code for BQ27x00 devices
> @@ -319,8 +319,9 @@ static int bq27x00_battery_read_ilmd(struct bq27x00_device_info *di)
>  			ilmd = bq27x00_read(di, BQ27510_REG_DCAP, false);
>  		else
>  			ilmd = bq27x00_read(di, BQ27500_REG_DCAP, false);
> -	} else
> +	} else {
>  		ilmd = bq27x00_read(di, BQ27000_REG_ILMD, true);
> +	}
>  
>  	if (ilmd < 0) {
>  		dev_dbg(di->dev, "error reading initial last measured discharge\n");
> @@ -451,7 +452,7 @@ static int bq27x00_battery_read_health(struct bq27x00_device_info *di)
>  		return tval;
>  	}
>  
> -	if ((di->chip == BQ27500)) {
> +	if (di->chip == BQ27500) {
>  		if (tval & BQ27500_FLAG_SOCF)
>  			tval = POWER_SUPPLY_HEALTH_DEAD;
>  		else if (tval & BQ27500_FLAG_OTC)
> @@ -836,7 +837,6 @@ static void bq27x00_powersupply_unregister(struct bq27x00_device_info *di)
>  	mutex_destroy(&di->lock);
>  }
>  
> -
>  /* i2c specific code */
>  #ifdef CONFIG_BATTERY_BQ27X00_I2C
>  
> @@ -897,14 +897,12 @@ static int bq27x00_battery_probe(struct i2c_client *client,
>  
>  	name = devm_kasprintf(&client->dev, GFP_KERNEL, "%s-%d", id->name, num);
>  	if (!name) {
> -		dev_err(&client->dev, "failed to allocate device name\n");
>  		retval = -ENOMEM;
>  		goto batt_failed;
>  	}
>  
>  	di = devm_kzalloc(&client->dev, sizeof(*di), GFP_KERNEL);
>  	if (!di) {
> -		dev_err(&client->dev, "failed to allocate device info data\n");
>  		retval = -ENOMEM;
>  		goto batt_failed;
>  	}
> @@ -965,8 +963,9 @@ static struct i2c_driver bq27x00_battery_driver = {
>  static inline int bq27x00_battery_i2c_init(void)
>  {
>  	int ret = i2c_add_driver(&bq27x00_battery_driver);
> +
>  	if (ret)
> -		printk(KERN_ERR "Unable to register BQ27x00 i2c driver\n");
> +		pr_err("Unable to register BQ27x00 i2c driver\n");
>  
>  	return ret;
>  }
> @@ -1037,10 +1036,8 @@ static int bq27000_battery_probe(struct platform_device *pdev)
>  	}
>  
>  	di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL);
> -	if (!di) {
> -		dev_err(&pdev->dev, "failed to allocate device info data\n");
> +	if (!di)
>  		return -ENOMEM;
> -	}
>  
>  	platform_set_drvdata(pdev, di);
>  
> @@ -1073,8 +1070,9 @@ static struct platform_driver bq27000_battery_driver = {
>  static inline int bq27x00_battery_platform_init(void)
>  {
>  	int ret = platform_driver_register(&bq27000_battery_driver);
> +
>  	if (ret)
> -		printk(KERN_ERR "Unable to register BQ27000 platform driver\n");
> +		pr_err("Unable to register BQ27000 platform driver\n");
>  
>  	return ret;

Just a nitpick and I realize this is a checkpatch fix patch but does it make sense just to
return the status of platform_driver_register?  Unless the message is useful

Dan


>  }

Acked-by: Dan Murphy <dmurphy@ti.com>


-- 
------------------
Dan Murphy


WARNING: multiple messages have this Message-ID (diff)
From: Dan Murphy <dmurphy@ti.com>
To: "Andrew F. Davis" <afd@ti.com>,
	"Pali Rohár" <pali.rohar@gmail.com>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Dmitry Eremin-Solenikov" <dbaryshkov@gmail.com>,
	"David Woodhouse" <dwmw2@infradead.org>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/8] power: bq27x00_battery: Checkpatch fixes
Date: Thu, 23 Jul 2015 11:04:29 -0500	[thread overview]
Message-ID: <55B1108D.3000505@ti.com> (raw)
In-Reply-To: <1437601920-13045-5-git-send-email-afd@ti.com>

On 07/22/2015 04:51 PM, Andrew F. Davis wrote:
> Remove space before tab.
> Remove unnecessary line continuations.
> Add braces to else statement.
> Remove unnecessary parentheses.
> Remove unneeded blank lines.
> Remove unnecessary 'out of memory' message.
> Add missing line after declarations.
> Change use of printk to pr_err.
>
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
>  drivers/power/bq27x00_battery.c | 24 +++++++++++-------------
>  1 file changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
> index 9cdad19..8287261f 100644
> --- a/drivers/power/bq27x00_battery.c
> +++ b/drivers/power/bq27x00_battery.c
> @@ -108,7 +108,7 @@ struct bq27x00_reg_cache {
>  };
>  
>  struct bq27x00_device_info {
> -	struct device 		*dev;
> +	struct device		*dev;
>  	int			id;
>  	enum bq27x00_chip	chip;
>  
> @@ -202,8 +202,8 @@ static enum power_supply_property bq27510_battery_props[] = {
>  
>  static unsigned int poll_interval = 360;
>  module_param(poll_interval, uint, 0644);
> -MODULE_PARM_DESC(poll_interval, "battery poll interval in seconds - " \
> -				"0 disables polling");
> +MODULE_PARM_DESC(poll_interval,
> +		 "battery poll interval in seconds - 0 disables polling");
>  
>  /*
>   * Common code for BQ27x00 devices
> @@ -319,8 +319,9 @@ static int bq27x00_battery_read_ilmd(struct bq27x00_device_info *di)
>  			ilmd = bq27x00_read(di, BQ27510_REG_DCAP, false);
>  		else
>  			ilmd = bq27x00_read(di, BQ27500_REG_DCAP, false);
> -	} else
> +	} else {
>  		ilmd = bq27x00_read(di, BQ27000_REG_ILMD, true);
> +	}
>  
>  	if (ilmd < 0) {
>  		dev_dbg(di->dev, "error reading initial last measured discharge\n");
> @@ -451,7 +452,7 @@ static int bq27x00_battery_read_health(struct bq27x00_device_info *di)
>  		return tval;
>  	}
>  
> -	if ((di->chip == BQ27500)) {
> +	if (di->chip == BQ27500) {
>  		if (tval & BQ27500_FLAG_SOCF)
>  			tval = POWER_SUPPLY_HEALTH_DEAD;
>  		else if (tval & BQ27500_FLAG_OTC)
> @@ -836,7 +837,6 @@ static void bq27x00_powersupply_unregister(struct bq27x00_device_info *di)
>  	mutex_destroy(&di->lock);
>  }
>  
> -
>  /* i2c specific code */
>  #ifdef CONFIG_BATTERY_BQ27X00_I2C
>  
> @@ -897,14 +897,12 @@ static int bq27x00_battery_probe(struct i2c_client *client,
>  
>  	name = devm_kasprintf(&client->dev, GFP_KERNEL, "%s-%d", id->name, num);
>  	if (!name) {
> -		dev_err(&client->dev, "failed to allocate device name\n");
>  		retval = -ENOMEM;
>  		goto batt_failed;
>  	}
>  
>  	di = devm_kzalloc(&client->dev, sizeof(*di), GFP_KERNEL);
>  	if (!di) {
> -		dev_err(&client->dev, "failed to allocate device info data\n");
>  		retval = -ENOMEM;
>  		goto batt_failed;
>  	}
> @@ -965,8 +963,9 @@ static struct i2c_driver bq27x00_battery_driver = {
>  static inline int bq27x00_battery_i2c_init(void)
>  {
>  	int ret = i2c_add_driver(&bq27x00_battery_driver);
> +
>  	if (ret)
> -		printk(KERN_ERR "Unable to register BQ27x00 i2c driver\n");
> +		pr_err("Unable to register BQ27x00 i2c driver\n");
>  
>  	return ret;
>  }
> @@ -1037,10 +1036,8 @@ static int bq27000_battery_probe(struct platform_device *pdev)
>  	}
>  
>  	di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL);
> -	if (!di) {
> -		dev_err(&pdev->dev, "failed to allocate device info data\n");
> +	if (!di)
>  		return -ENOMEM;
> -	}
>  
>  	platform_set_drvdata(pdev, di);
>  
> @@ -1073,8 +1070,9 @@ static struct platform_driver bq27000_battery_driver = {
>  static inline int bq27x00_battery_platform_init(void)
>  {
>  	int ret = platform_driver_register(&bq27000_battery_driver);
> +
>  	if (ret)
> -		printk(KERN_ERR "Unable to register BQ27000 platform driver\n");
> +		pr_err("Unable to register BQ27000 platform driver\n");
>  
>  	return ret;

Just a nitpick and I realize this is a checkpatch fix patch but does it make sense just to
return the status of platform_driver_register?  Unless the message is useful

Dan


>  }

Acked-by: Dan Murphy <dmurphy@ti.com>


-- 
------------------
Dan Murphy


  parent reply	other threads:[~2015-07-23 16:04 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-22 21:51 [PATCH 0/8] Add support for additional bq27xxx devices Andrew F. Davis
2015-07-22 21:51 ` Andrew F. Davis
2015-07-22 21:51 ` [PATCH 1/8] power: bq27x00_battery: Add manufacturer property Andrew F. Davis
2015-07-22 21:51   ` Andrew F. Davis
2015-07-23 15:55   ` Dan Murphy
2015-07-23 15:55     ` Dan Murphy
2015-07-23 15:59   ` Pali Rohár
2015-07-24 15:36   ` Sebastian Reichel
2015-07-22 21:51 ` [PATCH 2/8] power: bq27x00_battery: Fix lines over 80 characters long Andrew F. Davis
2015-07-22 21:51   ` Andrew F. Davis
2015-07-23 16:00   ` Pali Rohár
2015-07-23 16:02   ` Dan Murphy
2015-07-23 16:02     ` Dan Murphy
2015-07-24 15:36   ` Sebastian Reichel
2015-07-22 21:51 ` [PATCH 3/8] power: bq27x00_battery: Fix function parameter alignment Andrew F. Davis
2015-07-22 21:51   ` Andrew F. Davis
2015-07-23 16:00   ` Pali Rohár
2015-07-23 16:02   ` Dan Murphy
2015-07-23 16:02     ` Dan Murphy
2015-07-24 15:37   ` Sebastian Reichel
2015-07-22 21:51 ` [PATCH 4/8] power: bq27x00_battery: Checkpatch fixes Andrew F. Davis
2015-07-22 21:51   ` Andrew F. Davis
2015-07-23 16:01   ` Pali Rohár
2015-07-23 16:04   ` Dan Murphy [this message]
2015-07-23 16:04     ` Dan Murphy
2015-07-24 15:37   ` Sebastian Reichel
2015-07-22 21:51 ` [PATCH 5/8] power: bq27x00_battery: Renaming for consistency Andrew F. Davis
2015-07-22 21:51   ` Andrew F. Davis
2015-07-23 16:12   ` Pali Rohár
     [not found]     ` <55B11E4C.6000006@ti.com>
2015-07-23 20:15       ` Pali Rohár
2015-07-23 20:56         ` Belisko Marek
2015-07-23 21:15           ` Pali Rohár
2015-07-23 21:36             ` Belisko Marek
2015-07-24  7:44               ` Pali Rohár
2015-07-22 21:51 ` [PATCH 6/8] power: bq27xxx_battery: Fix typos and change naming for state of charge functions Andrew F. Davis
2015-07-22 21:51   ` Andrew F. Davis
2015-07-23 16:15   ` Pali Rohár
2015-07-23 17:19     ` Andrew F. Davis
2015-07-23 17:19       ` Andrew F. Davis
2015-07-28  8:41       ` Pali Rohár
2015-07-22 21:51 ` [PATCH 7/8] power: bq27xxx_battery: Add support for additional bq27xxx family devices Andrew F. Davis
2015-07-22 21:51   ` Andrew F. Davis
2015-07-23 16:20   ` Pali Rohár
2015-07-23 17:42     ` Andrew F. Davis
2015-07-23 17:42       ` Andrew F. Davis
2015-07-28  8:43       ` Pali Rohár
2015-07-22 21:52 ` [PATCH 8/8] power: bq27xxx_battery: Cleanup health checking Andrew F. Davis
2015-07-22 21:52   ` Andrew F. Davis
2015-07-23 16:22   ` Pali Rohár
2015-07-23 17:06     ` Joe Perches
2015-07-24 20:32       ` Andrew F. Davis
2015-07-24 20:32         ` Andrew F. Davis
2015-07-24 20:27     ` Andrew F. Davis
2015-07-24 20:27       ` Andrew F. Davis
2015-07-24 20:53       ` Pali Rohár
2015-07-23 16:27 ` [PATCH 0/8] Add support for additional bq27xxx devices Pali Rohár
2015-07-23 17:01   ` Andreas Dannenberg
2015-07-23 17:01     ` Andreas Dannenberg
2015-07-24 15:57   ` Andrew F. Davis
2015-07-24 15:57     ` Andrew F. Davis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B1108D.3000505@ti.com \
    --to=dmurphy@ti.com \
    --cc=afd@ti.com \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.