linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: merrifield: Fix build err without CONFIG_ACPI
@ 2019-04-04 10:39 Yue Haibing
  2019-04-04 11:40 ` Mukesh Ojha
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Yue Haibing @ 2019-04-04 10:39 UTC (permalink / raw)
  To: andriy.shevchenko, linus.walleij, bgolaszewski
  Cc: linux-kernel, linux-gpio, YueHaibing

From: YueHaibing <yuehaibing@huawei.com>

When building CONFIG_ACPI is not set
gcc warn this:

drivers/gpio/gpio-merrifield.c: In function mrfld_gpio_get_pinctrl_dev_name:
drivers/gpio/gpio-merrifield.c:388:19: error: dereferencing pointer to incomplete type struct acpi_device
   put_device(&adev->dev);
                   ^
Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes:d00d2109c367 ("gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/gpio/gpio-merrifield.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
index 2383dc7..78ac32f 100644
--- a/drivers/gpio/gpio-merrifield.c
+++ b/drivers/gpio/gpio-merrifield.c
@@ -379,17 +379,18 @@ static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
 
 static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
 {
-	struct acpi_device *adev;
 	const char *name;
+#ifdef CONFIG_ACPI
+	struct acpi_device *adev;
 
 	adev = acpi_dev_get_first_match_dev("INTC1002", NULL, -1);
 	if (adev) {
 		name = devm_kstrdup(priv->dev, acpi_dev_name(adev), GFP_KERNEL);
 		put_device(&adev->dev);
-	} else {
-		name = "pinctrl-merrifield";
 	}
-
+#else
+	name = "pinctrl-merrifield";
+#endif
 	return name;
 }
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-04 10:39 [PATCH] gpio: merrifield: Fix build err without CONFIG_ACPI Yue Haibing
@ 2019-04-04 11:40 ` Mukesh Ojha
  2019-04-04 11:44 ` Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Mukesh Ojha @ 2019-04-04 11:40 UTC (permalink / raw)
  To: Yue Haibing, andriy.shevchenko, linus.walleij, bgolaszewski
  Cc: linux-kernel, linux-gpio


On 4/4/2019 4:09 PM, Yue Haibing wrote:
> From: YueHaibing <yuehaibing@huawei.com>
>
> When building CONFIG_ACPI is not set
> gcc warn this:
>
> drivers/gpio/gpio-merrifield.c: In function mrfld_gpio_get_pinctrl_dev_name:
> drivers/gpio/gpio-merrifield.c:388:19: error: dereferencing pointer to incomplete type struct acpi_device
>     put_device(&adev->dev);
>                     ^
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes:d00d2109c367 ("gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

Cheers,
-Mukesh
> ---
>   drivers/gpio/gpio-merrifield.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
> index 2383dc7..78ac32f 100644
> --- a/drivers/gpio/gpio-merrifield.c
> +++ b/drivers/gpio/gpio-merrifield.c
> @@ -379,17 +379,18 @@ static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
>   
>   static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
>   {
> -	struct acpi_device *adev;
>   	const char *name;
> +#ifdef CONFIG_ACPI
> +	struct acpi_device *adev;
>   
>   	adev = acpi_dev_get_first_match_dev("INTC1002", NULL, -1);
>   	if (adev) {
>   		name = devm_kstrdup(priv->dev, acpi_dev_name(adev), GFP_KERNEL);
>   		put_device(&adev->dev);
> -	} else {
> -		name = "pinctrl-merrifield";
>   	}
> -
> +#else
> +	name = "pinctrl-merrifield";
> +#endif
>   	return name;
>   }
>   

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-04 10:39 [PATCH] gpio: merrifield: Fix build err without CONFIG_ACPI Yue Haibing
  2019-04-04 11:40 ` Mukesh Ojha
