@@ -157,20 +157,7 @@ static int mmc_ios_show(struct seq_file *s, void *data)
}
seq_printf(s, "timing spec:\t%u (%s)\n", ios->timing, str);
- switch (ios->signal_voltage) {
- case MMC_SIGNAL_VOLTAGE_330:
- str = "3.30 V";
- break;
- case MMC_SIGNAL_VOLTAGE_180:
- str = "1.80 V";
- break;
- case MMC_SIGNAL_VOLTAGE_120:
- str = "1.20 V";
- break;
- default:
- str = "invalid";
- break;
- }
+ str = mmc_voltage_to_str(ios);
seq_printf(s, "signal voltage:\t%u (%s)\n", ios->signal_voltage, str);
switch (ios->drv_type) {
@@ -469,3 +469,16 @@ void mmc_free_host(struct mmc_host *host)
}
EXPORT_SYMBOL(mmc_free_host);
+
+const char *mmc_voltage_to_str(struct mmc_ios *ios)
+{
+ static const char * const voltages[] = {
+ [MMC_SIGNAL_VOLTAGE_330] = "3.30 V",
+ [MMC_SIGNAL_VOLTAGE_180] = "1.80 V",
+ [MMC_SIGNAL_VOLTAGE_120] = "1.20 V",
+ };
+
+ if (ios->signal_voltage <= MMC_SIGNAL_VOLTAGE_120)
+ return voltages[ios->signal_voltage];
+ return "invalid";
+}
@@ -544,4 +544,6 @@ static inline void mmc_retune_recheck(struct mmc_host *host)
void mmc_retune_pause(struct mmc_host *host);
void mmc_retune_unpause(struct mmc_host *host);
+const char *mmc_voltage_to_str(struct mmc_ios *ios);
+
#endif /* LINUX_MMC_HOST_H */
Add a helper for producing a user-friendly string with chosen signaling voltage. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> --- drivers/mmc/core/debugfs.c | 15 +-------------- drivers/mmc/core/host.c | 13 +++++++++++++ include/linux/mmc/host.h | 2 ++ 3 files changed, 16 insertions(+), 14 deletions(-)