drivers/leds/leds-pca955x.c: fix race condition while setting brightness on several LEDs
drivers/leds/leds-pca955x.c: fix race condition while setting brightness on several LEDs

When issuing the following command:

  for I in 0 1 2 3 4 5 6 7; do
    echo 0 > /sys/class/leds/pca955x\:${I}/brightness;
  done

It is possible that all the pca955x_read_ls calls are done sequentially
before any pca955x_write_ls call is done.  This updates the LS only to
the last LED update in its set.

Fix this by using a global lock for the pca995x device during
pca955x_led_work.  Also used a struct for shared data betreen all LEDs.

[5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org: revert unintentional rename of pca955x_ledsel()]
Signed-off-by: Alexander Stein <dbef83f64948dc68aad31596bbf6991154a9d730@systec-electronic.com>
Cc: Richard Purdie <a03894c799ea916bd571ce8f12ed88f6fb3400f7@rpsys.net>
Cc: Bryan Wu <465f0e91e61585f5bc1128e7fe63296c33a56926@canonical.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas