Commit cf925747 authored by Russell King's avatar Russell King Committed by Ulf Hansson

mmc: core: improve mmc_of_parse_voltage() to return better status

Improve mmc_of_parse_voltage()'s return values so that drivers can tell
whether a voltage-range specification was present, and whether it has
been successfully parsed, or there was an error while parsing.

We return a negative errno when parsing fails, zero if no voltage-range
specification is present, or one if a voltage-range specification is
successfully parsed.

No users need modifying as no users check the return value.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 10a16a01
...@@ -1204,8 +1204,9 @@ EXPORT_SYMBOL(mmc_vddrange_to_ocrmask); ...@@ -1204,8 +1204,9 @@ EXPORT_SYMBOL(mmc_vddrange_to_ocrmask);
* @np: The device node need to be parsed. * @np: The device node need to be parsed.
* @mask: mask of voltages available for MMC/SD/SDIO * @mask: mask of voltages available for MMC/SD/SDIO
* *
* 1. Return zero on success. * Parse the "voltage-ranges" DT property, returning zero if it is not
* 2. Return negative errno: voltage-range is invalid. * found, negative errno if the voltage-range specification is invalid,
* or one if the voltage-range is specified and successfully parsed.
*/ */
int mmc_of_parse_voltage(struct device_node *np, u32 *mask) int mmc_of_parse_voltage(struct device_node *np, u32 *mask)
{ {
...@@ -1216,7 +1217,7 @@ int mmc_of_parse_voltage(struct device_node *np, u32 *mask) ...@@ -1216,7 +1217,7 @@ int mmc_of_parse_voltage(struct device_node *np, u32 *mask)
num_ranges = num_ranges / sizeof(*voltage_ranges) / 2; num_ranges = num_ranges / sizeof(*voltage_ranges) / 2;
if (!voltage_ranges) { if (!voltage_ranges) {
pr_debug("%s: voltage-ranges unspecified\n", np->full_name); pr_debug("%s: voltage-ranges unspecified\n", np->full_name);
return -EINVAL; return 0;
} }
if (!num_ranges) { if (!num_ranges) {
pr_err("%s: voltage-ranges empty\n", np->full_name); pr_err("%s: voltage-ranges empty\n", np->full_name);
...@@ -1238,7 +1239,7 @@ int mmc_of_parse_voltage(struct device_node *np, u32 *mask) ...@@ -1238,7 +1239,7 @@ int mmc_of_parse_voltage(struct device_node *np, u32 *mask)
*mask |= ocr_mask; *mask |= ocr_mask;
} }
return 0; return 1;
} }
EXPORT_SYMBOL(mmc_of_parse_voltage); EXPORT_SYMBOL(mmc_of_parse_voltage);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment