* [PATCH] pwm: lpss-platform: Cleanly exit probe on boards without resources
@ 2018-01-12 11:38 Hans de Goede
2018-01-12 13:04 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2018-01-12 11:38 UTC (permalink / raw)
To: Thierry Reding, Andy Shevchenko; +Cc: Hans de Goede, linux-pwm
Some boards which do not use the pwm-controller have an empty or invalid
resource-table in ACPI the for pwm-controller. Currently this causes these
error messages to get logged:
[ 3.281966] pwm-lpss 80862288:00: invalid resource
[ 3.287098] pwm-lpss: probe of 80862288:00 failed with error -22
This commit silences these error messages on these boards by cleanly
exiting pwm_lpss_probe_platform() if there is no memory resource.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/pwm/pwm-lpss-platform.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/pwm/pwm-lpss-platform.c b/drivers/pwm/pwm-lpss-platform.c
index 5d6ed1507d29..5e5f4d018178 100644
--- a/drivers/pwm/pwm-lpss-platform.c
+++ b/drivers/pwm/pwm-lpss-platform.c
@@ -52,7 +52,14 @@ static int pwm_lpss_probe_platform(struct platform_device *pdev)
return -ENODEV;
info = (const struct pwm_lpss_boardinfo *)id->driver_data;
+
+ /*
+ * Some boards which don't use the pwm controller have an empty
+ * resources table, so if we cannot get the resource, return -ENODEV.
+ */
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!r)
+ return -ENODEV;
lpwm = pwm_lpss_probe(&pdev->dev, r, info);
if (IS_ERR(lpwm))
--
2.14.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pwm: lpss-platform: Cleanly exit probe on boards without resources
2018-01-12 11:38 [PATCH] pwm: lpss-platform: Cleanly exit probe on boards without resources Hans de Goede
@ 2018-01-12 13:04 ` Andy Shevchenko
2018-01-14 19:58 ` Hans de Goede
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2018-01-12 13:04 UTC (permalink / raw)
To: Hans de Goede, Thierry Reding; +Cc: linux-pwm, Mika Westerberg
+Cc: Mika
On Fri, 2018-01-12 at 12:38 +0100, Hans de Goede wrote:
> Some boards which do not use the pwm-controller have an empty or
> invalid
> resource-table in ACPI the for pwm-controller. Currently this causes
> these
> error messages to get logged:
> [ 3.281966] pwm-lpss 80862288:00: invalid resource
> [ 3.287098] pwm-lpss: probe of 80862288:00 failed with error -22
>
> This commit silences these error messages on these boards by cleanly
> exiting pwm_lpss_probe_platform() if there is no memory resource.
>
I don't see anything wrong with message per se.
> +
> + /*
> + * Some boards which don't use the pwm controller have an
> empty
> + * resources table, so if we cannot get the resource, return
> -ENODEV.
> + */
> r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!r)
> + return -ENODEV;
But this one looks like a quirk for some platforms when other can
survive without.
Can we actually check this in acpi_lpss.c and prevent platform device
registration at all?
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pwm: lpss-platform: Cleanly exit probe on boards without resources
2018-01-12 13:04 ` Andy Shevchenko
@ 2018-01-14 19:58 ` Hans de Goede
0 siblings, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2018-01-14 19:58 UTC (permalink / raw)
To: Andy Shevchenko, Thierry Reding; +Cc: linux-pwm, Mika Westerberg
Hi,
On 12-01-18 14:04, Andy Shevchenko wrote:
> +Cc: Mika
>
> On Fri, 2018-01-12 at 12:38 +0100, Hans de Goede wrote:
>> Some boards which do not use the pwm-controller have an empty or
>> invalid
>> resource-table in ACPI the for pwm-controller. Currently this causes
>> these
>> error messages to get logged:
>> [ 3.281966] pwm-lpss 80862288:00: invalid resource
>> [ 3.287098] pwm-lpss: probe of 80862288:00 failed with error -22
>>
>> This commit silences these error messages on these boards by cleanly
>> exiting pwm_lpss_probe_platform() if there is no memory resource.
>>
>
> I don't see anything wrong with message per se.
Given all the effort distros have done with splash-screens to give
users a nice clean boot experience, we really want dmesg --level=err
to not print anything unless there is a real problem with either the
hardware or the kernel.
(Note that plymouth will drop back to text-mode when kernel errors
do show up.)
>> +
>> + /*
>> + * Some boards which don't use the pwm controller have an
>> empty
>> + * resources table, so if we cannot get the resource, return
>> -ENODEV.
>> + */
>> r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> + if (!r)
>> + return -ENODEV;
>
> But this one looks like a quirk for some platforms when other can
> survive without.
Right, this is something platform specific, but on platforms which
have a proper resource for the PWM this patch is a no-op, so there
is no need to do a quirk table for this, we can just silence the
error and be done with it.
> Can we actually check this in acpi_lpss.c and prevent platform device
> registration at all?
That is a good idea, it was not entirely trivial to achieve this
but I've come up with a patch which does that. If that is deemed
acceptable then we can go with that patch instead.
Regards,
Hans
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-14 19:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-12 11:38 [PATCH] pwm: lpss-platform: Cleanly exit probe on boards without resources Hans de Goede
2018-01-12 13:04 ` Andy Shevchenko
2018-01-14 19:58 ` Hans de Goede
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.