linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] driver core: platform: Make use of the helper function dev_err_probe()
@ 2021-11-05  3:09 Cai Huoqing
  2021-11-05  6:54 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Cai Huoqing @ 2021-11-05  3:09 UTC (permalink / raw)
  To: caihuoqing; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki, linux-kernel

When possible using dev_err_probe() helps to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
BTW rename 'dev' to 'pdev'.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/base/platform.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 598acf93a360..5befd3258677 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -253,13 +253,14 @@ EXPORT_SYMBOL_GPL(platform_get_irq_optional);
  *
  * Return: non-zero IRQ number on success, negative error number on failure.
  */
-int platform_get_irq(struct platform_device *dev, unsigned int num)
+int platform_get_irq(struct platform_device *pdev, unsigned int num)
 {
 	int ret;
 
-	ret = platform_get_irq_optional(dev, num);
-	if (ret < 0 && ret != -EPROBE_DEFER)
-		dev_err(&dev->dev, "IRQ index %u not found\n", num);
+	ret = platform_get_irq_optional(pdev, num);
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret,
+				     "IRQ index %u not found\n", num);
 
 	return ret;
 }
-- 
2.25.1


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

* Re: [PATCH] driver core: platform: Make use of the helper function dev_err_probe()
  2021-11-05  3:09 [PATCH] driver core: platform: Make use of the helper function dev_err_probe() Cai Huoqing
@ 2021-11-05  6:54 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-05  6:54 UTC (permalink / raw)
  To: Cai Huoqing; +Cc: Rafael J. Wysocki, linux-kernel

On Fri, Nov 05, 2021 at 11:09:59AM +0800, Cai Huoqing wrote:
> When possible using dev_err_probe() helps to properly deal with the
> PROBE_DEFER error, the benefit is that DEFER issue will be logged
> in the devices_deferred debugfs file.
> BTW rename 'dev' to 'pdev'.

"BTW"???

> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
>  drivers/base/platform.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 598acf93a360..5befd3258677 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -253,13 +253,14 @@ EXPORT_SYMBOL_GPL(platform_get_irq_optional);
>   *
>   * Return: non-zero IRQ number on success, negative error number on failure.
>   */
> -int platform_get_irq(struct platform_device *dev, unsigned int num)
> +int platform_get_irq(struct platform_device *pdev, unsigned int num)

Why change the variable name?  It has nothing to do with this change,
please do not do that.

thanks,

greg k-h

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

end of thread, other threads:[~2021-11-05  6:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05  3:09 [PATCH] driver core: platform: Make use of the helper function dev_err_probe() Cai Huoqing
2021-11-05  6:54 ` Greg Kroah-Hartman

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).