diff mbox series

[v2,6/8] iio: humidity: hts221: Use dev_get_platdata() to get platform_data

Message ID 20200313104955.30423-6-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/8] iio: light: st_uvis25: Drop unneeded casting when print error code | expand

Commit Message

Andy Shevchenko March 13, 2020, 10:49 a.m. UTC
Use dev_get_platdata() to get the platform_data instead of
referencing it directly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: new patch
 drivers/iio/humidity/hts221_buffer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jonathan Cameron March 15, 2020, 12:42 p.m. UTC | #1
On Fri, 13 Mar 2020 12:49:53 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Use dev_get_platdata() to get the platform_data instead of
> referencing it directly.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied.   Thanks,

Jonathan

> ---
> v2: new patch
>  drivers/iio/humidity/hts221_buffer.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
> index 81d50a861c22..5f142a44c1dd 100644
> --- a/drivers/iio/humidity/hts221_buffer.c
> +++ b/drivers/iio/humidity/hts221_buffer.c
> @@ -74,10 +74,10 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
>  
>  int hts221_allocate_trigger(struct hts221_hw *hw)
>  {
> +	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;
>  	struct device_node *np = hw->dev->of_node;
> -	struct st_sensors_platform_data *pdata;
>  	unsigned long irq_type;
>  	int err;
>  
> @@ -106,7 +106,6 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
>  	if (err < 0)
>  		return err;
>  
> -	pdata = (struct st_sensors_platform_data *)hw->dev->platform_data;
>  	if ((np && of_property_read_bool(np, "drive-open-drain")) ||
>  	    (pdata && pdata->open_drain)) {
>  		irq_type |= IRQF_SHARED;
diff mbox series

Patch

diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
index 81d50a861c22..5f142a44c1dd 100644
--- a/drivers/iio/humidity/hts221_buffer.c
+++ b/drivers/iio/humidity/hts221_buffer.c
@@ -74,10 +74,10 @@  static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
 
 int hts221_allocate_trigger(struct hts221_hw *hw)
 {
+	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;
 	struct device_node *np = hw->dev->of_node;
-	struct st_sensors_platform_data *pdata;
 	unsigned long irq_type;
 	int err;
 
@@ -106,7 +106,6 @@  int hts221_allocate_trigger(struct hts221_hw *hw)
 	if (err < 0)
 		return err;
 
-	pdata = (struct st_sensors_platform_data *)hw->dev->platform_data;
 	if ((np && of_property_read_bool(np, "drive-open-drain")) ||
 	    (pdata && pdata->open_drain)) {
 		irq_type |= IRQF_SHARED;