Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i2c: Rename i2c_check_addr to i2c_check_addr_busy

Otherwise it's not clear what it is checking.

Also move the function to save a forward declaration.

Signed-off-by: Jean Delvare <khali@linux-fr.org>

+19 -19
+19 -19
drivers/i2c/i2c-core.c
··· 47 47 static DEFINE_IDR(i2c_adapter_idr); 48 48 49 49 static struct device_type i2c_client_type; 50 - static int i2c_check_addr(struct i2c_adapter *adapter, int addr); 51 50 static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver); 52 51 53 52 /* ------------------------------------------------------------------------- */ ··· 407 408 return 0; 408 409 } 409 410 411 + static int __i2c_check_addr_busy(struct device *dev, void *addrp) 412 + { 413 + struct i2c_client *client = i2c_verify_client(dev); 414 + int addr = *(int *)addrp; 415 + 416 + if (client && client->addr == addr) 417 + return -EBUSY; 418 + return 0; 419 + } 420 + 421 + static int i2c_check_addr_busy(struct i2c_adapter *adapter, int addr) 422 + { 423 + return device_for_each_child(&adapter->dev, &addr, 424 + __i2c_check_addr_busy); 425 + } 426 + 410 427 /** 411 428 * i2c_new_device - instantiate an i2c device 412 429 * @adap: the adapter managing the device ··· 471 456 } 472 457 473 458 /* Check for address business */ 474 - status = i2c_check_addr(adap, client->addr); 459 + status = i2c_check_addr_busy(adap, client->addr); 475 460 if (status) 476 461 goto out_err; 477 462 ··· 1079 1064 1080 1065 /* ------------------------------------------------------------------------- */ 1081 1066 1082 - static int __i2c_check_addr(struct device *dev, void *addrp) 1083 - { 1084 - struct i2c_client *client = i2c_verify_client(dev); 1085 - int addr = *(int *)addrp; 1086 - 1087 - if (client && client->addr == addr) 1088 - return -EBUSY; 1089 - return 0; 1090 - } 1091 - 1092 - static int i2c_check_addr(struct i2c_adapter *adapter, int addr) 1093 - { 1094 - return device_for_each_child(&adapter->dev, &addr, __i2c_check_addr); 1095 - } 1096 - 1097 1067 /** 1098 1068 * i2c_use_client - increments the reference count of the i2c client structure 1099 1069 * @client: the client being referenced ··· 1369 1369 } 1370 1370 1371 1371 /* Skip if already in use */ 1372 - if (i2c_check_addr(adapter, addr)) 1372 + if (i2c_check_addr_busy(adapter, addr)) 1373 1373 return 0; 1374 1374 1375 1375 /* Make sure there is something at this address */ ··· 1475 1475 } 1476 1476 1477 1477 /* Check address availability */ 1478 - if (i2c_check_addr(adap, addr_list[i])) { 1478 + if (i2c_check_addr_busy(adap, addr_list[i])) { 1479 1479 dev_dbg(&adap->dev, "Address 0x%02x already in " 1480 1480 "use, not probing\n", addr_list[i]); 1481 1481 continue;