linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH v3 04/11] power: supply: core: reduce power_supply_show_usb_type() parameters
Date: Fri, 1 May 2020 14:36:26 +0200	[thread overview]
Message-ID: <20200501123626.nwxd2pzhwstu2rb3@earth.universe> (raw)
In-Reply-To: <16ca50739c664b3fa373306f3c08882d9d4cf55d.1585944770.git.mirq-linux@rere.qmqm.pl>

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

Hi,

On Fri, Apr 03, 2020 at 10:20:32PM +0200, Michał Mirosław wrote:
> Reduce power_supply_show_usb_type() parameter count by folding
> power_supply_desc dereference into the function.  This makes following
> patch making usb_types const easier.
> 
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/power_supply_sysfs.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
> index f37ad4eae60b..51de3f47b25d 100644
> --- a/drivers/power/supply/power_supply_sysfs.c
> +++ b/drivers/power/supply/power_supply_sysfs.c
> @@ -78,8 +78,7 @@ static const char * const power_supply_scope_text[] = {
>  };
>  
>  static ssize_t power_supply_show_usb_type(struct device *dev,
> -					  enum power_supply_usb_type *usb_types,
> -					  ssize_t num_usb_types,
> +					  const struct power_supply_desc *desc,
>  					  union power_supply_propval *value,
>  					  char *buf)
>  {
> @@ -88,8 +87,8 @@ static ssize_t power_supply_show_usb_type(struct device *dev,
>  	bool match = false;
>  	int i;
>  
> -	for (i = 0; i < num_usb_types; ++i) {
> -		usb_type = usb_types[i];
> +	for (i = 0; i < desc->num_usb_types; ++i) {
> +		usb_type = desc->usb_types[i];
>  
>  		if (value->intval == usb_type) {
>  			count += sprintf(buf + count, "[%s] ",
> @@ -163,8 +162,7 @@ static ssize_t power_supply_show_property(struct device *dev,
>  			      power_supply_type_text[value.intval]);
>  		break;
>  	case POWER_SUPPLY_PROP_USB_TYPE:
> -		ret = power_supply_show_usb_type(dev, psy->desc->usb_types,
> -						 psy->desc->num_usb_types,
> +		ret = power_supply_show_usb_type(dev, psy->desc,
>  						 &value, buf);
>  		break;
>  	case POWER_SUPPLY_PROP_SCOPE:
> -- 
> 2.20.1
> 

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

  reply	other threads:[~2020-05-01 12:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 20:20 [PATCH v3 00/11] extensions and fixes Michał Mirosław
2020-04-03 20:20 ` [PATCH v3 01/11] power: charger-manager: remove duplicate assignment Michał Mirosław
2020-04-03 20:20 ` [PATCH v3 03/11] power: generic-adc-battery: fold psy_props[] to private data Michał Mirosław
2020-04-03 20:20 ` [PATCH v3 02/11] power: charger-manager: don't write through desc->properties Michał Mirosław
2020-05-01 12:38   ` Sebastian Reichel
2020-05-01 13:30     ` Michał Mirosław
2020-05-01 13:39       ` [PATCH] power: charger-manager: fix adding of optional properties Michał Mirosław
2020-05-01 13:51         ` Sebastian Reichel
2020-05-01 14:15           ` Michał Mirosław
2020-05-01 14:30           ` [PATCH] power: charger-manager: clarify num_properties starting value Michał Mirosław
2020-05-01 14:58             ` Sebastian Reichel
2020-05-01 13:48       ` [PATCH v3 02/11] power: charger-manager: don't write through desc->properties Sebastian Reichel
2020-04-03 20:20 ` [PATCH v3 05/11] power: supply: core: allow to constify property lists Michał Mirosław
2020-05-01 12:36   ` Sebastian Reichel
2020-04-03 20:20 ` [PATCH v3 04/11] power: supply: core: reduce power_supply_show_usb_type() parameters Michał Mirosław
2020-05-01 12:36   ` Sebastian Reichel [this message]
2020-04-03 20:20 ` [PATCH v3 06/11] power: supply: core: fix HWMON temperature labels Michał Mirosław
2020-05-01 12:39   ` Sebastian Reichel
2020-04-03 20:20 ` [PATCH v3 07/11] power: supply: core: tabularize " Michał Mirosław
2020-04-05  1:52   ` kbuild test robot
2020-04-07 18:13     ` Nick Desaulniers
2020-04-07 19:55       ` Michał Mirosław
2020-04-07 19:57         ` Nick Desaulniers
2020-04-07 22:31           ` Nick Desaulniers
2020-04-20  9:22       ` Michał Mirosław
2020-05-01 12:47         ` Sebastian Reichel
2020-04-03 20:20 ` [PATCH v3 08/11] power: supply: core: hide unused HWMON labels Michał Mirosław
2020-05-01 13:22   ` Sebastian Reichel
2020-04-03 20:20 ` [PATCH v3 09/11] power: supply: core: add input voltage/current measurements Michał Mirosław
2020-04-03 20:20 ` [PATCH v3 10/11] power: supply: core: add output voltage measurements Michał Mirosław
2020-04-03 20:20 ` [PATCH v3 11/11] power: supply: core: document measurement points Michał Mirosław

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=20200501123626.nwxd2pzhwstu2rb3@earth.universe \
    --to=sebastian.reichel@collabora.com \
    --cc=andrew.smirnov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mirq-linux@rere.qmqm.pl \
    /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).