[PATCH 1/2] leds: pca9532: correct shift computation in pca9532_getled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Each led occupies two bits in the register, so the required shift is
LED_NUM(id) * 2, exactly as in pca9532_setled. Furthermore, irrelevant
higher bits need to be masked appropriately.

The function is used to implement 'default-status = "keep"', which did
not work properly before.

Signed-off-by: Markus Moll <mmoll@xxxxxxxxxxxxxxxxxxxx>
---
 drivers/leds/leds-pca9532.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
index 7d515d5e57b..d822ffcdbae 100644
--- a/drivers/leds/leds-pca9532.c
+++ b/drivers/leds/leds-pca9532.c
@@ -260,7 +260,7 @@ static enum pca9532_state pca9532_getled(struct pca9532_led *led)

 mutex_lock(&data->update_lock);
 reg = i2c_smbus_read_byte_data(client, LED_REG(maxleds, led->id));
-ret = reg >> LED_NUM(led->id)/2;
+ret = (reg >> LED_NUM(led->id) * 2) & 0x3;
 mutex_unlock(&data->update_lock);
 return ret;
 }
--
2.25.1

i.A. Dr. Markus Moll
Pepperl+Fuchs SE
Geschäftsbereich VT-IVC
Lilienthalstraße 200
68307 Mannheim


Pepperl+Fuchs SE, Mannheim
Vorstände/Board members: Dr.-Ing. Gunther Kegel (Vors.), Werner Guthier (stellv. Vors.), Mehmet Hatiboglu
Vorsitzender des Aufsichtsrats/Chairman of the supervisory board: Michael Fuchs sen.
Registergericht/Register Court: AG Mannheim HRB 737016 - UST-ID Nr. DE 143877372


Wichtiger Hinweis:
Diese E-Mail einschliesslich ihrer Anhaenge enthaelt vertrauliche und rechtlich geschuetzte Informationen, die nur fuer den Adressaten bestimmt sind. Sollten Sie nicht der bezeichnete Adressat sein, so teilen Sie dies bitte dem Absender umgehend mit und loeschen Sie diese Nachricht und ihre Anhaenge. Die unbefugte Weitergabe, das Anfertigen von Kopien und jede Veraenderung der E-Mail ist untersagt. Der Absender haftet nicht fuer die Inhalte von veraenderten E-Mails.

Important Information:
This e-mail message including its attachments contains confidential and legally protected information solely intended for the addressee. If you are not the intended addressee of this message, please contact the addresser immediately and delete this message including its attachments. The unauthorized dissemination, copying and change of this e-mail are strictly forbidden. The addresser shall not be liable for the content of such changed e-mails.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux