Skip to content

Commit 8800aba

Browse files
Linus Walleijgregkh
authored andcommitted
mfd: ab8500-sysctrl: Handle probe deferral
[ Upstream commit 7e9c40c63933a643908d686bd89dfc2315e8c70a ] 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> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ed414ae commit 8800aba

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

drivers/mfd/ab8500-sysctrl.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int ab8500_sysctrl_read(u16 reg, u8 *value)
9999
u8 bank;
100100

101101
if (sysctrl_dev == NULL)
102-
return -EINVAL;
102+
return -EPROBE_DEFER;
103103

104104
bank = (reg >> 8);
105105
if (!valid_bank(bank))
@@ -115,11 +115,13 @@ int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value)
115115
u8 bank;
116116

117117
if (sysctrl_dev == NULL)
118-
return -EINVAL;
118+
return -EPROBE_DEFER;
119119

120120
bank = (reg >> 8);
121-
if (!valid_bank(bank))
121+
if (!valid_bank(bank)) {
122+
pr_err("invalid bank\n");
122123
return -EINVAL;
124+
}
123125

124126
return abx500_mask_and_set_register_interruptible(sysctrl_dev, bank,
125127
(u8)(reg & 0xFF), mask, value);
@@ -180,9 +182,15 @@ static int ab8500_sysctrl_remove(struct platform_device *pdev)
180182
return 0;
181183
}
182184

185+
static const struct of_device_id ab8500_sysctrl_match[] = {
186+
{ .compatible = "stericsson,ab8500-sysctrl", },
187+
{}
188+
};
189+
183190
static struct platform_driver ab8500_sysctrl_driver = {
184191
.driver = {
185192
.name = "ab8500-sysctrl",
193+
.of_match_table = ab8500_sysctrl_match,
186194
},
187195
.probe = ab8500_sysctrl_probe,
188196
.remove = ab8500_sysctrl_remove,

0 commit comments

Comments
 (0)