Commit 3dfa743d authored by Charles Keepax's avatar Charles Keepax Committed by Chanwoo Choi
Browse files

extcon: arizona: Invert logic of check in arizona_hpdet_do_id



Invert the check of hpdet_acc_id at the top of arizona_hpdet_do_id to
reduce the identation within the function.

Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
parent 8267ebcc
Loading
Loading
Loading
Loading
+45 −47
Original line number Diff line number Diff line
@@ -533,11 +533,13 @@ static int arizona_hpdet_do_id(struct arizona_extcon_info *info, int *reading,
	struct arizona *arizona = info->arizona;
	int id_gpio = arizona->pdata.hpdet_id_gpio;

	if (!arizona->pdata.hpdet_acc_id)
		return 0;

	/*
	 * If we're using HPDET for accessory identification we need
	 * to take multiple measurements, step through them in sequence.
	 */
	if (arizona->pdata.hpdet_acc_id) {
	info->hpdet_res[info->num_hpdet_res++] = *reading;

	/* Only check the mic directly if we didn't already ID it */
@@ -553,8 +555,7 @@ static int arizona_hpdet_do_id(struct arizona_extcon_info *info, int *reading,

		gpio_set_value_cansleep(id_gpio, 1);

			regmap_update_bits(arizona->regmap,
					   ARIZONA_HEADPHONE_DETECT_1,
		regmap_update_bits(arizona->regmap, ARIZONA_HEADPHONE_DETECT_1,
				   ARIZONA_HP_POLL, ARIZONA_HP_POLL);
		return -EAGAIN;
	}
@@ -588,11 +589,8 @@ static int arizona_hpdet_do_id(struct arizona_extcon_info *info, int *reading,
	}

	/* Make sure everything is reset back to the real polarity */
		regmap_update_bits(arizona->regmap,
				   ARIZONA_ACCESSORY_DETECT_MODE_1,
				   ARIZONA_ACCDET_SRC,
				   info->micd_modes[0].src);
	}
	regmap_update_bits(arizona->regmap, ARIZONA_ACCESSORY_DETECT_MODE_1,
			   ARIZONA_ACCDET_SRC, info->micd_modes[0].src);

	return 0;
}