int hts221_probe(struct device *dev, int irq, const char *name,
                 struct regmap *regmap);
 int hts221_set_enable(struct hts221_hw *hw, bool enable);
-int hts221_allocate_buffers(struct hts221_hw *hw);
-int hts221_allocate_trigger(struct hts221_hw *hw);
+int hts221_allocate_buffers(struct iio_dev *iio_dev);
+int hts221_allocate_trigger(struct iio_dev *iio_dev);
 
 #endif /* HTS221_H */
 
        return IRQ_HANDLED;
 }
 
-int hts221_allocate_trigger(struct hts221_hw *hw)
+int hts221_allocate_trigger(struct iio_dev *iio_dev)
 {
+       struct hts221_hw *hw = iio_priv(iio_dev);
        struct st_sensors_platform_data *pdata = dev_get_platdata(hw->dev);
-       struct iio_dev *iio_dev = iio_priv_to_dev(hw);
        bool irq_active_low = false, open_drain = false;
        unsigned long irq_type;
        int err;
        return IRQ_HANDLED;
 }
 
-int hts221_allocate_buffers(struct hts221_hw *hw)
+int hts221_allocate_buffers(struct iio_dev *iio_dev)
 {
-       return devm_iio_triggered_buffer_setup(hw->dev, iio_priv_to_dev(hw),
+       struct hts221_hw *hw = iio_priv(iio_dev);
+       return devm_iio_triggered_buffer_setup(hw->dev, iio_dev,
                                        NULL, hts221_buffer_handler_thread,
                                        &hts221_buffer_ops);
 }
 
        }
 
        if (hw->irq > 0) {
-               err = hts221_allocate_buffers(hw);
+               err = hts221_allocate_buffers(iio_dev);
                if (err < 0)
                        return err;
 
-               err = hts221_allocate_trigger(hw);
+               err = hts221_allocate_trigger(iio_dev);
                if (err)
                        return err;
        }