diff options
author | Farid Hammane <farid.hammane@gmail.com> | 2010-05-21 12:40:58 -0400 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2010-05-21 12:40:58 -0400 |
commit | 7225acf4aa2855787184af92febedd92284776ee (patch) | |
tree | edaf777d72d061fccec217884ff856672dccedb5 /drivers/i2c | |
parent | b8680784875b26a2876df5959673a496d56af673 (diff) |
i2c-core: Fix some coding style issues
Fix up coding style issues found by the checkpatch.pl tool.
Signed-off-by: Farid Hammane <farid.hammane@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 7c469a62c3c1..db3c9f3a7647 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1221,10 +1221,10 @@ EXPORT_SYMBOL(i2c_transfer); | |||
1221 | * | 1221 | * |
1222 | * Returns negative errno, or else the number of bytes written. | 1222 | * Returns negative errno, or else the number of bytes written. |
1223 | */ | 1223 | */ |
1224 | int i2c_master_send(struct i2c_client *client,const char *buf ,int count) | 1224 | int i2c_master_send(struct i2c_client *client, const char *buf, int count) |
1225 | { | 1225 | { |
1226 | int ret; | 1226 | int ret; |
1227 | struct i2c_adapter *adap=client->adapter; | 1227 | struct i2c_adapter *adap = client->adapter; |
1228 | struct i2c_msg msg; | 1228 | struct i2c_msg msg; |
1229 | 1229 | ||
1230 | msg.addr = client->addr; | 1230 | msg.addr = client->addr; |
@@ -1248,9 +1248,9 @@ EXPORT_SYMBOL(i2c_master_send); | |||
1248 | * | 1248 | * |
1249 | * Returns negative errno, or else the number of bytes read. | 1249 | * Returns negative errno, or else the number of bytes read. |
1250 | */ | 1250 | */ |
1251 | int i2c_master_recv(struct i2c_client *client, char *buf ,int count) | 1251 | int i2c_master_recv(struct i2c_client *client, char *buf, int count) |
1252 | { | 1252 | { |
1253 | struct i2c_adapter *adap=client->adapter; | 1253 | struct i2c_adapter *adap = client->adapter; |
1254 | struct i2c_msg msg; | 1254 | struct i2c_msg msg; |
1255 | int ret; | 1255 | int ret; |
1256 | 1256 | ||
@@ -1452,7 +1452,7 @@ i2c_new_probed_device(struct i2c_adapter *adap, | |||
1452 | } | 1452 | } |
1453 | EXPORT_SYMBOL_GPL(i2c_new_probed_device); | 1453 | EXPORT_SYMBOL_GPL(i2c_new_probed_device); |
1454 | 1454 | ||
1455 | struct i2c_adapter* i2c_get_adapter(int id) | 1455 | struct i2c_adapter *i2c_get_adapter(int id) |
1456 | { | 1456 | { |
1457 | struct i2c_adapter *adapter; | 1457 | struct i2c_adapter *adapter; |
1458 | 1458 | ||
@@ -1479,7 +1479,7 @@ static u8 crc8(u16 data) | |||
1479 | { | 1479 | { |
1480 | int i; | 1480 | int i; |
1481 | 1481 | ||
1482 | for(i = 0; i < 8; i++) { | 1482 | for (i = 0; i < 8; i++) { |
1483 | if (data & 0x8000) | 1483 | if (data & 0x8000) |
1484 | data = data ^ POLY; | 1484 | data = data ^ POLY; |
1485 | data = data << 1; | 1485 | data = data << 1; |
@@ -1492,7 +1492,7 @@ static u8 i2c_smbus_pec(u8 crc, u8 *p, size_t count) | |||
1492 | { | 1492 | { |
1493 | int i; | 1493 | int i; |
1494 | 1494 | ||
1495 | for(i = 0; i < count; i++) | 1495 | for (i = 0; i < count; i++) |
1496 | crc = crc8((crc ^ p[i]) << 8); | 1496 | crc = crc8((crc ^ p[i]) << 8); |
1497 | return crc; | 1497 | return crc; |
1498 | } | 1498 | } |
@@ -1562,7 +1562,7 @@ EXPORT_SYMBOL(i2c_smbus_read_byte); | |||
1562 | */ | 1562 | */ |
1563 | s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value) | 1563 | s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value) |
1564 | { | 1564 | { |
1565 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, | 1565 | return i2c_smbus_xfer(client->adapter, client->addr, client->flags, |
1566 | I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL); | 1566 | I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL); |
1567 | } | 1567 | } |
1568 | EXPORT_SYMBOL(i2c_smbus_write_byte); | 1568 | EXPORT_SYMBOL(i2c_smbus_write_byte); |
@@ -1600,9 +1600,9 @@ s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value) | |||
1600 | { | 1600 | { |
1601 | union i2c_smbus_data data; | 1601 | union i2c_smbus_data data; |
1602 | data.byte = value; | 1602 | data.byte = value; |
1603 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, | 1603 | return i2c_smbus_xfer(client->adapter, client->addr, client->flags, |
1604 | I2C_SMBUS_WRITE,command, | 1604 | I2C_SMBUS_WRITE, command, |
1605 | I2C_SMBUS_BYTE_DATA,&data); | 1605 | I2C_SMBUS_BYTE_DATA, &data); |
1606 | } | 1606 | } |
1607 | EXPORT_SYMBOL(i2c_smbus_write_byte_data); | 1607 | EXPORT_SYMBOL(i2c_smbus_write_byte_data); |
1608 | 1608 | ||
@@ -1639,9 +1639,9 @@ s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) | |||
1639 | { | 1639 | { |
1640 | union i2c_smbus_data data; | 1640 | union i2c_smbus_data data; |
1641 | data.word = value; | 1641 | data.word = value; |
1642 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, | 1642 | return i2c_smbus_xfer(client->adapter, client->addr, client->flags, |
1643 | I2C_SMBUS_WRITE,command, | 1643 | I2C_SMBUS_WRITE, command, |
1644 | I2C_SMBUS_WORD_DATA,&data); | 1644 | I2C_SMBUS_WORD_DATA, &data); |
1645 | } | 1645 | } |
1646 | EXPORT_SYMBOL(i2c_smbus_write_word_data); | 1646 | EXPORT_SYMBOL(i2c_smbus_write_word_data); |
1647 | 1647 | ||
@@ -1718,9 +1718,9 @@ s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, | |||
1718 | length = I2C_SMBUS_BLOCK_MAX; | 1718 | length = I2C_SMBUS_BLOCK_MAX; |
1719 | data.block[0] = length; | 1719 | data.block[0] = length; |
1720 | memcpy(&data.block[1], values, length); | 1720 | memcpy(&data.block[1], values, length); |
1721 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, | 1721 | return i2c_smbus_xfer(client->adapter, client->addr, client->flags, |
1722 | I2C_SMBUS_WRITE,command, | 1722 | I2C_SMBUS_WRITE, command, |
1723 | I2C_SMBUS_BLOCK_DATA,&data); | 1723 | I2C_SMBUS_BLOCK_DATA, &data); |
1724 | } | 1724 | } |
1725 | EXPORT_SYMBOL(i2c_smbus_write_block_data); | 1725 | EXPORT_SYMBOL(i2c_smbus_write_block_data); |
1726 | 1726 | ||
@@ -1762,10 +1762,10 @@ EXPORT_SYMBOL(i2c_smbus_write_i2c_block_data); | |||
1762 | 1762 | ||
1763 | /* Simulate a SMBus command using the i2c protocol | 1763 | /* Simulate a SMBus command using the i2c protocol |
1764 | No checking of parameters is done! */ | 1764 | No checking of parameters is done! */ |
1765 | static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | 1765 | static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr, |
1766 | unsigned short flags, | 1766 | unsigned short flags, |
1767 | char read_write, u8 command, int size, | 1767 | char read_write, u8 command, int size, |
1768 | union i2c_smbus_data * data) | 1768 | union i2c_smbus_data *data) |
1769 | { | 1769 | { |
1770 | /* So we need to generate a series of msgs. In the case of writing, we | 1770 | /* So we need to generate a series of msgs. In the case of writing, we |
1771 | need to use only one message; when reading, we need two. We initialize | 1771 | need to use only one message; when reading, we need two. We initialize |
@@ -1773,7 +1773,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1773 | simpler. */ | 1773 | simpler. */ |
1774 | unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3]; | 1774 | unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3]; |
1775 | unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2]; | 1775 | unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2]; |
1776 | int num = read_write == I2C_SMBUS_READ?2:1; | 1776 | int num = read_write == I2C_SMBUS_READ ? 2 : 1; |
1777 | struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, | 1777 | struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, |
1778 | { addr, flags | I2C_M_RD, 0, msgbuf1 } | 1778 | { addr, flags | I2C_M_RD, 0, msgbuf1 } |
1779 | }; | 1779 | }; |
@@ -1782,7 +1782,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1782 | int status; | 1782 | int status; |
1783 | 1783 | ||
1784 | msgbuf0[0] = command; | 1784 | msgbuf0[0] = command; |
1785 | switch(size) { | 1785 | switch (size) { |
1786 | case I2C_SMBUS_QUICK: | 1786 | case I2C_SMBUS_QUICK: |
1787 | msg[0].len = 0; | 1787 | msg[0].len = 0; |
1788 | /* Special case: The read/write field is used as data */ | 1788 | /* Special case: The read/write field is used as data */ |
@@ -1809,7 +1809,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1809 | if (read_write == I2C_SMBUS_READ) | 1809 | if (read_write == I2C_SMBUS_READ) |
1810 | msg[1].len = 2; | 1810 | msg[1].len = 2; |
1811 | else { | 1811 | else { |
1812 | msg[0].len=3; | 1812 | msg[0].len = 3; |
1813 | msgbuf0[1] = data->word & 0xff; | 1813 | msgbuf0[1] = data->word & 0xff; |
1814 | msgbuf0[2] = data->word >> 8; | 1814 | msgbuf0[2] = data->word >> 8; |
1815 | } | 1815 | } |
@@ -1902,26 +1902,26 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1902 | } | 1902 | } |
1903 | 1903 | ||
1904 | if (read_write == I2C_SMBUS_READ) | 1904 | if (read_write == I2C_SMBUS_READ) |
1905 | switch(size) { | 1905 | switch (size) { |
1906 | case I2C_SMBUS_BYTE: | 1906 | case I2C_SMBUS_BYTE: |
1907 | data->byte = msgbuf0[0]; | 1907 | data->byte = msgbuf0[0]; |
1908 | break; | 1908 | break; |
1909 | case I2C_SMBUS_BYTE_DATA: | 1909 | case I2C_SMBUS_BYTE_DATA: |
1910 | data->byte = msgbuf1[0]; | 1910 | data->byte = msgbuf1[0]; |
1911 | break; | 1911 | break; |
1912 | case I2C_SMBUS_WORD_DATA: | 1912 | case I2C_SMBUS_WORD_DATA: |
1913 | case I2C_SMBUS_PROC_CALL: | 1913 | case I2C_SMBUS_PROC_CALL: |
1914 | data->word = msgbuf1[0] | (msgbuf1[1] << 8); | 1914 | data->word = msgbuf1[0] | (msgbuf1[1] << 8); |
1915 | break; | 1915 | break; |
1916 | case I2C_SMBUS_I2C_BLOCK_DATA: | 1916 | case I2C_SMBUS_I2C_BLOCK_DATA: |
1917 | for (i = 0; i < data->block[0]; i++) | 1917 | for (i = 0; i < data->block[0]; i++) |
1918 | data->block[i+1] = msgbuf1[i]; | 1918 | data->block[i+1] = msgbuf1[i]; |
1919 | break; | 1919 | break; |
1920 | case I2C_SMBUS_BLOCK_DATA: | 1920 | case I2C_SMBUS_BLOCK_DATA: |
1921 | case I2C_SMBUS_BLOCK_PROC_CALL: | 1921 | case I2C_SMBUS_BLOCK_PROC_CALL: |
1922 | for (i = 0; i < msgbuf1[0] + 1; i++) | 1922 | for (i = 0; i < msgbuf1[0] + 1; i++) |
1923 | data->block[i] = msgbuf1[i]; | 1923 | data->block[i] = msgbuf1[i]; |
1924 | break; | 1924 | break; |
1925 | } | 1925 | } |
1926 | return 0; | 1926 | return 0; |
1927 | } | 1927 | } |
@@ -1966,7 +1966,7 @@ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, unsigned short flags, | |||
1966 | } | 1966 | } |
1967 | rt_mutex_unlock(&adapter->bus_lock); | 1967 | rt_mutex_unlock(&adapter->bus_lock); |
1968 | } else | 1968 | } else |
1969 | res = i2c_smbus_xfer_emulated(adapter,addr,flags,read_write, | 1969 | res = i2c_smbus_xfer_emulated(adapter, addr, flags, read_write, |
1970 | command, protocol, data); | 1970 | command, protocol, data); |
1971 | 1971 | ||
1972 | return res; | 1972 | return res; |