diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-02-04 15:09:38 -0500 |
---|---|---|
committer | Samuel Ortiz <samuel@sortiz.org> | 2009-02-17 03:00:12 -0500 |
commit | 85c93ea7dca475a6ee3bf414befe94b2c42f1001 (patch) | |
tree | f1b47f8eb9e8d7c19f6e61e40a2835a9e8f3a045 /drivers/mfd/wm8350-core.c | |
parent | 62571c29a8343839e85e741db6a489f30686697c (diff) |
mfd: Improve diagnostics for WM8350 ID register probe
Check the return value of the device I/O functions when reading the
ID registers so we can provide a more useful diagnostic when we're
having trouble talking to the device.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
Diffstat (limited to 'drivers/mfd/wm8350-core.c')
-rw-r--r-- | drivers/mfd/wm8350-core.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c index 70f5e7739546..e5e82c7cc523 100644 --- a/drivers/mfd/wm8350-core.c +++ b/drivers/mfd/wm8350-core.c | |||
@@ -1297,14 +1297,29 @@ static void wm8350_client_dev_register(struct wm8350 *wm8350, | |||
1297 | int wm8350_device_init(struct wm8350 *wm8350, int irq, | 1297 | int wm8350_device_init(struct wm8350 *wm8350, int irq, |
1298 | struct wm8350_platform_data *pdata) | 1298 | struct wm8350_platform_data *pdata) |
1299 | { | 1299 | { |
1300 | int ret = -EINVAL; | 1300 | int ret; |
1301 | u16 id1, id2, mask_rev; | 1301 | u16 id1, id2, mask_rev; |
1302 | u16 cust_id, mode, chip_rev; | 1302 | u16 cust_id, mode, chip_rev; |
1303 | 1303 | ||
1304 | /* get WM8350 revision and config mode */ | 1304 | /* get WM8350 revision and config mode */ |
1305 | wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1); | 1305 | ret = wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1); |
1306 | wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2); | 1306 | if (ret != 0) { |
1307 | wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), &mask_rev); | 1307 | dev_err(wm8350->dev, "Failed to read ID: %d\n", ret); |
1308 | goto err; | ||
1309 | } | ||
1310 | |||
1311 | ret = wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2); | ||
1312 | if (ret != 0) { | ||
1313 | dev_err(wm8350->dev, "Failed to read ID: %d\n", ret); | ||
1314 | goto err; | ||
1315 | } | ||
1316 | |||
1317 | ret = wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), | ||
1318 | &mask_rev); | ||
1319 | if (ret != 0) { | ||
1320 | dev_err(wm8350->dev, "Failed to read revision: %d\n", ret); | ||
1321 | goto err; | ||
1322 | } | ||
1308 | 1323 | ||
1309 | id1 = be16_to_cpu(id1); | 1324 | id1 = be16_to_cpu(id1); |
1310 | id2 = be16_to_cpu(id2); | 1325 | id2 = be16_to_cpu(id2); |