Commit 578e02a7 authored by Brian Masney's avatar Brian Masney Committed by Jonathan Cameron

staging: iio: isl29028: made error messages consistent

The wording and style of the different error messages was not
consistent. This patch makes the wording and style consistent
throughout the driver.
Signed-off-by: default avatarBrian Masney <masneyb@onstation.org>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent bcf5104e
...@@ -200,14 +200,16 @@ static int isl29028_read_als_ir(struct isl29028_chip *chip, int *als_ir) ...@@ -200,14 +200,16 @@ static int isl29028_read_als_ir(struct isl29028_chip *chip, int *als_ir)
ret = regmap_read(chip->regmap, ISL29028_REG_ALSIR_L, &lsb); ret = regmap_read(chip->regmap, ISL29028_REG_ALSIR_L, &lsb);
if (ret < 0) { if (ret < 0) {
dev_err(dev, dev_err(dev,
"Error in reading register ALSIR_L err %d\n", ret); "%s(): Error %d reading register ALSIR_L\n",
__func__, ret);
return ret; return ret;
} }
ret = regmap_read(chip->regmap, ISL29028_REG_ALSIR_U, &msb); ret = regmap_read(chip->regmap, ISL29028_REG_ALSIR_U, &msb);
if (ret < 0) { if (ret < 0) {
dev_err(dev, dev_err(dev,
"Error in reading register ALSIR_U err %d\n", ret); "%s(): Error %d reading register ALSIR_U\n",
__func__, ret);
return ret; return ret;
} }
...@@ -232,8 +234,8 @@ static int isl29028_read_proxim(struct isl29028_chip *chip, int *prox) ...@@ -232,8 +234,8 @@ static int isl29028_read_proxim(struct isl29028_chip *chip, int *prox)
ret = regmap_read(chip->regmap, ISL29028_REG_PROX_DATA, &data); ret = regmap_read(chip->regmap, ISL29028_REG_PROX_DATA, &data);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "Error in reading register %d, error %d\n", dev_err(dev, "%s(): Error %d reading register PROX_DATA\n",
ISL29028_REG_PROX_DATA, ret); __func__, ret);
return ret; return ret;
} }
...@@ -250,7 +252,8 @@ static int isl29028_als_get(struct isl29028_chip *chip, int *als_data) ...@@ -250,7 +252,8 @@ static int isl29028_als_get(struct isl29028_chip *chip, int *als_data)
ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_ALS); ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_ALS);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "Error in enabling ALS mode err %d\n", ret); dev_err(dev, "%s(): Error %d enabling ALS mode\n", __func__,
ret);
return ret; return ret;
} }
...@@ -280,7 +283,8 @@ static int isl29028_ir_get(struct isl29028_chip *chip, int *ir_data) ...@@ -280,7 +283,8 @@ static int isl29028_ir_get(struct isl29028_chip *chip, int *ir_data)
ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_IR); ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_IR);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "Error in enabling IR mode err %d\n", ret); dev_err(dev, "%s(): Error %d enabling IR mode\n", __func__,
ret);
return ret; return ret;
} }
...@@ -301,14 +305,15 @@ static int isl29028_write_raw(struct iio_dev *indio_dev, ...@@ -301,14 +305,15 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
case IIO_PROXIMITY: case IIO_PROXIMITY:
if (mask != IIO_CHAN_INFO_SAMP_FREQ) { if (mask != IIO_CHAN_INFO_SAMP_FREQ) {
dev_err(dev, dev_err(dev,
"proximity: mask value 0x%08lx not supported\n", "%s(): proximity: Mask value 0x%08lx is not supported\n",
mask); __func__, mask);
break; break;
} }
if (val < 1 || val > 100) { if (val < 1 || val > 100) {
dev_err(dev, dev_err(dev,
"Samp_freq %d is not in range[1:100]\n", val); "%s(): proximity: Sampling frequency %d is not in the range [1:100]\n",
__func__, val);
break; break;
} }
...@@ -317,21 +322,23 @@ static int isl29028_write_raw(struct iio_dev *indio_dev, ...@@ -317,21 +322,23 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
case IIO_LIGHT: case IIO_LIGHT:
if (mask != IIO_CHAN_INFO_SCALE) { if (mask != IIO_CHAN_INFO_SCALE) {
dev_err(dev, dev_err(dev,
"light: mask value 0x%08lx not supported\n", "%s(): light: Mask value 0x%08lx is not supported\n",
mask); __func__, mask);
break; break;
} }
if ((val != 125) && (val != 2000)) { if ((val != 125) && (val != 2000)) {
dev_err(dev, dev_err(dev,
"lux scale %d is invalid [125, 2000]\n", val); "%s(): light: Lux scale %d is not in the set {125, 2000}\n",
__func__, val);
break; break;
} }
ret = isl29028_set_als_scale(chip, val); ret = isl29028_set_als_scale(chip, val);
break; break;
default: default:
dev_err(dev, "Unsupported channel type\n"); dev_err(dev, "%s(): Unsupported channel type %x\n",
__func__, chan->type);
break; break;
} }
...@@ -385,7 +392,8 @@ static int isl29028_read_raw(struct iio_dev *indio_dev, ...@@ -385,7 +392,8 @@ static int isl29028_read_raw(struct iio_dev *indio_dev,
ret = IIO_VAL_INT; ret = IIO_VAL_INT;
break; break;
default: default:
dev_err(dev, "mask value 0x%08lx not supported\n", mask); dev_err(dev, "%s(): mask value 0x%08lx is not supported\n",
__func__, mask);
break; break;
} }
...@@ -438,8 +446,8 @@ static int isl29028_chip_init_and_power_on(struct isl29028_chip *chip) ...@@ -438,8 +446,8 @@ static int isl29028_chip_init_and_power_on(struct isl29028_chip *chip)
ret = regmap_write(chip->regmap, ISL29028_REG_CONFIGURE, 0x0); ret = regmap_write(chip->regmap, ISL29028_REG_CONFIGURE, 0x0);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "%s(): write to reg %d failed, err = %d\n", dev_err(dev, "%s(): Error %d clearing the CONFIGURE register\n",
__func__, ISL29028_REG_CONFIGURE, ret); __func__, ret);
return ret; return ret;
} }
...@@ -493,8 +501,8 @@ static int isl29028_probe(struct i2c_client *client, ...@@ -493,8 +501,8 @@ static int isl29028_probe(struct i2c_client *client,
chip->regmap = devm_regmap_init_i2c(client, &isl29028_regmap_config); chip->regmap = devm_regmap_init_i2c(client, &isl29028_regmap_config);
if (IS_ERR(chip->regmap)) { if (IS_ERR(chip->regmap)) {
ret = PTR_ERR(chip->regmap); ret = PTR_ERR(chip->regmap);
dev_err(&client->dev, "regmap initialization failed: %d\n", dev_err(&client->dev, "%s: Error %d initializing regmap\n",
ret); __func__, ret);
return ret; return ret;
} }
...@@ -506,16 +514,16 @@ static int isl29028_probe(struct i2c_client *client, ...@@ -506,16 +514,16 @@ static int isl29028_probe(struct i2c_client *client,
ret = regmap_write(chip->regmap, ISL29028_REG_TEST1_MODE, 0x0); ret = regmap_write(chip->regmap, ISL29028_REG_TEST1_MODE, 0x0);
if (ret < 0) { if (ret < 0) {
dev_err(&client->dev, dev_err(&client->dev,
"%s(): write to reg %d failed, err = %d\n", __func__, "%s(): Error %d writing to TEST1_MODE register\n",
ISL29028_REG_TEST1_MODE, ret); __func__, ret);
return ret; return ret;
} }
ret = regmap_write(chip->regmap, ISL29028_REG_TEST2_MODE, 0x0); ret = regmap_write(chip->regmap, ISL29028_REG_TEST2_MODE, 0x0);
if (ret < 0) { if (ret < 0) {
dev_err(&client->dev, dev_err(&client->dev,
"%s(): write to reg %d failed, err = %d\n", __func__, "%s(): Error %d writing to TEST2_MODE register\n",
ISL29028_REG_TEST2_MODE, ret); __func__, ret);
return ret; return ret;
} }
...@@ -535,8 +543,8 @@ static int isl29028_probe(struct i2c_client *client, ...@@ -535,8 +543,8 @@ static int isl29028_probe(struct i2c_client *client,
ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev); ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev);
if (ret < 0) { if (ret < 0) {
dev_err(&client->dev, dev_err(&client->dev,
"iio registration fails with error %d\n", "%s(): iio registration failed with error %d\n",
ret); __func__, ret);
return ret; return ret;
} }
......
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