hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/iio/humidity/hts221_buffer.c
....@@ -1,11 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * STMicroelectronics hts221 sensor driver
34 *
45 * Copyright 2016 STMicroelectronics Inc.
56 *
67 * Lorenzo Bianconi <lorenzo.bianconi@st.com>
7
- *
8
- * Licensed under the GPL-2.
98 */
109 #include <linux/kernel.h>
1110 #include <linux/module.h>
....@@ -73,12 +72,11 @@
7372 return IRQ_HANDLED;
7473 }
7574
76
-int hts221_allocate_trigger(struct hts221_hw *hw)
75
+int hts221_allocate_trigger(struct iio_dev *iio_dev)
7776 {
78
- struct iio_dev *iio_dev = iio_priv_to_dev(hw);
77
+ struct hts221_hw *hw = iio_priv(iio_dev);
78
+ struct st_sensors_platform_data *pdata = dev_get_platdata(hw->dev);
7979 bool irq_active_low = false, open_drain = false;
80
- struct device_node *np = hw->dev->of_node;
81
- struct st_sensors_platform_data *pdata;
8280 unsigned long irq_type;
8381 int err;
8482
....@@ -107,8 +105,7 @@
107105 if (err < 0)
108106 return err;
109107
110
- pdata = (struct st_sensors_platform_data *)hw->dev->platform_data;
111
- if ((np && of_property_read_bool(np, "drive-open-drain")) ||
108
+ if (device_property_read_bool(hw->dev, "drive-open-drain") ||
112109 (pdata && pdata->open_drain)) {
113110 irq_type |= IRQF_SHARED;
114111 open_drain = true;
....@@ -156,8 +153,6 @@
156153
157154 static const struct iio_buffer_setup_ops hts221_buffer_ops = {
158155 .preenable = hts221_buffer_preenable,
159
- .postenable = iio_triggered_buffer_postenable,
160
- .predisable = iio_triggered_buffer_predisable,
161156 .postdisable = hts221_buffer_postdisable,
162157 };
163158
....@@ -194,9 +189,10 @@
194189 return IRQ_HANDLED;
195190 }
196191
197
-int hts221_allocate_buffers(struct hts221_hw *hw)
192
+int hts221_allocate_buffers(struct iio_dev *iio_dev)
198193 {
199
- return devm_iio_triggered_buffer_setup(hw->dev, iio_priv_to_dev(hw),
194
+ struct hts221_hw *hw = iio_priv(iio_dev);
195
+ return devm_iio_triggered_buffer_setup(hw->dev, iio_dev,
200196 NULL, hts221_buffer_handler_thread,
201197 &hts221_buffer_ops);
202198 }