diff options
author | Tomas Novotny <tomas@novotny.cz> | 2018-07-25 17:18:20 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2018-07-29 12:03:55 +0200 |
commit | 58bf9ace8c91be9b3e75cb001dbc199fae89d106 (patch) | |
tree | a6cfbda90a2faaf33a2b59c5f150cf87763f586c /drivers/iio/light | |
parent | iio: vcnl4000: add VCNL4010 and VCNL4020 device id (diff) | |
download | linux-58bf9ace8c91be9b3e75cb001dbc199fae89d106.tar.xz linux-58bf9ace8c91be9b3e75cb001dbc199fae89d106.zip |
iio: vcnl4000: warn on incorrectly specified device id
We can detect incorrectly specified device id for some chips, so warn
user in that case.
Signed-off-by: Tomas Novotny <tomas@novotny.cz>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/light')
-rw-r--r-- | drivers/iio/light/vcnl4000.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index 980eb3b77d5f..a0cd1dcbf935 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -84,8 +84,20 @@ static int vcnl4000_init(struct vcnl4000_data *data) return ret; prod_id = ret >> 4; - if (prod_id != VCNL4010_PROD_ID && prod_id != VCNL4000_PROD_ID) + switch (prod_id) { + case VCNL4000_PROD_ID: + if (data->id != VCNL4000) + dev_warn(&data->client->dev, + "wrong device id, use vcnl4000"); + break; + case VCNL4010_PROD_ID: + if (data->id != VCNL4010) + dev_warn(&data->client->dev, + "wrong device id, use vcnl4010/4020"); + break; + default: return -ENODEV; + } data->rev = ret & 0xf; data->al_scale = 250000; |