diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2025-09-08 07:38:32 +0300 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2025-10-17 15:59:13 +0300 |
| commit | 1cfad0931e7b495245fd5092fc95bc4cc0ea1b3f (patch) | |
| tree | 4d3775cdfa93ebb76f98cb48a52a30dd9a919e38 | |
| parent | a640a80bf02dd2c10c62bbad9ccfb85829b03b5d (diff) | |
| download | linux-1cfad0931e7b495245fd5092fc95bc4cc0ea1b3f.tar.xz | |
hwmon: (aht10) Rely on subsystem locking
Attribute access is now serialized in the hardware monitoring core,
so locking in the driver code is no longer necessary. Drop it.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| -rw-r--r-- | drivers/hwmon/aht10.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/drivers/hwmon/aht10.c b/drivers/hwmon/aht10.c index d1c55e2eb479..8b90b661c393 100644 --- a/drivers/hwmon/aht10.c +++ b/drivers/hwmon/aht10.c @@ -60,8 +60,6 @@ MODULE_DEVICE_TABLE(i2c, aht10_id); /** * struct aht10_data - All the data required to operate an AHT10/AHT20 chip * @client: the i2c client associated with the AHT10/AHT20 - * @lock: a mutex that is used to prevent parallel access to the - * i2c client * @min_poll_interval: the minimum poll interval * While the poll rate limit is not 100% necessary, * the datasheet recommends that a measurement @@ -81,11 +79,6 @@ MODULE_DEVICE_TABLE(i2c, aht10_id); struct aht10_data { struct i2c_client *client; - /* - * Prevent simultaneous access to the i2c - * client and previous_poll_time - */ - struct mutex lock; ktime_t min_poll_interval; ktime_t previous_poll_time; int temperature; @@ -168,32 +161,24 @@ static int aht10_read_values(struct aht10_data *data) u8 raw_data[AHT20_MEAS_SIZE]; struct i2c_client *client = data->client; - mutex_lock(&data->lock); - if (!aht10_polltime_expired(data)) { - mutex_unlock(&data->lock); + if (!aht10_polltime_expired(data)) return 0; - } res = i2c_master_send(client, cmd_meas, sizeof(cmd_meas)); - if (res < 0) { - mutex_unlock(&data->lock); + if (res < 0) return res; - } usleep_range(AHT10_MEAS_DELAY, AHT10_MEAS_DELAY + AHT10_DELAY_EXTRA); res = i2c_master_recv(client, raw_data, data->meas_size); if (res != data->meas_size) { - mutex_unlock(&data->lock); if (res >= 0) return -ENODATA; return res; } - if (data->crc8 && crc8_check(raw_data, data->meas_size)) { - mutex_unlock(&data->lock); + if (data->crc8 && crc8_check(raw_data, data->meas_size)) return -EIO; - } hum = ((u32)raw_data[1] << 12u) | ((u32)raw_data[2] << 4u) | @@ -210,7 +195,6 @@ static int aht10_read_values(struct aht10_data *data) data->humidity = hum; data->previous_poll_time = ktime_get_boottime(); - mutex_unlock(&data->lock); return 0; } @@ -358,8 +342,6 @@ static int aht10_probe(struct i2c_client *client) break; } - mutex_init(&data->lock); - res = aht10_init(data); if (res < 0) return res; |
