sht21
sht21->temperature = sht21_temp_ticks_to_millicelsius(ret);
sht21->humidity = sht21_rh_ticks_to_per_cent_mille(ret);
sht21->last_update = jiffies;
sht21->valid = true;
mutex_unlock(&sht21->lock);
struct sht21 *sht21 = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", sht21->temperature);
struct sht21 *sht21 = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", sht21->humidity);
static ssize_t eic_read(struct sht21 *sht21)
struct i2c_client *client = sht21->client;
ret = snprintf(sht21->eic, sizeof(sht21->eic), "%8phN\n", eic);
sht21->eic[0] = 0;
struct sht21 *sht21 = dev_get_drvdata(dev);
ret = sizeof(sht21->eic) - 1;
mutex_lock(&sht21->lock);
if (!sht21->eic[0])
ret = eic_read(sht21);
memcpy(buf, sht21->eic, ret);
mutex_unlock(&sht21->lock);
ATTRIBUTE_GROUPS(sht21);
struct sht21 *sht21;
sht21 = devm_kzalloc(dev, sizeof(*sht21), GFP_KERNEL);
if (!sht21)
sht21->client = client;
mutex_init(&sht21->lock);
sht21, sht21_groups);
struct sht21 *sht21 = dev_get_drvdata(dev);
struct i2c_client *client = sht21->client;
mutex_lock(&sht21->lock);
if (time_after(jiffies, sht21->last_update + HZ / 2) || !sht21->valid) {