commit: http://blackfin.uclinux.org/git/?p=linux-kernel;a=commitdiff;h=1aef30b6f92d6e9cd2d92b4b623cd944a68559b1
branch: http://blackfin.uclinux.org/git/?p=linux-kernel;a=shortlog;h=refs/heads/trunk

We can't get correct device id on bf609 lcd board when read adxl345
at first time.Try one more time we can get what we expect.

Signed-off-by: Scott Jiang <[email protected]>
---
 drivers/input/misc/adxl34x.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
index 1cf72fe..d1b2d8c 100644
--- a/drivers/input/misc/adxl34x.c
+++ b/drivers/input/misc/adxl34x.c
@@ -698,6 +698,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
 	const struct adxl34x_platform_data *pdata;
 	int err, range, i;
 	unsigned char revid;
+	int retry = 1;
 
 	if (!irq) {
 		dev_err(dev, "no IRQ?\n");
@@ -732,7 +733,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
 	mutex_init(&ac->mutex);
 
 	input_dev->name = "ADXL34x accelerometer";
-	revid = ac->bops->read(dev, DEVID);
+retry:	revid = ac->bops->read(dev, DEVID);
 
 	switch (revid) {
 	case ID_ADXL345:
@@ -742,6 +743,11 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
 		ac->model = 346;
 		break;
 	default:
+		/* it can't get devid at first time on bf609 lcd board */
+		if (retry) {
+			retry--;
+			goto retry;
+		}
 		dev_err(dev, "Failed to probe %s\n", input_dev->name);
 		err = -ENODEV;
 		goto err_free_mem;
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to