Commit f8d9d3b4 authored by Matt Ranostay's avatar Matt Ranostay Committed by Jonathan Cameron

iio: convert to common i2c_check_functionality() return value

Previously most drivers that used a i2c_check_functionality() check
condition required various error codes on failure. This patchset
converts to a standard of -EOPNOTSUPP
Signed-off-by: default avatarMatt Ranostay <mranostay@gmail.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 33da559f
...@@ -339,7 +339,7 @@ static int mcp3422_probe(struct i2c_client *client, ...@@ -339,7 +339,7 @@ static int mcp3422_probe(struct i2c_client *client,
u8 config; u8 config;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
return -ENODEV; return -EOPNOTSUPP;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*adc)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*adc));
if (!indio_dev) if (!indio_dev)
......
...@@ -73,7 +73,7 @@ static int adc081c_probe(struct i2c_client *client, ...@@ -73,7 +73,7 @@ static int adc081c_probe(struct i2c_client *client,
int err; int err;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA))
return -ENODEV; return -EOPNOTSUPP;
iio = devm_iio_device_alloc(&client->dev, sizeof(*adc)); iio = devm_iio_device_alloc(&client->dev, sizeof(*adc));
if (!iio) if (!iio)
......
...@@ -249,7 +249,7 @@ static int vz89x_probe(struct i2c_client *client, ...@@ -249,7 +249,7 @@ static int vz89x_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BYTE)) I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BYTE))
data->xfer = vz89x_smbus_xfer; data->xfer = vz89x_smbus_xfer;
else else
return -ENOTSUPP; return -EOPNOTSUPP;
i2c_set_clientdata(client, indio_dev); i2c_set_clientdata(client, indio_dev);
data->client = client; data->client = client;
......
...@@ -274,7 +274,7 @@ static int hdc100x_probe(struct i2c_client *client, ...@@ -274,7 +274,7 @@ static int hdc100x_probe(struct i2c_client *client,
if (!i2c_check_functionality(client->adapter, if (!i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BYTE)) I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BYTE))
return -ENODEV; return -EOPNOTSUPP;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
if (!indio_dev) if (!indio_dev)
......
...@@ -192,7 +192,7 @@ static int htu21_probe(struct i2c_client *client, ...@@ -192,7 +192,7 @@ static int htu21_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
dev_err(&client->dev, dev_err(&client->dev,
"Adapter does not support some i2c transaction\n"); "Adapter does not support some i2c transaction\n");
return -ENODEV; return -EOPNOTSUPP;
} }
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*dev_data)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*dev_data));
......
...@@ -135,7 +135,7 @@ static int si7005_probe(struct i2c_client *client, ...@@ -135,7 +135,7 @@ static int si7005_probe(struct i2c_client *client,
int ret; int ret;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA))
return -ENODEV; return -EOPNOTSUPP;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
if (!indio_dev) if (!indio_dev)
......
...@@ -121,7 +121,7 @@ static int si7020_probe(struct i2c_client *client, ...@@ -121,7 +121,7 @@ static int si7020_probe(struct i2c_client *client,
if (!i2c_check_functionality(client->adapter, if (!i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_WRITE_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE |
I2C_FUNC_SMBUS_READ_WORD_DATA)) I2C_FUNC_SMBUS_READ_WORD_DATA))
return -ENODEV; return -EOPNOTSUPP;
/* Reset device, loads default settings. */ /* Reset device, loads default settings. */
ret = i2c_smbus_write_byte(client, SI7020CMD_RESET); ret = i2c_smbus_write_byte(client, SI7020CMD_RESET);
......
...@@ -121,7 +121,7 @@ static int inv_mpu_probe(struct i2c_client *client, ...@@ -121,7 +121,7 @@ static int inv_mpu_probe(struct i2c_client *client,
if (!i2c_check_functionality(client->adapter, if (!i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_I2C_BLOCK)) I2C_FUNC_SMBUS_I2C_BLOCK))
return -ENOSYS; return -EOPNOTSUPP;
regmap = devm_regmap_init_i2c(client, &inv_mpu_regmap_config); regmap = devm_regmap_init_i2c(client, &inv_mpu_regmap_config);
if (IS_ERR(regmap)) { if (IS_ERR(regmap)) {
......
...@@ -241,7 +241,7 @@ static int bh1750_probe(struct i2c_client *client, ...@@ -241,7 +241,7 @@ static int bh1750_probe(struct i2c_client *client,
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C |
I2C_FUNC_SMBUS_WRITE_BYTE)) I2C_FUNC_SMBUS_WRITE_BYTE))
return -ENODEV; return -EOPNOTSUPP;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
if (!indio_dev) if (!indio_dev)
......
...@@ -326,7 +326,7 @@ static int jsa1212_probe(struct i2c_client *client, ...@@ -326,7 +326,7 @@ static int jsa1212_probe(struct i2c_client *client,
int ret; int ret;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -ENODEV; return -EOPNOTSUPP;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
if (!indio_dev) if (!indio_dev)
......
...@@ -159,7 +159,7 @@ static int mcp4531_probe(struct i2c_client *client, ...@@ -159,7 +159,7 @@ static int mcp4531_probe(struct i2c_client *client,
if (!i2c_check_functionality(client->adapter, if (!i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_WORD_DATA)) { I2C_FUNC_SMBUS_WORD_DATA)) {
dev_err(dev, "SMBUS Word Data not supported\n"); dev_err(dev, "SMBUS Word Data not supported\n");
return -EIO; return -EOPNOTSUPP;
} }
indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
......
...@@ -42,7 +42,7 @@ static int mpl115_i2c_probe(struct i2c_client *client, ...@@ -42,7 +42,7 @@ static int mpl115_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA))
return -ENODEV; return -EOPNOTSUPP;
return mpl115_probe(&client->dev, id->name, &mpl115_i2c_ops); return mpl115_probe(&client->dev, id->name, &mpl115_i2c_ops);
} }
......
...@@ -92,7 +92,7 @@ static int ms5611_i2c_probe(struct i2c_client *client, ...@@ -92,7 +92,7 @@ static int ms5611_i2c_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_WRITE_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE |
I2C_FUNC_SMBUS_READ_WORD_DATA | I2C_FUNC_SMBUS_READ_WORD_DATA |
I2C_FUNC_SMBUS_READ_I2C_BLOCK)) I2C_FUNC_SMBUS_READ_I2C_BLOCK))
return -ENODEV; return -EOPNOTSUPP;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*st)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*st));
if (!indio_dev) if (!indio_dev)
......
...@@ -136,7 +136,7 @@ static int ms5637_probe(struct i2c_client *client, ...@@ -136,7 +136,7 @@ static int ms5637_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
dev_err(&client->dev, dev_err(&client->dev,
"Adapter does not support some i2c transaction\n"); "Adapter does not support some i2c transaction\n");
return -ENODEV; return -EOPNOTSUPP;
} }
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*dev_data)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*dev_data));
......
...@@ -221,7 +221,7 @@ static int t5403_probe(struct i2c_client *client, ...@@ -221,7 +221,7 @@ static int t5403_probe(struct i2c_client *client,
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_I2C_BLOCK)) I2C_FUNC_SMBUS_I2C_BLOCK))
return -ENODEV; return -EOPNOTSUPP;
ret = i2c_smbus_read_byte_data(client, T5403_SLAVE_ADDR); ret = i2c_smbus_read_byte_data(client, T5403_SLAVE_ADDR);
if (ret < 0) if (ret < 0)
......
...@@ -278,7 +278,7 @@ static int lidar_probe(struct i2c_client *client, ...@@ -278,7 +278,7 @@ static int lidar_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BYTE)) I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BYTE))
data->xfer = lidar_smbus_xfer; data->xfer = lidar_smbus_xfer;
else else
return -ENOTSUPP; return -EOPNOTSUPP;
indio_dev->info = &lidar_info; indio_dev->info = &lidar_info;
indio_dev->name = LIDAR_DRV_NAME; indio_dev->name = LIDAR_DRV_NAME;
......
...@@ -516,7 +516,7 @@ static int mlx90614_probe(struct i2c_client *client, ...@@ -516,7 +516,7 @@ static int mlx90614_probe(struct i2c_client *client,
int ret; int ret;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA))
return -ENODEV; return -EOPNOTSUPP;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
if (!indio_dev) if (!indio_dev)
......
...@@ -205,7 +205,7 @@ static int tmp006_probe(struct i2c_client *client, ...@@ -205,7 +205,7 @@ static int tmp006_probe(struct i2c_client *client,
int ret; int ret;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA))
return -ENODEV; return -EOPNOTSUPP;
if (!tmp006_check_identification(client)) { if (!tmp006_check_identification(client)) {
dev_err(&client->dev, "no TMP006 sensor\n"); dev_err(&client->dev, "no TMP006 sensor\n");
......
...@@ -190,7 +190,7 @@ static int tsys01_i2c_probe(struct i2c_client *client, ...@@ -190,7 +190,7 @@ static int tsys01_i2c_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
dev_err(&client->dev, dev_err(&client->dev,
"Adapter does not support some i2c transaction\n"); "Adapter does not support some i2c transaction\n");
return -ENODEV; return -EOPNOTSUPP;
} }
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*dev_data)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*dev_data));
......
...@@ -137,7 +137,7 @@ static int tsys02d_probe(struct i2c_client *client, ...@@ -137,7 +137,7 @@ static int tsys02d_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
dev_err(&client->dev, dev_err(&client->dev,
"Adapter does not support some i2c transaction\n"); "Adapter does not support some i2c transaction\n");
return -ENODEV; return -EOPNOTSUPP;
} }
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*dev_data)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*dev_data));
......
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