* [PATCH] mfd: ab8500-sysctrl: Handle probe deferral
@ 2017-01-13 9:53 Linus Walleij
2017-01-13 16:06 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2017-01-13 9:53 UTC (permalink / raw)
To: lee.jones, linux-kernel; +Cc: Linus Walleij
In the current boot, clients making use of the AB8500 sysctrl
may be probed before the ab8500-sysctrl driver. This gives them
-EINVAL, but should rather give -EPROBE_DEFER.
Before this, the abx500 clock driver didn't probe properly,
and as a result the codec driver in turn using the clocks did
not probe properly. After this patch, everything probes
properly.
Also add OF compatible-string probing. This driver is all
device tree, so let's just make a drive-by-fix of that as
well.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/mfd/ab8500-sysctrl.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
index 80c0efa66ac1..5b0a0850ef69 100644
--- a/drivers/mfd/ab8500-sysctrl.c
+++ b/drivers/mfd/ab8500-sysctrl.c
@@ -101,7 +101,7 @@ int ab8500_sysctrl_read(u16 reg, u8 *value)
u8 bank;
if (sysctrl_dev == NULL)
- return -EINVAL;
+ return -EPROBE_DEFER;
bank = (reg >> 8);
if (!valid_bank(bank))
@@ -117,11 +117,13 @@ int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value)
u8 bank;
if (sysctrl_dev == NULL)
- return -EINVAL;
+ return -EPROBE_DEFER;
bank = (reg >> 8);
- if (!valid_bank(bank))
+ if (!valid_bank(bank)) {
+ pr_err("invalid bank\n");
return -EINVAL;
+ }
return abx500_mask_and_set_register_interruptible(sysctrl_dev, bank,
(u8)(reg & 0xFF), mask, value);
@@ -148,9 +150,15 @@ static int ab8500_sysctrl_remove(struct platform_device *pdev)
return 0;
}
+static const struct of_device_id ab8500_sysctrl_match[] = {
+ { .compatible = "stericsson,ab8500-sysctrl", },
+ {}
+};
+
static struct platform_driver ab8500_sysctrl_driver = {
.driver = {
.name = "ab8500-sysctrl",
+ .of_match_table = ab8500_sysctrl_match,
},
.probe = ab8500_sysctrl_probe,
.remove = ab8500_sysctrl_remove,
--
2.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: ab8500-sysctrl: Handle probe deferral
2017-01-13 9:53 [PATCH] mfd: ab8500-sysctrl: Handle probe deferral Linus Walleij
@ 2017-01-13 16:06 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2017-01-13 16:06 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-kernel
On Fri, 13 Jan 2017, Linus Walleij wrote:
> In the current boot, clients making use of the AB8500 sysctrl
> may be probed before the ab8500-sysctrl driver. This gives them
> -EINVAL, but should rather give -EPROBE_DEFER.
>
> Before this, the abx500 clock driver didn't probe properly,
> and as a result the codec driver in turn using the clocks did
> not probe properly. After this patch, everything probes
> properly.
>
> Also add OF compatible-string probing. This driver is all
> device tree, so let's just make a drive-by-fix of that as
> well.
Sneaky! I usually ask for separate patches for this kind of stuff.
But hey, it's (just after) Christmas.
Applied, thanks.
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/mfd/ab8500-sysctrl.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
> index 80c0efa66ac1..5b0a0850ef69 100644
> --- a/drivers/mfd/ab8500-sysctrl.c
> +++ b/drivers/mfd/ab8500-sysctrl.c
> @@ -101,7 +101,7 @@ int ab8500_sysctrl_read(u16 reg, u8 *value)
> u8 bank;
>
> if (sysctrl_dev == NULL)
> - return -EINVAL;
> + return -EPROBE_DEFER;
>
> bank = (reg >> 8);
> if (!valid_bank(bank))
> @@ -117,11 +117,13 @@ int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value)
> u8 bank;
>
> if (sysctrl_dev == NULL)
> - return -EINVAL;
> + return -EPROBE_DEFER;
>
> bank = (reg >> 8);
> - if (!valid_bank(bank))
> + if (!valid_bank(bank)) {
> + pr_err("invalid bank\n");
> return -EINVAL;
> + }
>
> return abx500_mask_and_set_register_interruptible(sysctrl_dev, bank,
> (u8)(reg & 0xFF), mask, value);
> @@ -148,9 +150,15 @@ static int ab8500_sysctrl_remove(struct platform_device *pdev)
> return 0;
> }
>
> +static const struct of_device_id ab8500_sysctrl_match[] = {
> + { .compatible = "stericsson,ab8500-sysctrl", },
> + {}
> +};
> +
> static struct platform_driver ab8500_sysctrl_driver = {
> .driver = {
> .name = "ab8500-sysctrl",
> + .of_match_table = ab8500_sysctrl_match,
> },
> .probe = ab8500_sysctrl_probe,
> .remove = ab8500_sysctrl_remove,
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-13 16:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 9:53 [PATCH] mfd: ab8500-sysctrl: Handle probe deferral Linus Walleij
2017-01-13 16:06 ` Lee Jones
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).