diff options
Diffstat (limited to 'drivers/hwmon/sht21.c')
| -rw-r--r-- | drivers/hwmon/sht21.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/hwmon/sht21.c b/drivers/hwmon/sht21.c index e23dbf287233..627d35070a42 100644 --- a/drivers/hwmon/sht21.c +++ b/drivers/hwmon/sht21.c @@ -114,7 +114,7 @@ out: } /** - * sht21_show_temperature() - show temperature measurement value in sysfs + * sht21_temperature_show() - show temperature measurement value in sysfs * @dev: device * @attr: device attribute * @buf: sysfs buffer (PAGE_SIZE) where measurement values are written to @@ -136,7 +136,7 @@ static ssize_t sht21_temperature_show(struct device *dev, } /** - * sht21_show_humidity() - show humidity measurement value in sysfs + * sht21_humidity_show() - show humidity measurement value in sysfs * @dev: device * @attr: device attribute * @buf: sysfs buffer (PAGE_SIZE) where measurement values are written to @@ -199,10 +199,7 @@ static ssize_t eic_read(struct sht21 *sht21) eic[6] = rx[0]; eic[7] = rx[1]; - ret = snprintf(sht21->eic, sizeof(sht21->eic), - "%02x%02x%02x%02x%02x%02x%02x%02x\n", - eic[0], eic[1], eic[2], eic[3], - eic[4], eic[5], eic[6], eic[7]); + ret = snprintf(sht21->eic, sizeof(sht21->eic), "%8phN\n", eic); out: if (ret < 0) sht21->eic[0] = 0; @@ -278,14 +275,27 @@ static int sht21_probe(struct i2c_client *client) /* Device ID table */ static const struct i2c_device_id sht21_id[] = { - { "sht21", 0 }, + { "sht20" }, + { "sht21" }, + { "sht25" }, { } }; MODULE_DEVICE_TABLE(i2c, sht21_id); +static const struct of_device_id sht21_of_match[] = { + { .compatible = "sensirion,sht20" }, + { .compatible = "sensirion,sht21" }, + { .compatible = "sensirion,sht25" }, + { } +}; +MODULE_DEVICE_TABLE(of, sht21_of_match); + static struct i2c_driver sht21_driver = { - .driver.name = "sht21", - .probe_new = sht21_probe, + .driver = { + .name = "sht21", + .of_match_table = sht21_of_match, + }, + .probe = sht21_probe, .id_table = sht21_id, }; |
