Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 240f57eb authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: smb1360-charger-fg: Fix the initialization sequence in probe"

parents f9ecdee0 ecedd3d6
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -963,7 +963,7 @@ static int smb1360_alloc_otp_backup_register(struct smb1360_chip *chip,
	rc = pool->start_now;
	inv_pos = pool->reg_end - pool->start_now + 1;
	for (i = 0; i < size; i = i + 2) {
		inv_pos -= i;
		inv_pos -= (i ?  2 : 0);
		pool->alg_bitmap |= usage << (inv_pos - 2);
	}
	pr_debug("Allocation success, start = 0x%x, size = %d, alg_bitmap = 0x%x\n",
@@ -4902,13 +4902,6 @@ static int smb1360_probe(struct i2c_client *client,
		return -ENOMEM;
	}

	/* probe the device to check if its actually connected */
	rc = smb1360_read(chip, CFG_BATT_CHG_REG, &reg);
	if (rc) {
		pr_err("Failed to detect SMB1360, device may be absent\n");
		return -ENODEV;
	}

	chip->resume_completed = true;
	chip->client = client;
	chip->dev = &client->dev;
@@ -4927,6 +4920,13 @@ static int smb1360_probe(struct i2c_client *client,
	init_completion(&chip->fg_mem_access_granted);
	smb1360_wakeup_src_init(chip);

	/* probe the device to check if its actually connected */
	rc = smb1360_read(chip, CFG_BATT_CHG_REG, &reg);
	if (rc) {
		pr_err("Failed to detect SMB1360, device may be absent\n");
		goto destroy_mutex;
	}

	rc = read_revision(chip, &chip->revision);
	if (rc)
		dev_err(chip->dev, "Couldn't read revision rc = %d\n", rc);