hwmon: Clean up detect functions
As kind is now hard-coded to -1, there is room for code clean-ups. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Corentin Labbe <corentin.labbe@geomatys.fr> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Riku Voipio <riku.voipio@iki.fi> Acked-by: "Hans J. Koch" <hjk@linutronix.de> Cc: Rudolf Marek <r.marek@assembler.cz>
Bu işleme şunda yer alıyor:
@@ -534,7 +534,7 @@ static int max6650_detect(struct i2c_client *client, int kind,
|
||||
struct i2c_adapter *adapter = client->adapter;
|
||||
int address = client->addr;
|
||||
|
||||
dev_dbg(&adapter->dev, "max6650_detect called, kind = %d\n", kind);
|
||||
dev_dbg(&adapter->dev, "max6650_detect called\n");
|
||||
|
||||
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
|
||||
dev_dbg(&adapter->dev, "max6650: I2C bus doesn't support "
|
||||
@@ -542,23 +542,7 @@ static int max6650_detect(struct i2c_client *client, int kind,
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now we do the remaining detection. A negative kind means that
|
||||
* the driver was loaded with no force parameter (default), so we
|
||||
* must both detect and identify the chip (actually there is only
|
||||
* one possible kind of chip for now, max6650). A zero kind means that
|
||||
* the driver was loaded with the force parameter, the detection
|
||||
* step shall be skipped. A positive kind means that the driver
|
||||
* was loaded with the force parameter and a given kind of chip is
|
||||
* requested, so both the detection and the identification steps
|
||||
* are skipped.
|
||||
*
|
||||
* Currently I can find no way to distinguish between a MAX6650 and
|
||||
* a MAX6651. This driver has only been tried on the former.
|
||||
*/
|
||||
|
||||
if ((kind < 0) &&
|
||||
( (i2c_smbus_read_byte_data(client, MAX6650_REG_CONFIG) & 0xC0)
|
||||
if (((i2c_smbus_read_byte_data(client, MAX6650_REG_CONFIG) & 0xC0)
|
||||
||(i2c_smbus_read_byte_data(client, MAX6650_REG_GPIO_STAT) & 0xE0)
|
||||
||(i2c_smbus_read_byte_data(client, MAX6650_REG_ALARM_EN) & 0xE0)
|
||||
||(i2c_smbus_read_byte_data(client, MAX6650_REG_ALARM) & 0xE0)
|
||||
|
Yeni konuda referans
Bir kullanıcı engelle