iio: st_sensors: make detection more helpful
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 30 Apr 2015 13:15:49 +0000 (15:15 +0200)
committerJonathan Cameron <jic23@kernel.org>
Thu, 7 May 2015 09:42:33 +0000 (10:42 +0100)
The ST sensors are detected by reading a WhoAmI register and
matching the number found to a sensor name string. To make it
easier to figure out what happens when things go wrong, print
the WhoAmI value and the device name we're trying to match.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/common/st_sensors/st_sensors_core.c

index cbeb5e01bc3ab461ad93bb97e921a2015e6e20c5..1255b157c71cbe80f44534bb9cfb0b08811bb8b9 100644 (file)
@@ -503,7 +503,8 @@ int st_sensors_check_device_support(struct iio_dev *indio_dev,
                        break;
        }
        if (n == ARRAY_SIZE(sensor_settings[i].sensors_supported)) {
-               dev_err(&indio_dev->dev, "device name and WhoAmI mismatch.\n");
+               dev_err(&indio_dev->dev, "device name \"%s\" and WhoAmI (0x%02x) mismatch",
+                       indio_dev->name, wai);
                goto sensor_name_mismatch;
        }