On Wed, Jul 31, 2013 at 02:25:27PM +0800, Haijun Zhang wrote:
>       int num_ranges;
> +     u32 ocr_mask;
>       int i;
>       int ret = -EINVAL;
>  
> @@ -102,26 +103,11 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct 
> spi_device *spi)
>       if (!oms)
>               return NULL;
>  
> -     voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges);
> -     num_ranges = num_ranges / sizeof(*voltage_ranges) / 2;
> -     if (!voltage_ranges || !num_ranges) {
> -             dev_err(dev, "OF: voltage-ranges unspecified\n");
> +     ocr_mask = mmc_of_parse_voltage(np);
> +     if (ocr_mask <= 0)

'< 0' check for an unsigned type? :) I'd write just !ocr_mask...

But other than that the patch looks good to me...

Reviewed-by: Anton Vorontsov <an...@enomsg.org>

Thanks!

>               goto err_ocr;
> -     }
> -
> -     for (i = 0; i < num_ranges; i++) {
> -             const int j = i * 2;
> -             u32 mask;
>  
> -             mask = mmc_vddrange_to_ocrmask(be32_to_cpu(voltage_ranges[j]),
> -                                            be32_to_cpu(voltage_ranges[j + 
> 1]));
> -             if (!mask) {
> -                     ret = -EINVAL;
> -                     dev_err(dev, "OF: voltage-range #%d is invalid\n", i);
> -                     goto err_ocr;
> -             }
> -             oms->pdata.ocr_mask |= mask;
> -     }
> +     oms->pdata.ocr_mask |= ocr_mask;
>  
>       for (i = 0; i < ARRAY_SIZE(oms->gpios); i++) {
>               enum of_gpio_flags gpio_flags;
> -- 
> 1.8.0
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to