提交 58bf9ace 编写于 作者: T Tomas Novotny 提交者: Jonathan Cameron

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: NTomas Novotny <tomas@novotny.cz>
Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
上级 50c50b97
...@@ -84,8 +84,20 @@ static int vcnl4000_init(struct vcnl4000_data *data) ...@@ -84,8 +84,20 @@ static int vcnl4000_init(struct vcnl4000_data *data)
return ret; return ret;
prod_id = ret >> 4; 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; return -ENODEV;
}
data->rev = ret & 0xf; data->rev = ret & 0xf;
data->al_scale = 250000; data->al_scale = 250000;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册