inline int htc_battery_cell_find_and_set_id_auto(int id_raw)
{
	static int unknown_count = 0;
	struct htc_battery_cell *pcell = NULL;

	pcell = htc_battery_cell_find(id_raw);
	if (!pcell) {
		pr_err("[BATT] cell pointer is NULL so unknown ID is return.\n");
		return HTC_BATTERY_CELL_ID_UNKNOWN;
	}
	
	if (cur_cell == pcell)
		return pcell->id;
	
	if (cur_cell) {
		if (pcell->id == HTC_BATTERY_CELL_ID_UNKNOWN) {
			unknown_count++;
			if (unknown_count < HTC_BATTERY_CELL_CHECK_UNKNOWN_COUNT)
				return cur_cell->id; 
		} else
			unknown_count = 0;
	} else {
		
		pr_warn("[BATT]warn: cur_cell is initiated by %s", __func__);
		cur_cell = pcell;
		return pcell->id;
	}
	pr_debug("[BATT]dbg: battery cell id %d -> %d\n",
			cur_cell->id, pcell->id);
	cur_cell = pcell;
	return pcell->id;
}
inline int htc_battery_cell_find_and_set_id_auto(int id_raw)
{
	static int unknown_count = 0;
	struct htc_battery_cell *pcell = NULL;

	pcell = htc_battery_cell_find(id_raw);
	if (!pcell) {
		pr_err("[BATT] cell pointer is NULL so unknown ID is return.\n");
		return HTC_BATTERY_CELL_ID_UNKNOWN;
	}
	/* CASE 1: cell(id) doesn't change */
	if (cur_cell == pcell)
		return pcell->id;
	/* CASE 2: cell(id) changes */
	if (cur_cell) {
		/* id change policy: cur_cell may switch to UNKNOWN(255)
		 * only if we got unknown id successively UNKNOWN_COUNT times
		 */
		if (pcell->id == HTC_BATTERY_CELL_ID_UNKNOWN) {
			unknown_count++;
			if (unknown_count < HTC_BATTERY_CELL_CHECK_UNKNOWN_COUNT)
				return cur_cell->id; /* id remains no changing */
		} else
			unknown_count = 0;
	} else {
		/* cur_cell hasn't been set yet */
		pr_warn("[BATT]warn: cur_cell is initiated by %s", __func__);
		cur_cell = pcell;
		return pcell->id;
	}
	pr_debug("[BATT]dbg: battery cell id %d -> %d\n",
			cur_cell->id, pcell->id);
	cur_cell = pcell;
	return pcell->id;
}