@ 2019-04-04 11:44 ` Andy Shevchenko
  2019-04-04 14:04 ` YueHaibing
  2019-04-05 14:21 ` [PATCH v2] " Yue Haibing
  3 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2019-04-04 11:44 UTC (permalink / raw)
  To: Yue Haibing; +Cc: linus.walleij, bgolaszewski, linux-kernel, linux-gpio

On Thu, Apr 04, 2019 at 06:39:25PM +0800, Yue Haibing wrote:
> From: YueHaibing <yuehaibing@huawei.com>
> 
> When building CONFIG_ACPI is not set
> gcc warn this:
> 
> drivers/gpio/gpio-merrifield.c: In function mrfld_gpio_get_pinctrl_dev_name:
> drivers/gpio/gpio-merrifield.c:388:19: error: dereferencing pointer to incomplete type struct acpi_device
>    put_device(&adev->dev);
>                    ^

Thanks for the patch. My comment below.

This patch went through ACPI subsystem, so, include Rafael and linux-acpi
mailing list in next iteration.

> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes:d00d2109c367 ("gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/gpio/gpio-merrifield.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
> index 2383dc7..78ac32f 100644
> --- a/drivers/gpio/gpio-merrifield.c
> +++ b/drivers/gpio/gpio-merrifield.c
> @@ -379,17 +379,18 @@ static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
>  
>  static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
>  {
> -	struct acpi_device *adev;
>  	const char *name;
> +#ifdef CONFIG_ACPI
> +	struct acpi_device *adev;
>  
>  	adev = acpi_dev_get_first_match_dev("INTC1002", NULL, -1);
>  	if (adev) {
>  		name = devm_kstrdup(priv->dev, acpi_dev_name(adev), GFP_KERNEL);
>  		put_device(&adev->dev);

> -	} else {
> -		name = "pinctrl-merrifield";
>  	}

This will break ACPI=y on non-ACPI platform, where we need to fallback to
the platform driver name.


Better to do the following in acpi.h

#ifdef CONFIG_ACPI
static inline void put_acpi_device(struct acpi_device *adev)
{
	put_device(&adev->dev);
}
#else
static inline void put_acpi_device(struct acpi_device *adev) {}
#endif

> -
> +#else
> +	name = "pinctrl-merrifield";
> +#endif
>  	return name;
>  }

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-04 10:39 [PATCH] gpio: merrifield: Fix build err without CONFIG_ACPI Yue Haibing
  2019-04-04 11:40 ` Mukesh Ojha
  2019-04-04 11:44 ` Andy Shevchenko
@ 2019-04-04 14:04 ` YueHaibing
  2019-04-05 10:07   ` Andy Shevchenko
  2019-04-05 14:21 ` [PATCH v2] " Yue Haibing
  3 siblings, 1 reply; 16+ messages in thread
From: YueHaibing @ 2019-04-04 14:04 UTC (permalink / raw)
  To: andriy.shevchenko, linus.walleij, bgolaszewski, rjw
  Cc: linux-kernel, linux-gpio, linux-acpi

+cc Rafael and linux-acpi

