public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: Markus Mayer <mmayer@broadcom.com>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 7/7] power_supply: make use of new strcpytoupper() function
Date: Sat, 23 Jul 2016 02:00:49 +0200	[thread overview]
Message-ID: <20160723000048.GB31677@earth> (raw)
In-Reply-To: <1469230269-1644-8-git-send-email-mmayer@broadcom.com>

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

Hi,

On Fri, Jul 22, 2016 at 04:31:09PM -0700, Markus Mayer wrote:
> Call strcpytoupper() rather than walking the string explicitly to
> convert it to uppercase.
> 
> Signed-off-by: Markus Mayer <mmayer@broadcom.com>
> ---
>  drivers/power/power_supply_sysfs.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
> index 80fed98..20fdcc5 100644
> --- a/drivers/power/power_supply_sysfs.c
> +++ b/drivers/power/power_supply_sysfs.c
> @@ -256,19 +256,16 @@ void power_supply_init_attrs(struct device_type *dev_type)
>  
>  static char *kstruprdup(const char *str, gfp_t gfp)
>  {
> -	char *ret, *ustr;
> +	char *ustr;
>  
> -	ustr = ret = kmalloc(strlen(str) + 1, gfp);
> +	ustr = kmalloc(strlen(str) + 1, gfp);
>  
> -	if (!ret)
> +	if (!ustr)
>  		return NULL;
>  
> -	while (*str)
> -		*ustr++ = toupper(*str++);
> +	strcpytoupper(ustr, str);
>  
> -	*ustr = 0;
> -
> -	return ret;
> +	return ustr;
>  }
>  
>  int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)

Acked-By: Sebastian Reichel <sre@kernel.org>

Note: I plan to merge [0] (Move power supply subsystem to
drivers/power/supply) directly after 4.8-rc1, which will
result in merge conflicts if this goes into the kernel via
some other subsystem.

[0] https://marc.info/?l=linux-pm&m=146617051028786&w=2

-- Sebastian

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

      reply	other threads:[~2016-07-23  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22 23:31 [PATCH v4 0/7] lib: string: add functions to case-convert strings Markus Mayer
     [not found] ` <1469230269-1644-1-git-send-email-mmayer-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2016-07-22 23:31   ` [PATCH v4 1/7] " Markus Mayer
2016-07-22 23:31 ` [PATCH v4 7/7] power_supply: make use of new strcpytoupper() function Markus Mayer
2016-07-23  0:00   ` Sebastian Reichel [this message]

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=20160723000048.GB31677@earth \
    --to=sre@kernel.org \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mmayer@broadcom.com \
    /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