Skip to content

Commit 66be605

Browse files
Wolfram SangWolfram Sang
authored andcommitted
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>
1 parent da899f5 commit 66be605

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/i2c/i2c-core.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ static unsigned short i2c_encode_flags_to_addr(struct i2c_client *client)
798798

799799
/* This is a permissive address validity check, I2C address map constraints
800800
* are purposely not enforced, except for the general call address. */
801-
static int i2c_check_client_addr_validity(const struct i2c_client *client)
801+
static int i2c_check_addr_validity(const struct i2c_client *client)
802802
{
803803
if (client->flags & I2C_CLIENT_TEN) {
804804
/* 10-bit address, all values are valid */
@@ -816,7 +816,7 @@ static int i2c_check_client_addr_validity(const struct i2c_client *client)
816816
* device uses a reserved address, then it shouldn't be probed. 7-bit
817817
* addressing is assumed, 10-bit address devices are rare and should be
818818
* explicitly enumerated. */
819-
static int i2c_check_addr_validity(unsigned short addr)
819+
static int i2c_check_7bit_addr_validity_strict(unsigned short addr)
820820
{
821821
/*
822822
* Reserved addresses per I2C specification:
@@ -985,7 +985,7 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
985985
strlcpy(client->name, info->type, sizeof(client->name));
986986

987987
/* Check for address validity */
988-
status = i2c_check_client_addr_validity(client);
988+
status = i2c_check_addr_validity(client);
989989
if (status) {
990990
dev_err(&adap->dev, "Invalid %d-bit I2C address 0x%02hx\n",
991991
client->flags & I2C_CLIENT_TEN ? 10 : 7, client->addr);
@@ -2296,7 +2296,7 @@ static int i2c_detect_address(struct i2c_client *temp_client,
22962296
int err;
22972297

22982298
/* Make sure the address is valid */
2299-
err = i2c_check_addr_validity(addr);
2299+
err = i2c_check_7bit_addr_validity_strict(addr);
23002300
if (err) {
23012301
dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n",
23022302
addr);
@@ -2413,7 +2413,7 @@ i2c_new_probed_device(struct i2c_adapter *adap,
24132413

24142414
for (i = 0; addr_list[i] != I2C_CLIENT_END; i++) {
24152415
/* 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) {
24172417
dev_warn(&adap->dev, "Invalid 7-bit address "
24182418
"0x%02x\n", addr_list[i]);
24192419
continue;
@@ -2997,7 +2997,7 @@ int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb)
29972997

29982998
if (!(client->flags & I2C_CLIENT_TEN)) {
29992999
/* Enforce stricter address checking */
3000-
ret = i2c_check_addr_validity(client->addr);
3000+
ret = i2c_check_7bit_addr_validity_strict(client->addr);
30013001
if (ret) {
30023002
dev_err(&client->dev, "%s: invalid address\n", __func__);
30033003
return ret;

0 commit comments

Comments
 (0)