On 2019/4/4 18:39, Yue Haibing wrote:
> From: YueHaibing <yuehaibing@huawei.com>
> 
> When building CONFIG_ACPI is not set
> gcc warn this:
> 
> drivers/gpio/gpio-merrifield.c: In function mrfld_gpio_get_pinctrl_dev_name:
> drivers/gpio/gpio-merrifield.c:388:19: error: dereferencing pointer to incomplete type struct acpi_device
>    put_device(&adev->dev);
>                    ^
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes:d00d2109c367 ("gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/gpio/gpio-merrifield.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
> index 2383dc7..78ac32f 100644
> --- a/drivers/gpio/gpio-merrifield.c
> +++ b/drivers/gpio/gpio-merrifield.c
> @@ -379,17 +379,18 @@ static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
>  
>  static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
>  {
> -	struct acpi_device *adev;
>  	const char *name;
> +#ifdef CONFIG_ACPI
> +	struct acpi_device *adev;
>  
>  	adev = acpi_dev_get_first_match_dev("INTC1002", NULL, -1);
>  	if (adev) {
>  		name = devm_kstrdup(priv->dev, acpi_dev_name(adev), GFP_KERNEL);
>  		put_device(&adev->dev);
> -	} else {
> -		name = "pinctrl-merrifield";
>  	}
> -
> +#else
> +	name = "pinctrl-merrifield";
> +#endif
>  	return name;
>  }
>  
> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-04 14:04 ` YueHaibing
@ 2019-04-05 10:07   ` Andy Shevchenko
  2019-04-05 12:11     ` YueHaibing
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2019-04-05 10:07 UTC (permalink / raw)
  To: YueHaibing
  Cc: linus.walleij, bgolaszewski, rjw, linux-kernel, linux-gpio, linux-acpi

On Thu, Apr 04, 2019 at 10:04:04PM +0800, YueHaibing wrote:
> +cc Rafael and linux-acpi

Yeah, but please, address my comments and send v2.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-05 10:07   ` Andy Shevchenko
@ 2019-04-05 12:11     ` YueHaibing
  0 siblings, 0 replies; 16+ messages in thread
From: YueHaibing @ 2019-04-05 12:11 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linus.walleij, bgolaszewski, rjw, linux-kernel, linux-gpio, linux-acpi


On 2019/4/5 18:07, Andy Shevchenko wrote:
> On Thu, Apr 04, 2019 at 10:04:04PM +0800, YueHaibing wrote:
>> +cc Rafael and linux-acpi
> 
> Yeah, but please, address my comments and send v2.

Oh, sorry, I just forgot to send v2.

> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-04 10:39 [PATCH] gpio: merrifield: Fix build err without CONFIG_ACPI Yue Haibing
                   ` (2 preceding siblings ...)
  2019-04-04 14:04 ` YueHaibing
@ 2019-04-05 14:21 ` Yue Haibing
  2019-04-05 14:50   ` Andy Shevchenko
  2019-04-12 15:19   ` [PATCH v3] " Yue Haibing
  3 siblings, 2 replies; 16+ messages in thread
From: Yue Haibing @ 2019-04-05 14:21 UTC (permalink / raw)
  To: andriy.shevchenko, linus.walleij, bgolaszewski, rjw
  Cc: linux-kernel, linux-gpio, linux-acpi, YueHaibing

From: YueHaibing <yuehaibing@huawei.com>

When building CONFIG_ACPI is not set
gcc warn this:

drivers/gpio/gpio-merrifield.c: In function mrfld_gpio_get_pinctrl_dev_name:
drivers/gpio/gpio-merrifield.c:388:19: error: dereferencing pointer to incomplete type struct acpi_device
   put_device(&adev->dev);
                   ^
Reported-by: Hulk Robot <hulkci@huawei.com>
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Fixes:d00d2109c367 ("gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v2: rework patch use put_acpi_device helper
---
 drivers/gpio/gpio-merrifield.c | 2 +-
 include/linux/acpi.h           | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
index 2383dc7..99ca18c 100644
--- a/drivers/gpio/gpio-merrifield.c
+++ b/drivers/gpio/gpio-merrifield.c
@@ -385,7 +385,7 @@ static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
 	adev = acpi_dev_get_first_match_dev("INTC1002", NULL, -1);
 	if (adev) {
 		name = devm_kstrdup(priv->dev, acpi_dev_name(adev), GFP_KERNEL);
-		put_device(&adev->dev);
+		put_acpi_device(adev);
 	} else {
 		name = "pinctrl-merrifield";
 	}
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index a1bd789..2563e13 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1331,12 +1331,19 @@ static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level)
 
 #ifdef CONFIG_ACPI
 extern int acpi_platform_notify(struct device *dev, enum kobject_action action);
+
+static inline void put_acpi_device(struct acpi_device *adev)
+{
+	put_device(&adev->dev);
+}
 #else
 static inline int
 acpi_platform_notify(struct device *dev, enum kobject_action action)
 {
 	return 0;
 }
+
+static inline void put_acpi_device(struct acpi_device *adev) {}
 #endif
 
 #endif	/*_LINUX_ACPI_H*/
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-05 14:21 ` [PATCH v2] " Yue Haibing
@ 2019-04-05 14:50   ` Andy Shevchenko
  2019-04-11 23:09     ` Rafael J. Wysocki
  2019-04-12 15:19   ` [PATCH v3] " Yue Haibing
  1 sibling, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2019-04-05 14:50 UTC (permalink / raw)
  To: Yue Haibing
  Cc: linus.walleij, bgolaszewski, rjw, linux-kernel, linux-gpio, linux-acpi

On Fri, Apr 05, 2019 at 10:21:12PM +0800, Yue Haibing wrote:
> From: YueHaibing <yuehaibing@huawei.com>
> 
> When building CONFIG_ACPI is not set
> gcc warn this:
> 
> drivers/gpio/gpio-merrifield.c: In function mrfld_gpio_get_pinctrl_dev_name:
> drivers/gpio/gpio-merrifield.c:388:19: error: dereferencing pointer to incomplete type struct acpi_device
>    put_device(&adev->dev);
>                    ^
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Fixes:d00d2109c367 ("gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Thank you for an update, I have a comment below, but before sending v3, let
Rafael to have a chance to look at it.

>  #ifdef CONFIG_ACPI
>  extern int acpi_platform_notify(struct device *dev, enum kobject_action action);
> +
> +static inline void put_acpi_device(struct acpi_device *adev)
> +{
> +	put_device(&adev->dev);
> +}

This should probably go to acpi_bus.h under acpi_dev_get_first_match_dev().
And talking to Mika we agreed that naming would be better as acpi_dev_put().

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-05 14:50   ` Andy Shevchenko
@ 2019-04-11 23:09     ` Rafael J. Wysocki
  2019-04-12 13:13       ` Andy Shevchenko
  0 siblings, 1 reply; 16+ messages in thread
From: Rafael J. Wysocki @ 2019-04-11 23:09 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Yue Haibing, linus.walleij, bgolaszewski, linux-kernel,
	linux-gpio, linux-acpi

On Friday, April 5, 2019 4:50:09 PM CEST Andy Shevchenko wrote:
> On Fri, Apr 05, 2019 at 10:21:12PM +0800, Yue Haibing wrote:
> > From: YueHaibing <yuehaibing@huawei.com>
> > 
> > When building CONFIG_ACPI is not set
> > gcc warn this:
> > 
> > drivers/gpio/gpio-merrifield.c: In function
> > mrfld_gpio_get_pinctrl_dev_name: drivers/gpio/gpio-merrifield.c:388:19:
> > error: dereferencing pointer to incomplete type struct acpi_device> 
> >    put_device(&adev->dev);
> >    
> >                    ^
> > 
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Fixes:d00d2109c367 ("gpio: merrifield: Convert to use
> > acpi_dev_get_first_match_dev()") Signed-off-by: YueHaibing
> > <yuehaibing@huawei.com>
> 
> Thank you for an update, I have a comment below, but before sending v3, let
> Rafael to have a chance to look at it.
> 
> >  #ifdef CONFIG_ACPI
> >  extern int acpi_platform_notify(struct device *dev, enum kobject_action
> >  action);> 
> > +
> > +static inline void put_acpi_device(struct acpi_device *adev)
> > +{
> > +	put_device(&adev->dev);
> > +}
> 
> This should probably go to acpi_bus.h under acpi_dev_get_first_match_dev().
> And talking to Mika we agreed that naming would be better as acpi_dev_put().

Agreed on both accounts.

Thanks!





^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-11 23:09     ` Rafael J. Wysocki
@ 2019-04-12 13:13       ` Andy Shevchenko
  2019-04-12 13:26         ` YueHaibing
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2019-04-12 13:13 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Andy Shevchenko, Yue Haibing, Linus Walleij, Bartosz Golaszewski,
	Linux Kernel Mailing List, open list:GPIO SUBSYSTEM,
	ACPI Devel Maling List

On Fri, Apr 12, 2019 at 3:55 AM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Friday, April 5, 2019 4:50:09 PM CEST Andy Shevchenko wrote:
> > On Fri, Apr 05, 2019 at 10:21:12PM +0800, Yue Haibing wrote:
> > > From: YueHaibing <yuehaibing@huawei.com>
> > >
> > > When building CONFIG_ACPI is not set
> > > gcc warn this:
> > >
> > > drivers/gpio/gpio-merrifield.c: In function
> > > mrfld_gpio_get_pinctrl_dev_name: drivers/gpio/gpio-merrifield.c:388:19:
> > > error: dereferencing pointer to incomplete type struct acpi_device>
> > >    put_device(&adev->dev);
> > >
> > >                    ^
> > >
> > > Reported-by: Hulk Robot <hulkci@huawei.com>
> > > Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > Fixes:d00d2109c367 ("gpio: merrifield: Convert to use
> > > acpi_dev_get_first_match_dev()") Signed-off-by: YueHaibing
> > > <yuehaibing@huawei.com>
> >
> > Thank you for an update, I have a comment below, but before sending v3, let
> > Rafael to have a chance to look at it.
> >
> > >  #ifdef CONFIG_ACPI
> > >  extern int acpi_platform_notify(struct device *dev, enum kobject_action
> > >  action);>
> > > +
> > > +static inline void put_acpi_device(struct acpi_device *adev)
> > > +{
> > > +   put_device(&adev->dev);
> > > +}
> >
> > This should probably go to acpi_bus.h under acpi_dev_get_first_match_dev().
> > And talking to Mika we agreed that naming would be better as acpi_dev_put().
>
> Agreed on both accounts.

Thanks!
YueHaibing, please, send v3 with suggested changes.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-12 13:13       ` Andy Shevchenko
@ 2019-04-12 13:26         ` YueHaibing
  0 siblings, 0 replies; 16+ messages in thread
From: YueHaibing @ 2019-04-12 13:26 UTC (permalink / raw)
  To: Andy Shevchenko, Rafael J. Wysocki
  Cc: Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
	Linux Kernel Mailing List, open list:GPIO SUBSYSTEM,
	ACPI Devel Maling List

On 2019/4/12 21:13, Andy Shevchenko wrote:
> On Fri, Apr 12, 2019 at 3:55 AM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>> On Friday, April 5, 2019 4:50:09 PM CEST Andy Shevchenko wrote:
>>> On Fri, Apr 05, 2019 at 10:21:12PM +0800, Yue Haibing wrote:
>>>> From: YueHaibing <yuehaibing@huawei.com>
>>>>
>>>> When building CONFIG_ACPI is not set
>>>> gcc warn this:
>>>>
>>>> drivers/gpio/gpio-merrifield.c: In function
>>>> mrfld_gpio_get_pinctrl_dev_name: drivers/gpio/gpio-merrifield.c:388:19:
>>>> error: dereferencing pointer to incomplete type struct acpi_device>
>>>>    put_device(&adev->dev);
>>>>
>>>>                    ^
>>>>
>>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>>> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>>>> Fixes:d00d2109c367 ("gpio: merrifield: Convert to use
>>>> acpi_dev_get_first_match_dev()") Signed-off-by: YueHaibing
>>>> <yuehaibing@huawei.com>
>>>
>>> Thank you for an update, I have a comment below, but before sending v3, let
>>> Rafael to have a chance to look at it.
>>>
>>>>  #ifdef CONFIG_ACPI
>>>>  extern int acpi_platform_notify(struct device *dev, enum kobject_action
>>>>  action);>
>>>> +
>>>> +static inline void put_acpi_device(struct acpi_device *adev)
>>>> +{
>>>> +   put_device(&adev->dev);
>>>> +}
>>>
>>> This should probably go to acpi_bus.h under acpi_dev_get_first_match_dev().
>>> And talking to Mika we agreed that naming would be better as acpi_dev_put().
>>
>> Agreed on both accounts.
> 
> Thanks!
> YueHaibing, please, send v3 with suggested changes.

Ok.

> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-05 14:21 ` [PATCH v2] " Yue Haibing
  2019-04-05 14:50   ` Andy Shevchenko
@ 2019-04-12 15:19   ` Yue Haibing
  2019-04-12 17:56     ` Andy Shevchenko
  2019-04-23  9:17     ` Linus Walleij
  1 sibling, 2 replies; 16+ messages in thread
From: Yue Haibing @ 2019-04-12 15:19 UTC (permalink / raw)
  To: andriy.shevchenko, linus.walleij, bgolaszewski, rjw
  Cc: linux-kernel, linux-gpio, linux-acpi, YueHaibing

From: YueHaibing <yuehaibing@huawei.com>

When building CONFIG_ACPI is not set
gcc warn this:

drivers/gpio/gpio-merrifield.c: In function mrfld_gpio_get_pinctrl_dev_name:
drivers/gpio/gpio-merrifield.c:388:19: error: dereferencing pointer to incomplete type struct acpi_device
   put_device(&adev->dev);
                   ^~

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes:d00d2109c367 ("gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()")
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v3: move helper to acpi_bus.h, and change name to acpi_dev_put
---
 drivers/gpio/gpio-merrifield.c | 2 +-
 include/acpi/acpi_bus.h        | 4 ++++
 include/linux/acpi.h           | 2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
index 2383dc7..3302125 100644
--- a/drivers/gpio/gpio-merrifield.c
+++ b/drivers/gpio/gpio-merrifield.c
@@ -385,7 +385,7 @@ static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
 	adev = acpi_dev_get_first_match_dev("INTC1002", NULL, -1);
 	if (adev) {
 		name = devm_kstrdup(priv->dev, acpi_dev_name(adev), GFP_KERNEL);
-		put_device(&adev->dev);
+		acpi_dev_put(adev);
 	} else {
 		name = "pinctrl-merrifield";
 	}
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index f798175..2a462cf 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -687,6 +687,10 @@ static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
 		adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set);
 }
 
+static inline void acpi_dev_put(struct acpi_device *adev)
+{
+	put_device(&adev->dev);
+}
 #else	/* CONFIG_ACPI */
 
 static inline int register_acpi_bus_type(void *bus) { return 0; }
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index a1bd789..e22c237 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -679,6 +679,8 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
 	return NULL;
 }
 
+static inline void acpi_dev_put(struct acpi_device *adev) {}
+
 static inline bool is_acpi_node(struct fwnode_handle *fwnode)
 {
 	return false;
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v3] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-12 15:19   ` [PATCH v3] " Yue Haibing
@ 2019-04-12 17:56     ` Andy Shevchenko
  2019-04-23  9:17     ` Linus Walleij
  1 sibling, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2019-04-12 17:56 UTC (permalink / raw)
  To: Yue Haibing
  Cc: linus.walleij, bgolaszewski, rjw, linux-kernel, linux-gpio, linux-acpi

On Fri, Apr 12, 2019 at 11:19:11PM +0800, Yue Haibing wrote:
> From: YueHaibing <yuehaibing@huawei.com>
> 
> When building CONFIG_ACPI is not set
> gcc warn this:
> 
> drivers/gpio/gpio-merrifield.c: In function mrfld_gpio_get_pinctrl_dev_name:
> drivers/gpio/gpio-merrifield.c:388:19: error: dereferencing pointer to incomplete type struct acpi_device
>    put_device(&adev->dev);
>                    ^~
> 

Thank you.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes:d00d2109c367 ("gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()")
> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> v3: move helper to acpi_bus.h, and change name to acpi_dev_put
> ---
>  drivers/gpio/gpio-merrifield.c | 2 +-
>  include/acpi/acpi_bus.h        | 4 ++++
>  include/linux/acpi.h           | 2 ++
>  3 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
> index 2383dc7..3302125 100644
> --- a/drivers/gpio/gpio-merrifield.c
> +++ b/drivers/gpio/gpio-merrifield.c
> @@ -385,7 +385,7 @@ static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
>  	adev = acpi_dev_get_first_match_dev("INTC1002", NULL, -1);
>  	if (adev) {
>  		name = devm_kstrdup(priv->dev, acpi_dev_name(adev), GFP_KERNEL);
> -		put_device(&adev->dev);
> +		acpi_dev_put(adev);
>  	} else {
>  		name = "pinctrl-merrifield";
>  	}
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index f798175..2a462cf 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -687,6 +687,10 @@ static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
>  		adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set);
>  }
>  
> +static inline void acpi_dev_put(struct acpi_device *adev)
> +{
> +	put_device(&adev->dev);
> +}
>  #else	/* CONFIG_ACPI */
>  
>  static inline int register_acpi_bus_type(void *bus) { return 0; }
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index a1bd789..e22c237 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -679,6 +679,8 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
>  	return NULL;
>  }
>  
> +static inline void acpi_dev_put(struct acpi_device *adev) {}
> +
>  static inline bool is_acpi_node(struct fwnode_handle *fwnode)
>  {
>  	return false;
> -- 
> 2.7.4
> 
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-12 15:19   ` [PATCH v3] " Yue Haibing
  2019-04-12 17:56     ` Andy Shevchenko
@ 2019-04-23  9:17     ` Linus Walleij
  2019-04-26 12:23       ` Andy Shevchenko
  1 sibling, 1 reply; 16+ messages in thread
From: Linus Walleij @ 2019-04-23  9:17 UTC (permalink / raw)
  To: Yue Haibing
  Cc: Andy Shevchenko, Bartosz Golaszewski, Rafael J. Wysocki,
	linux-kernel, open list:GPIO SUBSYSTEM, ACPI Devel Maling List

On Fri, Apr 12, 2019 at 5:20 PM Yue Haibing <yuehaibing@huawei.com> wrote:

> From: YueHaibing <yuehaibing@huawei.com>
>
> When building CONFIG_ACPI is not set
> gcc warn this:
>
> drivers/gpio/gpio-merrifield.c: In function mrfld_gpio_get_pinctrl_dev_name:
> drivers/gpio/gpio-merrifield.c:388:19: error: dereferencing pointer to incomplete type struct acpi_device
>    put_device(&adev->dev);
>                    ^~
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes:d00d2109c367 ("gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()")
> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

This doesn't apply cleanly to any GPIO branch (devel or fixes)
so I assume it is supposed to be applied to the ACPI tree.
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-23  9:17     ` Linus Walleij
@ 2019-04-26 12:23       ` Andy Shevchenko
  2019-04-29  8:40         ` Rafael J. Wysocki
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2019-04-26 12:23 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Yue Haibing, Bartosz Golaszewski, Rafael J. Wysocki,
	linux-kernel, open list:GPIO SUBSYSTEM, ACPI Devel Maling List

On Tue, Apr 23, 2019 at 11:17:32AM +0200, Linus Walleij wrote:
> On Fri, Apr 12, 2019 at 5:20 PM Yue Haibing <yuehaibing@huawei.com> wrote:
> 
> > From: YueHaibing <yuehaibing@huawei.com>
> >
> > When building CONFIG_ACPI is not set
> > gcc warn this:
> >
> > drivers/gpio/gpio-merrifield.c: In function mrfld_gpio_get_pinctrl_dev_name:
> > drivers/gpio/gpio-merrifield.c:388:19: error: dereferencing pointer to incomplete type struct acpi_device
> >    put_device(&adev->dev);
> >                    ^~
> >
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Fixes:d00d2109c367 ("gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()")
> > Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> 
> This doesn't apply cleanly to any GPIO branch (devel or fixes)
> so I assume it is supposed to be applied to the ACPI tree.
> Acked-by: Linus Walleij <linus.walleij@linaro.org>

Thanks!
Rafael, can this be applied to your tree?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3] gpio: merrifield: Fix build err without CONFIG_ACPI
  2019-04-26 12:23       ` Andy Shevchenko
@ 2019-04-29  8:40         ` Rafael J. Wysocki
  0 siblings, 0 replies; 16+ messages in thread
From: Rafael J. Wysocki @ 2019-04-29  8:40 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Linus Walleij, Yue Haibing, Bartosz Golaszewski, linux-kernel,
	open list:GPIO SUBSYSTEM, ACPI Devel Maling List

On Friday, April 26, 2019 2:23:17 PM CEST Andy Shevchenko wrote:
> On Tue, Apr 23, 2019 at 11:17:32AM +0200, Linus Walleij wrote:
> > On Fri, Apr 12, 2019 at 5:20 PM Yue Haibing <yuehaibing@huawei.com> wrote:
> > 
> > > From: YueHaibing <yuehaibing@huawei.com>
> > >
> > > When building CONFIG_ACPI is not set
> > > gcc warn this:
> > >
> > > drivers/gpio/gpio-merrifield.c: In function mrfld_gpio_get_pinctrl_dev_name:
> > > drivers/gpio/gpio-merrifield.c:388:19: error: dereferencing pointer to incomplete type struct acpi_device
> > >    put_device(&adev->dev);
> > >                    ^~
> > >
> > > Reported-by: Hulk Robot <hulkci@huawei.com>
> > > Fixes:d00d2109c367 ("gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()")
> > > Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > 
> > This doesn't apply cleanly to any GPIO branch (devel or fixes)
> > so I assume it is supposed to be applied to the ACPI tree.
> > Acked-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Thanks!
> Rafael, can this be applied to your tree?

Done already, thanks!




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-04-29  8:40 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-04 10:39 [PATCH] gpio: merrifield: Fix build err without CONFIG_ACPI Yue Haibing
2019-04-04 11:40 ` Mukesh Ojha
2019-04-04 11:44 ` Andy Shevchenko
2019-04-04 14:04 ` YueHaibing
2019-04-05 10:07   ` Andy Shevchenko
2019-04-05 12:11     ` YueHaibing
2019-04-05 14:21 ` [PATCH v2] " Yue Haibing
2019-04-05 14:50   ` Andy Shevchenko
2019-04-11 23:09     ` Rafael J. Wysocki
2019-04-12 13:13       ` Andy Shevchenko
2019-04-12 13:26         ` YueHaibing
2019-04-12 15:19   ` [PATCH v3] " Yue Haibing
2019-04-12 17:56     ` Andy Shevchenko
2019-04-23  9:17     ` Linus Walleij
2019-04-26 12:23       ` Andy Shevchenko
2019-04-29  8:40         ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).