aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-core.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2015-07-17 06:43:22 -0400
committerWolfram Sang <wsa@the-dreams.de>2015-08-24 08:05:12 -0400
commit66be6056eba80690bb7fa3d983c21494e1950bea (patch)
tree4973b21f4f99740b8920360d892a565858453918 /drivers/i2c/i2c-core.c
parentda899f55b359225f85e154765baaddb13ec436ca (diff)
i2c: rename address check functions
The current naming is based on the arguments of the functions and not on what they do. Even I as the maintainer find this confusing, so let's rename them to something more descriptive. Tested-by: Andrey Danin <danindrey@mail.ru> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r--drivers/i2c/i2c-core.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 47dbe2514741..fced494040a8 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -798,7 +798,7 @@ static unsigned short i2c_encode_flags_to_addr(struct i2c_client *client)
798 798
799/* This is a permissive address validity check, I2C address map constraints 799/* This is a permissive address validity check, I2C address map constraints
800 * are purposely not enforced, except for the general call address. */ 800 * are purposely not enforced, except for the general call address. */
801static int i2c_check_client_addr_validity(const struct i2c_client *client) 801static int i2c_check_addr_validity(const struct i2c_client *client)
802{ 802{
803 if (client->flags & I2C_CLIENT_TEN) { 803 if (client->flags & I2C_CLIENT_TEN) {
804 /* 10-bit address, all values are valid */ 804 /* 10-bit address, all values are valid */
@@ -816,7 +816,7 @@ static int i2c_check_client_addr_validity(const struct i2c_client *client)
816 * device uses a reserved address, then it shouldn't be probed. 7-bit 816 * device uses a reserved address, then it shouldn't be probed. 7-bit
817 * addressing is assumed, 10-bit address devices are rare and should be 817 * addressing is assumed, 10-bit address devices are rare and should be
818 * explicitly enumerated. */ 818 * explicitly enumerated. */
819static int i2c_check_addr_validity(unsigned short addr) 819static int i2c_check_7bit_addr_validity_strict(unsigned short addr)
820{ 820{
821 /* 821 /*
822 * Reserved addresses per I2C specification: 822 * Reserved addresses per I2C specification:
@@ -985,7 +985,7 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
985 strlcpy(client->name, info->type, sizeof(client->name)); 985 strlcpy(client->name, info->type, sizeof(client->name));
986 986
987 /* Check for address validity */ 987 /* Check for address validity */
988 status = i2c_check_client_addr_validity(client); 988 status = i2c_check_addr_validity(client);
989 if (status) { 989 if (status) {
990 dev_err(&adap->dev, "Invalid %d-bit I2C address 0x%02hx\n", 990 dev_err(&adap->dev, "Invalid %d-bit I2C address 0x%02hx\n",
991 client->flags & I2C_CLIENT_TEN ? 10 : 7, client->addr); 991 client->flags & I2C_CLIENT_TEN ? 10 : 7, client->addr);
@@ -2296,7 +2296,7 @@ static int i2c_detect_address(struct i2c_client *temp_client,
2296 int err; 2296 int err;
2297 2297
2298 /* Make sure the address is valid */ 2298 /* Make sure the address is valid */
2299 err = i2c_check_addr_validity(addr); 2299 err = i2c_check_7bit_addr_validity_strict(addr);
2300 if (err) { 2300 if (err) {
2301 dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n", 2301 dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n",
2302 addr); 2302 addr);
@@ -2413,7 +2413,7 @@ i2c_new_probed_device(struct i2c_adapter *adap,
2413 2413
2414 for (i = 0; addr_list[i] != I2C_CLIENT_END; i++) { 2414 for (i = 0; addr_list[i] != I2C_CLIENT_END; i++) {
2415 /* Check address validity */ 2415 /* Check address validity */
2416 if (i2c_check_addr_validity(addr_list[i]) < 0) { 2416 if (i2c_check_7bit_addr_validity_strict(addr_list[i]) < 0) {
2417 dev_warn(&adap->dev, "Invalid 7-bit address " 2417 dev_warn(&adap->dev, "Invalid 7-bit address "
2418 "0x%02x\n", addr_list[i]); 2418 "0x%02x\n", addr_list[i]);
2419 continue; 2419 continue;
@@ -2997,7 +2997,7 @@ int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb)
2997 2997
2998 if (!(client->flags & I2C_CLIENT_TEN)) { 2998 if (!(client->flags & I2C_CLIENT_TEN)) {
2999 /* Enforce stricter address checking */ 2999 /* Enforce stricter address checking */
3000 ret = i2c_check_addr_validity(client->addr); 3000 ret = i2c_check_7bit_addr_validity_strict(client->addr);
3001 if (ret) { 3001 if (ret) {
3002 dev_err(&client->dev, "%s: invalid address\n", __func__); 3002 dev_err(&client->dev, "%s: invalid address\n", __func__);
3003 return ret; 3003 return ret;