lkml.org 
[lkml]   [2018]   [Dec]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] driver core: platform: Add an error message to platform_get_irq*()
On Fri, Dec 28, 2018 at 11:56 PM Stephen Boyd <swboyd@chromium.org> wrote:
>
> A grep of the kernel shows that many drivers print an error message if
> they fail to get the irq they're looking for. Furthermore, those drivers
> all decide to print the device name, or not, and the irq they were
> requesting, or not, etc. Let's consolidate all these error messages into
> the API itself, allowing us to get rid of the error messages in each
> driver.

> +static int __platform_get_irq(struct platform_device *dev, unsigned int num, bool warn)
> {

> +error:
> + if (warn)
> + dev_err(&dev->dev, "IRQ index %u not found\n", num);
> +
> + return ret;
> +}
> +
> +/**
> + * platform_get_irq - get an IRQ for a device
> + * @dev: platform device
> + * @num: IRQ number index
> + */
> +int platform_get_irq(struct platform_device *dev, unsigned int num)
> +{
> + return __platform_get_irq(dev, num, true);

Hmm... Why not just do
int ret = __plaform_get_irq();
if (ret)
dev_err();
return ret;

instead of big refactoring of platform_get_irq()?

> }



--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2018-12-30 11:42    [W:0.148 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site