Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jul 2020 18:21:37 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363424 - head/sys/cam/mmc
Message-ID:  <202007221821.06MILbjm060787@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Wed Jul 22 18:21:37 2020
New Revision: 363424
URL: https://svnweb.freebsd.org/changeset/base/363424

Log:
  mmccam: Use a sbuf for the mmc ident function
  
  While here fix a typo.

Modified:
  head/sys/cam/mmc/mmc_xpt.c

Modified: head/sys/cam/mmc/mmc_xpt.c
==============================================================================
--- head/sys/cam/mmc/mmc_xpt.c	Wed Jul 22 17:37:11 2020	(r363423)
+++ head/sys/cam/mmc/mmc_xpt.c	Wed Jul 22 18:21:37 2020	(r363424)
@@ -408,27 +408,47 @@ mmc_announce_periph(struct cam_periph *periph)
 void
 mmc_print_ident(struct mmc_params *ident_data)
 {
-        printf("Relative addr: %08x\n", ident_data->card_rca);
-        printf("Card features: <");
-        if (ident_data->card_features & CARD_FEATURE_MMC)
-                printf("MMC ");
-        if (ident_data->card_features & CARD_FEATURE_MEMORY)
-                printf("Memory ");
-        if (ident_data->card_features & CARD_FEATURE_SDHC)
-                printf("High-Capacity ");
-        if (ident_data->card_features & CARD_FEATURE_SD20)
-                printf("SD2.0-Conditions ");
-        if (ident_data->card_features & CARD_FEATURE_SDIO)
-                printf("SDIO ");
-        printf(">\n");
+	struct sbuf *sb;
+	bool space = false;
 
-        if (ident_data->card_features & CARD_FEATURE_MEMORY)
-                printf("Card memory OCR: %08x\n", ident_data->card_ocr);
+	sb = sbuf_new_auto();
+	sbuf_printf(sb, "Relative addr: %08x\n", ident_data->card_rca);
+	sbuf_printf(sb, "Card features: <");
+	if (ident_data->card_features & CARD_FEATURE_MMC) {
+		sbuf_printf(sb, "MMC");
+		space = true;
+	}
+	if (ident_data->card_features & CARD_FEATURE_MEMORY) {
+		sbuf_printf(sb, "%sMemory", space ? " " : "");
+		space = true;
+	}
+	if (ident_data->card_features & CARD_FEATURE_SDHC) {
+		sbuf_printf(sb, "%sHigh-Capacity", space ? " " : "");
+		space = true;
+	}
+	if (ident_data->card_features & CARD_FEATURE_SD20) {
+		sbuf_printf(sb, "%sSD2.0-Conditions", space ? " " : "");
+		space = true;
+	}
+	if (ident_data->card_features & CARD_FEATURE_SDIO) {
+		sbuf_printf(sb, "%sSDIO", space ? " " : "");
+		space = true;
+	}
+	sbuf_printf(sb, ">\n");
 
-        if (ident_data->card_features & CARD_FEATURE_SDIO) {
-                printf("Card IO OCR: %08x\n", ident_data->io_ocr);
-                printf("Number of funcitions: %u\n", ident_data->sdio_func_count);
-        }
+	if (ident_data->card_features & CARD_FEATURE_MEMORY)
+		sbuf_printf(sb, "Card memory OCR: %08x\n",
+		    ident_data->card_ocr);
+
+	if (ident_data->card_features & CARD_FEATURE_SDIO) {
+		sbuf_printf(sb, "Card IO OCR: %08x\n", ident_data->io_ocr);
+		sbuf_printf(sb, "Number of functions: %u\n",
+		    ident_data->sdio_func_count);
+	}
+
+	sbuf_finish(sb);
+	printf("%s", sbuf_data(sb));
+	sbuf_clear(sb);
 }
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007221821.06MILbjm060787>