Lines Matching refs:sht21

46 struct sht21 {  struct
94 struct sht21 *sht21 = i2c_get_clientdata(client); in sht21_update_measurements() local
96 mutex_lock(&sht21->lock); in sht21_update_measurements()
102 if (time_after(jiffies, sht21->last_update + HZ / 2) || !sht21->valid) { in sht21_update_measurements()
107 sht21->temperature = sht21_temp_ticks_to_millicelsius(ret); in sht21_update_measurements()
112 sht21->humidity = sht21_rh_ticks_to_per_cent_mille(ret); in sht21_update_measurements()
113 sht21->last_update = jiffies; in sht21_update_measurements()
114 sht21->valid = 1; in sht21_update_measurements()
117 mutex_unlock(&sht21->lock); in sht21_update_measurements()
136 struct sht21 *sht21 = i2c_get_clientdata(client); in sht21_show_temperature() local
140 return sprintf(buf, "%d\n", sht21->temperature); in sht21_show_temperature()
157 struct sht21 *sht21 = i2c_get_clientdata(client); in sht21_show_humidity() local
161 return sprintf(buf, "%d\n", sht21->humidity); in sht21_show_humidity()
192 struct sht21 *sht21; in sht21_probe() local
202 sht21 = kzalloc(sizeof(*sht21), GFP_KERNEL); in sht21_probe()
203 if (!sht21) { in sht21_probe()
207 i2c_set_clientdata(client, sht21); in sht21_probe()
209 mutex_init(&sht21->lock); in sht21_probe()
216 sht21->hwmon_dev = hwmon_device_register(&client->dev); in sht21_probe()
217 if (IS_ERR(sht21->hwmon_dev)) { in sht21_probe()
219 err = PTR_ERR(sht21->hwmon_dev); in sht21_probe()
230 kfree(sht21); in sht21_probe()
241 struct sht21 *sht21 = i2c_get_clientdata(client); in sht21_remove() local
243 hwmon_device_unregister(sht21->hwmon_dev); in sht21_remove()
245 kfree(sht21); in sht21_remove()