power: supply: Fix indentation and some other warnings
PATCH 1/1 power: supply: Fix indentation and some other warnings
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)
--- drivers/power/supply/power_supply_core.c | 167 ++++++++++++----------- 1 file changed, 84 insertions(+), 83 deletions(-)
drivers/power/supply/power_supply_core.c +84 -83
@@ -861,44 +861,44 @@ const size_t power_supply_battery_info_properties_size = ARRAY_SIZE(power_supplyEXPORT_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) {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; } }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 ; } }EXPORT_SYMBOL_GPL (power_supply_battery_info_get_prop);
@@ -1255,6 +1255,7 @@ EXPORT_SYMBOL_GPL(power_supply_powers);static void power_supply_dev_release (struct device *dev) {struct power_supply *psy =to_power_supply (dev); +dev_dbg (dev,"%s\n" , __func__);kfree (psy); }
@@ -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 <[email protected]>, " -"Szabolcs Gyurko, " -"Anton Vorontsov <[email protected]>" ); +MODULE_AUTHOR ("Ian Molton <[email protected]>" ); +MODULE_AUTHOR ("Szabolcs Gyurko" ); +MODULE_AUTHOR ("Anton Vorontsov <[email protected]>" );
Signature · 1 line
2.39.2
Quoted 8 lines · Charalampos Mitrodimas
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
Quoted 7 lines
Based on this comment from "
include/linux/module.h", modules with multiple authors should use multipleMODULE_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?
Quoted 11 lines
Signed-off-by Charalampos Mitrodimas <[email protected]>--- drivers/power/supply/power_supply_core.c | 167 ++++++++++++----------- 1 file changed, 84 insertions(+), 83 deletions(-)drivers/power/supply/power_supply_core.c +0
-0
drivers/power/supply/power_supply_core.c const size_t power_supply_battery_info_properties_size = ARRAY_SIZE(power_supply · line 864
Quoted 5 lines
drivers/power/supply/power_supply_core.c +1
-1@@ -861,44 +861,44 @@ const size_t power_supply_battery_info_properties_size = ARRAY_SIZE(power_supplyEXPORT_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.
Quoted 60 lines
drivers/power/supply/power_supply_core.c +23
-32{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 :
drivers/power/supply/power_supply_core.c const size_t power_supply_battery_info_properties_size = ARRAY_SIZE(power_supply · line 902
Quoted 10 lines
drivers/power/supply/power_supply_core.c +9
-0+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.
Quoted 90 lines
drivers/power/supply/power_supply_core.c +37
-47}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 :
drivers/power/supply/power_supply_core.c int power_supply_battery_info_get_prop(struct power_supply_battery_info *info, · line 963
Quoted 10 lines
drivers/power/supply/power_supply_core.c +10
-0+ 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.
drivers/power/supply/power_supply_core.c subsys_initcall(power_supply_class_init); · line 1642
Quoted 10 lines
drivers/power/supply/power_supply_core.c +3
-3@@ -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 <[email protected]>, " -"Szabolcs Gyurko, " -"Anton Vorontsov <[email protected]>" ); +MODULE_AUTHOR ("Ian Molton <[email protected]>" ); +MODULE_AUTHOR ("Szabolcs Gyurko" ); +MODULE_AUTHOR ("Anton Vorontsov <[email protected]>" );
And also this one.
Thanks.
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Hi Bagas,
Quoted 17 lines · Bagas Sanjaya
Quoted 8 lines · Charalampos Mitrodimas
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 declarationsQuoted 7 lines
Based on this comment from "
include/linux/module.h", modules with multiple authors should use multipleMODULE_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)
Quoted 1 line
Shouldn't
MODULE_AUTHORfix be separate patch?
Sorry, I should have mentioned in the commit that the warnings "quoted string split across lines" pertained to the MODULE_AUTHOR line.
In the commit message I'm just clarifying why I used multiple MODULE_AUTHOR statements.
Should I send a v2 patch with a revised commit description?
Quoted 209 lines
Quoted 12 lines
Signed-off-by Charalampos Mitrodimas <[email protected]>--- drivers/power/supply/power_supply_core.c | 167 ++++++++++++----------- 1 file changed, 84 insertions(+), 83 deletions(-)drivers/power/supply/power_supply_core.c +0
-0drivers/power/supply/power_supply_core.c const size_t power_supply_battery_info_properties_size = ARRAY_SIZE(power_supply · line 864
Quoted 5 lines
drivers/power/supply/power_supply_core.c +1
-1@@ -861,44 +861,44 @@ const size_t power_supply_battery_info_properties_size = ARRAY_SIZE(power_supplyEXPORT_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.
Quoted 60 lines
drivers/power/supply/power_supply_core.c +23
-32{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 :drivers/power/supply/power_supply_core.c const size_t power_supply_battery_info_properties_size = ARRAY_SIZE(power_supply · line 902
Quoted 10 lines
drivers/power/supply/power_supply_core.c +9
-0+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.
Quoted 90 lines
drivers/power/supply/power_supply_core.c +37
-47}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 :drivers/power/supply/power_supply_core.c int power_supply_battery_info_get_prop(struct power_supply_battery_info *info, · line 963
Quoted 10 lines
drivers/power/supply/power_supply_core.c +10
-0+ 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.
drivers/power/supply/power_supply_core.c subsys_initcall(power_supply_class_init); · line 1642
Quoted 10 lines
drivers/power/supply/power_supply_core.c +3
-3@@ -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 <[email protected]>, " -"Szabolcs Gyurko, " -"Anton Vorontsov <[email protected]>" ); +MODULE_AUTHOR ("Ian Molton <[email protected]>" ); +MODULE_AUTHOR ("Szabolcs Gyurko" ); +MODULE_AUTHOR ("Anton Vorontsov <[email protected]>" );And also this one.
Quoted 4 lines
Thanks.
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Thanks
Quoted 22 lines · Charalampos Mitrodimas
Hi Bagas,
Quoted 17 lines · Bagas Sanjaya
Quoted 8 lines · Charalampos Mitrodimas
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 declarationsQuoted 7 lines
Based on this comment from "
include/linux/module.h", modules with multiple authors should use multipleMODULE_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)Quoted 1 line
Shouldn't
MODULE_AUTHORfix be separate patch?
Quoted 8 lines
Sorry, I should have mentioned in the commit that the warnings "quoted string split across lines" pertained to the
MODULE_AUTHORline.In the commit message I'm just clarifying why I used multiple
MODULE_AUTHORstatements.Should I send a v2 patch with a revised commit description?
OK but as separate patch.
Signature · 1 line
An old man doll... just what I always wanted! - Clara