Re: [PATCH v2 2/2] regulator: qcom_spmi: Only use selector based regulator ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[]...
  
>  static int spmi_regulator_select_voltage_same_range(struct spmi_regulator *vreg,
> -		int min_uV, int max_uV, u8 *range_sel, u8 *voltage_sel,
> -		unsigned *selector)
> +		int min_uV, int max_uV)
>  {
>  	const struct spmi_voltage_range *range;
>  	int uV = min_uV;
> -	int i;
> +	int i, selector;
>  
>  	range = spmi_regulator_find_range(vreg);
>  	if (!range)
> @@ -638,8 +665,8 @@ static int spmi_regulator_select_voltage_same_range(struct spmi_regulator *vreg,
>  	 * Force uV to be an allowed set point by applying a ceiling function to
>  	 * the uV value.
>  	 */
> -	*voltage_sel = DIV_ROUND_UP(uV - range->min_uV, range->step_uV);
> -	uV = *voltage_sel * range->step_uV + range->min_uV;
> +	uV = DIV_ROUND_UP(uV - range->min_uV, range->step_uV);
> +	uV = uV * range->step_uV + range->min_uV;
>  
>  	if (uV > max_uV) {
>  		/*
> @@ -649,43 +676,49 @@ static int spmi_regulator_select_voltage_same_range(struct spmi_regulator *vreg,
>  		goto different_range;
>  	}
>  
> -	*selector = 0;
> +	selector = 0;
>  	for (i = 0; i < vreg->set_points->count; i++) {
>  		if (uV >= vreg->set_points->range[i].set_point_min_uV
>  		    && uV <= vreg->set_points->range[i].set_point_max_uV) {
> -			*selector +=
> +			selector +=
>  			    (uV - vreg->set_points->range[i].set_point_min_uV)
>  				/ vreg->set_points->range[i].step_uV;
>  			break;
>  		}
>  
> -		*selector += vreg->set_points->range[i].n_voltages;
> +		selector += vreg->set_points->range[i].n_voltages;
>  	}
>  
> -	if (*selector >= vreg->set_points->n_voltages)
> +	if (selector >= vreg->set_points->n_voltages)
>  		goto different_range;
>  
>  	return 0;

This should now return selector instead of 0

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux