lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK5ve-LD9ZsdmS+hRduDF8Uk+Evi_hTNK_0WSSrJwukGbiz=ng@mail.gmail.com>
Date:	Tue, 13 Aug 2013 13:59:29 -0700
From:	Bryan Wu <cooloney@...il.com>
To:	Milo Kim <woogyom.kim@...il.com>
Cc:	Pali Rohár <pali.rohar@...il.com>,
	Linux LED Subsystem <linux-leds@...r.kernel.org>,
	lkml <linux-kernel@...r.kernel.org>, Milo Kim <milo.kim@...com>
Subject: Re: [PATCH 08/10] leds: lp5523: remove unnecessary writing commands

On Thu, Aug 8, 2013 at 12:59 AM, Milo Kim <woogyom.kim@...il.com> wrote:
> This patch reduces the number of programming commands.
>
> (Count of sending commands)
> Old code: 32 + program size (32 counts for clearing program memory)
> New code: 32
>
> Pattern buffer is initialized to 0 in this function.
> Just update new program data and remaining buffers are filled with 0.
> So it's needless to clear whole area.
>

Good, but I guess we can share this code with lp5521.c, right?
Thanks,
-Bryan

> Signed-off-by: Milo Kim <milo.kim@...com>
> ---
>  drivers/leds/leds-lp5523.c |   14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
> index 9b8be6f6..fe3bcbb 100644
> --- a/drivers/leds/leds-lp5523.c
> +++ b/drivers/leds/leds-lp5523.c
> @@ -312,17 +312,11 @@ static int lp5523_update_program_memory(struct lp55xx_chip *chip,
>         u8 pattern[LP5523_PROGRAM_LENGTH] = {0};
>         unsigned cmd;
>         char c[3];
> -       int update_size;
>         int nrchars;
> -       int offset = 0;
>         int ret;
> -       int i;
> -
> -       /* clear program memory before updating */
> -       for (i = 0; i < LP5523_PROGRAM_LENGTH; i++)
> -               lp55xx_write(chip, LP5523_REG_PROG_MEM + i, 0);
> +       int offset = 0;
> +       int i = 0;
>
> -       i = 0;
>         while ((offset < size - 1) && (i < LP5523_PROGRAM_LENGTH)) {
>                 /* separate sscanfs because length is working only for %s */
>                 ret = sscanf(data + offset, "%2s%n ", c, &nrchars);
> @@ -342,11 +336,9 @@ static int lp5523_update_program_memory(struct lp55xx_chip *chip,
>         if (i % 2)
>                 goto err;
>
> -       update_size = i;
> -
>         mutex_lock(&chip->lock);
>
> -       for (i = 0; i < update_size; i++) {
> +       for (i = 0; i < LP5523_PROGRAM_LENGTH; i++) {
>                 ret = lp55xx_write(chip, LP5523_REG_PROG_MEM + i, pattern[i]);
>                 if (ret) {
>                         mutex_unlock(&chip->lock);
> --
> 1.7.9.5
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