.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * STMicroelectronics hts221 sensor driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright 2016 STMicroelectronics Inc. |
---|
5 | 6 | * |
---|
6 | 7 | * Lorenzo Bianconi <lorenzo.bianconi@st.com> |
---|
7 | | - * |
---|
8 | | - * Licensed under the GPL-2. |
---|
9 | 8 | */ |
---|
10 | 9 | #include <linux/kernel.h> |
---|
11 | 10 | #include <linux/module.h> |
---|
.. | .. |
---|
73 | 72 | return IRQ_HANDLED; |
---|
74 | 73 | } |
---|
75 | 74 | |
---|
76 | | -int hts221_allocate_trigger(struct hts221_hw *hw) |
---|
| 75 | +int hts221_allocate_trigger(struct iio_dev *iio_dev) |
---|
77 | 76 | { |
---|
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); |
---|
79 | 79 | bool irq_active_low = false, open_drain = false; |
---|
80 | | - struct device_node *np = hw->dev->of_node; |
---|
81 | | - struct st_sensors_platform_data *pdata; |
---|
82 | 80 | unsigned long irq_type; |
---|
83 | 81 | int err; |
---|
84 | 82 | |
---|
.. | .. |
---|
107 | 105 | if (err < 0) |
---|
108 | 106 | return err; |
---|
109 | 107 | |
---|
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") || |
---|
112 | 109 | (pdata && pdata->open_drain)) { |
---|
113 | 110 | irq_type |= IRQF_SHARED; |
---|
114 | 111 | open_drain = true; |
---|
.. | .. |
---|
156 | 153 | |
---|
157 | 154 | static const struct iio_buffer_setup_ops hts221_buffer_ops = { |
---|
158 | 155 | .preenable = hts221_buffer_preenable, |
---|
159 | | - .postenable = iio_triggered_buffer_postenable, |
---|
160 | | - .predisable = iio_triggered_buffer_predisable, |
---|
161 | 156 | .postdisable = hts221_buffer_postdisable, |
---|
162 | 157 | }; |
---|
163 | 158 | |
---|
.. | .. |
---|
194 | 189 | return IRQ_HANDLED; |
---|
195 | 190 | } |
---|
196 | 191 | |
---|
197 | | -int hts221_allocate_buffers(struct hts221_hw *hw) |
---|
| 192 | +int hts221_allocate_buffers(struct iio_dev *iio_dev) |
---|
198 | 193 | { |
---|
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, |
---|
200 | 196 | NULL, hts221_buffer_handler_thread, |
---|
201 | 197 | &hts221_buffer_ops); |
---|
202 | 198 | } |
---|