Commit c2e90e9b authored by Jean Delvare's avatar Jean Delvare

ics932s401: Clean up detect function

As kind is now hard-coded to -1, there is room for code clean-ups.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Acked-by: default avatar"Darrick J. Wong" <djwong@us.ibm.com>
parent ccfbbd08
...@@ -417,32 +417,25 @@ static int ics932s401_detect(struct i2c_client *client, int kind, ...@@ -417,32 +417,25 @@ static int ics932s401_detect(struct i2c_client *client, int kind,
struct i2c_board_info *info) struct i2c_board_info *info)
{ {
struct i2c_adapter *adapter = client->adapter; struct i2c_adapter *adapter = client->adapter;
int vendor, device, revision;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -ENODEV; return -ENODEV;
if (kind <= 0) { vendor = i2c_smbus_read_word_data(client, ICS932S401_REG_VENDOR_REV);
int vendor, device, revision; vendor >>= 8;
revision = vendor >> ICS932S401_REV_SHIFT;
vendor = i2c_smbus_read_word_data(client, vendor &= ICS932S401_VENDOR_MASK;
ICS932S401_REG_VENDOR_REV); if (vendor != ICS932S401_VENDOR)
vendor >>= 8; return -ENODEV;
revision = vendor >> ICS932S401_REV_SHIFT;
vendor &= ICS932S401_VENDOR_MASK; device = i2c_smbus_read_word_data(client, ICS932S401_REG_DEVICE);
if (vendor != ICS932S401_VENDOR) device >>= 8;
return -ENODEV; if (device != ICS932S401_DEVICE)
return -ENODEV;
device = i2c_smbus_read_word_data(client,
ICS932S401_REG_DEVICE); if (revision != ICS932S401_REV)
device >>= 8; dev_info(&adapter->dev, "Unknown revision %d\n", revision);
if (device != ICS932S401_DEVICE)
return -ENODEV;
if (revision != ICS932S401_REV)
dev_info(&adapter->dev, "Unknown revision %d\n",
revision);
} else
dev_dbg(&adapter->dev, "detection forced\n");
strlcpy(info->type, "ics932s401", I2C_NAME_SIZE); strlcpy(info->type, "ics932s401", I2C_NAME_SIZE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment