lkml.org 
[lkml]   [2016]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 7/7] power_supply: make use of new strcpytoupper() function
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
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2016-07-23 02:41    [W:0.067 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site