aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Barnaś2024-02-19 16:32:02 +0000
committerTom Rini2024-03-05 08:08:26 -0500
commitc4841ae4059f5eb46af38f53793f772e3dac140b (patch)
tree6fce70eaca912cf77acc4f979f3af87343077325
parent0cfc2e9225fb682a1a5b3e5d49af8ebf8d893cef (diff)
misc: atsha204a: remove broken for loop
Some previous commit changed the continue statement to return, making the for loop used to retry waking up the chip to always return after one iteration. This commit removes the loop, cleaning the code a little. Signed-off-by: Michał Barnaś <barnas@google.com>
-rw-r--r--drivers/misc/atsha204a-i2c.c45
1 files changed, 19 insertions, 26 deletions
diff --git a/drivers/misc/atsha204a-i2c.c b/drivers/misc/atsha204a-i2c.c
index d3c515828ff..ab83bbc3e95 100644
--- a/drivers/misc/atsha204a-i2c.c
+++ b/drivers/misc/atsha204a-i2c.c
@@ -96,40 +96,33 @@ int atsha204a_wakeup(struct udevice *dev)
{
u8 req[4];
struct atsha204a_resp resp;
- int try, res;
+ int res;
debug("Waking up ATSHA204A\n");
- for (try = 1; try <= 10; ++try) {
- debug("Try %i... ", try);
-
- /*
- * The device ignores any levels or transitions on the SCL pin
- * when the device is idle, asleep or during waking up.
- * Don't check for error when waking up the device.
- */
- memset(req, 0, 4);
- atsha204a_send(dev, req, 4);
+ /*
+ * The device ignores any levels or transitions on the SCL pin
+ * when the device is idle, asleep or during waking up.
+ * Don't check for error when waking up the device.
+ */
+ memset(req, 0, 4);
+ atsha204a_send(dev, req, 4);
- udelay(ATSHA204A_TWLO_US + ATSHA204A_TWHI_US);
+ udelay(ATSHA204A_TWLO_US + ATSHA204A_TWHI_US);
- res = atsha204a_recv_resp(dev, &resp);
- if (res) {
- debug("failed on receiving response, ending\n");
- return res;
- }
-
- if (resp.code != ATSHA204A_STATUS_AFTER_WAKE) {
- debug ("failed (responce code = %02x), ending\n",
- resp.code);
- return -EBADMSG;
- }
+ res = atsha204a_recv_resp(dev, &resp);
+ if (res) {
+ debug("failed on receiving response, ending\n");
+ return res;
+ }
- debug("success\n");
- return 0;
+ if (resp.code != ATSHA204A_STATUS_AFTER_WAKE) {
+ debug("failed (response code = %02x), ending\n", resp.code);
+ return -EBADMSG;
}
- return -ETIMEDOUT;
+ debug("success\n");
+ return 0;
}
int atsha204a_idle(struct udevice *dev)