linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bagas Sanjaya <bagasdotme@gmail.com>
To: Charalampos Mitrodimas <charmitro@posteo.net>,
	Sebastian Reichel <sre@kernel.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	qinyu <qinyu32@huawei.com>, Nick Alcock <nick.alcock@oracle.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Huacai Chen <chenhuacai@kernel.org>,
	Kai-Heng Feng <kai.heng.feng@canonical.com>,
	Andreas Kemnade <andreas@kemnade.info>,
	Ian Molton <spyro@f2s.com>,
	Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>,
	Anton Vorontsov <cbou@mail.ru>
Cc: Linux Power Management <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] power: supply: Fix indentation and some other warnings
Date: Sat, 18 Nov 2023 06:36:16 +0700	[thread overview]
Message-ID: <ZVf48PWBpvKULeXT@archie.me> (raw)
In-Reply-To: <20231117230658.65809-1-charmitro@posteo.net>

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

On Fri, Nov 17, 2023 at 11:06:58PM +0000, Charalampos Mitrodimas wrote:
> These were mentioned by checkpatch:
> 	Errors:
> 		(1) code indent should use tabs where possible
> 		(2) switch and case should be at the same indent
> 	Warnings:
> 		(1) quoted string split across lines
> 		(2) Missing a blank line after declarations
> 
> Based on this comment from "include/linux/module.h", modules with
> multiple authors should use multiple MODULE_AUTHOR() statements.
> 	/*
> 	 * Author(s), use "Name <email>" or just "Name", for multiple
> 	 * authors use multiple MODULE_AUTHOR() statements/lines.
> 	 */
> 	#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)

Shouldn't MODULE_AUTHOR fix be separate patch?

> 
> Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net>
> ---
>  drivers/power/supply/power_supply_core.c | 167 ++++++++++++-----------
>  1 file changed, 84 insertions(+), 83 deletions(-)
> 
> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> index 73265001dd4b..ecef35ac3b7e 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -861,44 +861,44 @@ const size_t power_supply_battery_info_properties_size = ARRAY_SIZE(power_supply
>  EXPORT_SYMBOL_GPL(power_supply_battery_info_properties_size);
>  
>  bool power_supply_battery_info_has_prop(struct power_supply_battery_info *info,
> -				        enum power_supply_property psp)
> +					enum power_supply_property psp)

Looks OK.

