linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: pca953x: Use correct u16 value for register word write
@ 2016-03-29  6:27 Yong Li
  2016-03-29 12:06 ` Phil Reid
  0 siblings, 1 reply; 8+ messages in thread
From: Yong Li @ 2016-03-29  6:27 UTC (permalink / raw)
  To: sdliyong, linus.walleij, gnurou, linux-gpio, linux-kernel

The current implementation only uses the first byte in *val,
the second data is always 0. Change it to *(u16 *)val
to write the two bytes into the register

Signed-off-by: Yong Li <sdliyong@gmail.com>
---
 drivers/gpio/gpio-pca953x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index d0d3065..cf3d410 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -159,7 +159,7 @@ static int pca953x_write_regs(struct pca953x_chip *chip, int reg, u8 *val)
 		switch (chip->chip_type) {
 		case PCA953X_TYPE:
 			ret = i2c_smbus_write_word_data(chip->client,
-							reg << 1, (u16) *val);
+							reg << 1, *(u16 *)val);
 			break;
 		case PCA957X_TYPE:
 			ret = i2c_smbus_write_byte_data(chip->client, reg << 1,
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-03-30  5:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-29  6:27 [PATCH] gpio: pca953x: Use correct u16 value for register word write Yong Li
2016-03-29 12:06 ` Phil Reid
2016-03-29 12:53   ` Yong Li
2016-03-29 14:39     ` Alexander Stein
2016-03-29 16:33       ` Phil Reid
2016-03-30  2:46         ` Yong Li
     [not found]         ` <CADO9-pdxpQRQQ8RFtjT6rz28GteL3u+at0EGVdNwG8VV48SGEw@mail.gmail.com>
2016-03-30  5:01           ` Yong Li
2016-03-30  5:14             ` Phil Reid

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).