aht10.c (8c78f0dee4371ab3b0422edf08597525c6219512) aht10.c (cbfc6c6177f9208762c7c4acec394214b1e8be0c)
1// SPDX-License-Identifier: GPL-2.0-only
2
3/*
4 * aht10.c - Linux hwmon driver for AHT10 Temperature and Humidity sensor
5 * Copyright (C) 2020 Johannes Cornelis Draaijer
6 */
7
8#include <linux/delay.h>

--- 124 unchanged lines hidden (view full) ---

133 u32 temp, hum;
134 int res;
135 u8 raw_data[AHT10_MEAS_SIZE];
136 struct i2c_client *client = data->client;
137
138 mutex_lock(&data->lock);
139 if (aht10_polltime_expired(data)) {
140 res = i2c_master_send(client, cmd_meas, sizeof(cmd_meas));
1// SPDX-License-Identifier: GPL-2.0-only
2
3/*
4 * aht10.c - Linux hwmon driver for AHT10 Temperature and Humidity sensor
5 * Copyright (C) 2020 Johannes Cornelis Draaijer
6 */
7
8#include <linux/delay.h>

--- 124 unchanged lines hidden (view full) ---

133 u32 temp, hum;
134 int res;
135 u8 raw_data[AHT10_MEAS_SIZE];
136 struct i2c_client *client = data->client;
137
138 mutex_lock(&data->lock);
139 if (aht10_polltime_expired(data)) {
140 res = i2c_master_send(client, cmd_meas, sizeof(cmd_meas));
141 if (res < 0)
141 if (res < 0) {
142 mutex_unlock(&data->lock);
142 return res;
143 return res;
144 }
143
144 usleep_range(AHT10_MEAS_DELAY,
145 AHT10_MEAS_DELAY + AHT10_DELAY_EXTRA);
146
147 res = i2c_master_recv(client, raw_data, AHT10_MEAS_SIZE);
148 if (res != AHT10_MEAS_SIZE) {
149 mutex_unlock(&data->lock);
150 if (res >= 0)

--- 196 unchanged lines hidden ---
145
146 usleep_range(AHT10_MEAS_DELAY,
147 AHT10_MEAS_DELAY + AHT10_DELAY_EXTRA);
148
149 res = i2c_master_recv(client, raw_data, AHT10_MEAS_SIZE);
150 if (res != AHT10_MEAS_SIZE) {
151 mutex_unlock(&data->lock);
152 if (res >= 0)

--- 196 unchanged lines hidden ---