>  {
>  	if (!info)
>  		return false;
>  
>  	switch (psp) {
> -		case POWER_SUPPLY_PROP_TECHNOLOGY:
> -			return info->technology != POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
> -		case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
> -			return info->energy_full_design_uwh >= 0;
> -		case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
> -			return info->charge_full_design_uah >= 0;
> -		case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
> -			return info->voltage_min_design_uv >= 0;
> -		case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
> -			return info->voltage_max_design_uv >= 0;
> -		case POWER_SUPPLY_PROP_PRECHARGE_CURRENT:
> -			return info->precharge_current_ua >= 0;
> -		case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT:
> -			return info->charge_term_current_ua >= 0;
> -		case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
> -			return info->constant_charge_current_max_ua >= 0;
> -		case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
> -			return info->constant_charge_voltage_max_uv >= 0;
> -		case POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MIN:
> -			return info->temp_ambient_alert_min > INT_MIN;
> -		case POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MAX:
> -			return info->temp_ambient_alert_max < INT_MAX;
> -		case POWER_SUPPLY_PROP_TEMP_ALERT_MIN:
> -			return info->temp_alert_min > INT_MIN;
> -		case POWER_SUPPLY_PROP_TEMP_ALERT_MAX:
> -			return info->temp_alert_max < INT_MAX;
> -		case POWER_SUPPLY_PROP_TEMP_MIN:
> -			return info->temp_min > INT_MIN;
> -		case POWER_SUPPLY_PROP_TEMP_MAX:
> -			return info->temp_max < INT_MAX;
> -		default:
> -			return false;
> +	case POWER_SUPPLY_PROP_TECHNOLOGY:
> +		return info->technology != POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
> +	case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
> +		return info->energy_full_design_uwh >= 0;
> +	case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
> +		return info->charge_full_design_uah >= 0;
> +	case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
> +		return info->voltage_min_design_uv >= 0;
> +	case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
> +		return info->voltage_max_design_uv >= 0;
> +	case POWER_SUPPLY_PROP_PRECHARGE_CURRENT:
> +		return info->precharge_current_ua >= 0;
> +	case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT:
> +		return info->charge_term_current_ua >= 0;
> +	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
> +		return info->constant_charge_current_max_ua >= 0;
> +	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
> +		return info->constant_charge_voltage_max_uv >= 0;
> +	case POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MIN:
> +		return info->temp_ambient_alert_min > INT_MIN;
> +	case POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MAX:
> +		return info->temp_ambient_alert_max < INT_MAX;
> +	case POWER_SUPPLY_PROP_TEMP_ALERT_MIN:
> +		return info->temp_alert_min > INT_MIN;
> +	case POWER_SUPPLY_PROP_TEMP_ALERT_MAX:
> +		return info->temp_alert_max < INT_MAX;
> +	case POWER_SUPPLY_PROP_TEMP_MIN:
> +		return info->temp_min > INT_MIN;
> +	case POWER_SUPPLY_PROP_TEMP_MAX:
> +		return info->temp_max < INT_MAX;
> +	default:
> +		return false;
>  	}

This one LGTM.

>  }
>  EXPORT_SYMBOL_GPL(power_supply_battery_info_has_prop);
> @@ -914,53 +914,53 @@ int power_supply_battery_info_get_prop(struct power_supply_battery_info *info,
>  		return -EINVAL;
>  
>  	switch (psp) {
> -		case POWER_SUPPLY_PROP_TECHNOLOGY:
> -			val->intval = info->technology;
> -			return 0;
> -		case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
> -			val->intval = info->energy_full_design_uwh;
> -			return 0;
> -		case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
> -			val->intval = info->charge_full_design_uah;
> -			return 0;
> -		case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
> -			val->intval = info->voltage_min_design_uv;
> -			return 0;
> -		case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
> -			val->intval = info->voltage_max_design_uv;
> -			return 0;
> -		case POWER_SUPPLY_PROP_PRECHARGE_CURRENT:
> -			val->intval = info->precharge_current_ua;
> -			return 0;
> -		case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT:
> -			val->intval = info->charge_term_current_ua;
> -			return 0;
> -		case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
> -			val->intval = info->constant_charge_current_max_ua;
> -			return 0;
> -		case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
> -			val->intval = info->constant_charge_voltage_max_uv;
> -			return 0;
> -		case POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MIN:
> -			val->intval = info->temp_ambient_alert_min;
> -			return 0;
> -		case POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MAX:
> -			val->intval = info->temp_ambient_alert_max;
> -			return 0;
> -		case POWER_SUPPLY_PROP_TEMP_ALERT_MIN:
> -			val->intval = info->temp_alert_min;
> -			return 0;
> -		case POWER_SUPPLY_PROP_TEMP_ALERT_MAX:
> -			val->intval = info->temp_alert_max;
> -			return 0;
> -		case POWER_SUPPLY_PROP_TEMP_MIN:
> -			val->intval = info->temp_min;
> -			return 0;
> -		case POWER_SUPPLY_PROP_TEMP_MAX:
> -			val->intval = info->temp_max;
> -			return 0;
> -		default:
> -			return -EINVAL;
> +	case POWER_SUPPLY_PROP_TECHNOLOGY:
> +		val->intval = info->technology;
> +		return 0;
> +	case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
> +		val->intval = info->energy_full_design_uwh;
> +		return 0;
> +	case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
> +		val->intval = info->charge_full_design_uah;
> +		return 0;
> +	case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
> +		val->intval = info->voltage_min_design_uv;
> +		return 0;
> +	case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
> +		val->intval = info->voltage_max_design_uv;
> +		return 0;
> +	case POWER_SUPPLY_PROP_PRECHARGE_CURRENT:
> +		val->intval = info->precharge_current_ua;
> +		return 0;
> +	case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT:
> +		val->intval = info->charge_term_current_ua;
> +		return 0;
> +	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
> +		val->intval = info->constant_charge_current_max_ua;
> +		return 0;
> +	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
> +		val->intval = info->constant_charge_voltage_max_uv;
> +		return 0;
> +	case POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MIN:
> +		val->intval = info->temp_ambient_alert_min;
> +		return 0;
> +	case POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MAX:
> +		val->intval = info->temp_ambient_alert_max;
> +		return 0;
> +	case POWER_SUPPLY_PROP_TEMP_ALERT_MIN:
> +		val->intval = info->temp_alert_min;
> +		return 0;
> +	case POWER_SUPPLY_PROP_TEMP_ALERT_MAX:
> +		val->intval = info->temp_alert_max;
> +		return 0;
> +	case POWER_SUPPLY_PROP_TEMP_MIN:
> +		val->intval = info->temp_min;
> +		return 0;
> +	case POWER_SUPPLY_PROP_TEMP_MAX:
> +		val->intval = info->temp_max;
> +		return 0;
> +	default:
> +		return -EINVAL;

And this one too.

> @@ -1636,6 +1637,6 @@ subsys_initcall(power_supply_class_init);
>  module_exit(power_supply_class_exit);
>  
>  MODULE_DESCRIPTION("Universal power supply monitor class");
> -MODULE_AUTHOR("Ian Molton <spyro@f2s.com>, "
> -	      "Szabolcs Gyurko, "
> -	      "Anton Vorontsov <cbou@mail.ru>");
> +MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
> +MODULE_AUTHOR("Szabolcs Gyurko");
> +MODULE_AUTHOR("Anton Vorontsov <cbou@mail.ru>");

And also this one.

Thanks.

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-11-17 23:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 23:06 [PATCH] power: supply: Fix indentation and some other warnings Charalampos Mitrodimas
2023-11-17 23:36 ` Bagas Sanjaya [this message]
2023-11-18 10:36   ` Charalampos Mitrodimas
2023-11-18 11:45     ` Bagas Sanjaya

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=ZVf48PWBpvKULeXT@archie.me \
    --to=bagasdotme@gmail.com \
    --cc=andreas@kemnade.info \
    --cc=cbou@mail.ru \
    --cc=charmitro@posteo.net \
    --cc=chenhuacai@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kai.heng.feng@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=nick.alcock@oracle.com \
    --cc=qinyu32@huawei.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=spyro@f2s.com \
    --cc=sre@kernel.org \
    --cc=szabolcs.gyurko@tlt.hu \
    /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 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).