diff options
author | Jose Manuel Alarcon Roldan <jose.alarcon.roldan@gmail.com> | 2014-09-07 14:25:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-09-07 18:21:13 -0400 |
commit | 257d6ef4aafa5078e469eb277dfd49841a736618 (patch) | |
tree | ef012101bd0475c6aa0c1507ed17388cdedda00b | |
parent | 77be4daf4e65eb1da70e6623ec61ecde62f5de95 (diff) |
Documentation: i2c: rename variable "register" to "reg"
The example code provided with the i2c device interface documentation
won't compile since it uses the reserved word "register" to name a
variable.
The compiler fails with this error message:
error: expected identifier or '(' before '=' token
__u8 register = 0x20; /* Device register to access */
^
Rename the variable "register" to simply "reg" in the example code.
Another couple of typos has been fixed as well.
[Change "! =" to "!=".]
Signed-off-by: Jose Alarcon Roldan <jose.alarcon.roldan@gmail.com>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | Documentation/i2c/dev-interface | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Documentation/i2c/dev-interface b/Documentation/i2c/dev-interface index 3e742ba25536..2ac78ae1039d 100644 --- a/Documentation/i2c/dev-interface +++ b/Documentation/i2c/dev-interface | |||
@@ -57,12 +57,12 @@ Well, you are all set up now. You can now use SMBus commands or plain | |||
57 | I2C to communicate with your device. SMBus commands are preferred if | 57 | I2C to communicate with your device. SMBus commands are preferred if |
58 | the device supports them. Both are illustrated below. | 58 | the device supports them. Both are illustrated below. |
59 | 59 | ||
60 | __u8 register = 0x10; /* Device register to access */ | 60 | __u8 reg = 0x10; /* Device register to access */ |
61 | __s32 res; | 61 | __s32 res; |
62 | char buf[10]; | 62 | char buf[10]; |
63 | 63 | ||
64 | /* Using SMBus commands */ | 64 | /* Using SMBus commands */ |
65 | res = i2c_smbus_read_word_data(file, register); | 65 | res = i2c_smbus_read_word_data(file, reg); |
66 | if (res < 0) { | 66 | if (res < 0) { |
67 | /* ERROR HANDLING: i2c transaction failed */ | 67 | /* ERROR HANDLING: i2c transaction failed */ |
68 | } else { | 68 | } else { |
@@ -70,11 +70,11 @@ the device supports them. Both are illustrated below. | |||
70 | } | 70 | } |
71 | 71 | ||
72 | /* Using I2C Write, equivalent of | 72 | /* Using I2C Write, equivalent of |
73 | i2c_smbus_write_word_data(file, register, 0x6543) */ | 73 | i2c_smbus_write_word_data(file, reg, 0x6543) */ |
74 | buf[0] = register; | 74 | buf[0] = reg; |
75 | buf[1] = 0x43; | 75 | buf[1] = 0x43; |
76 | buf[2] = 0x65; | 76 | buf[2] = 0x65; |
77 | if (write(file, buf, 3) ! =3) { | 77 | if (write(file, buf, 3) != 3) { |
78 | /* ERROR HANDLING: i2c transaction failed */ | 78 | /* ERROR HANDLING: i2c transaction failed */ |
79 | } | 79 | } |
80 | 80 | ||