git: add8154e451f - main - stand: uboot_fmtdev can be reduced to devformat

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 11 Aug 2022 16:27:49 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=add8154e451f441778fb9c2fb7d10d281dea9611

commit add8154e451f441778fb9c2fb7d10d281dea9611
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-08-11 15:08:52 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-08-11 16:27:17 +0000

    stand: uboot_fmtdev can be reduced to devformat
    
    devformat produces the same output as uboot_fmtdev, so just use it to
    reduce on the dependencies.
    
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D35926
---
 stand/uboot/devicename.c | 23 -----------------------
 stand/uboot/libuboot.h   |  1 -
 stand/uboot/main.c       |  2 +-
 3 files changed, 1 insertion(+), 25 deletions(-)

diff --git a/stand/uboot/devicename.c b/stand/uboot/devicename.c
index b6b0e6e40639..b73a7694f14a 100644
--- a/stand/uboot/devicename.c
+++ b/stand/uboot/devicename.c
@@ -160,29 +160,6 @@ fail:
 }
 
 
-char *
-uboot_fmtdev(void *vdev)
-{
-	struct uboot_devdesc *dev = (struct uboot_devdesc *)vdev;
-	static char buf[128];
-
-	switch(dev->dd.d_dev->dv_type) {
-	case DEVT_NONE:
-		strcpy(buf, "(no device)");
-		break;
-
-	case DEVT_DISK:
-#ifdef LOADER_DISK_SUPPORT
-		return (disk_fmtdev(vdev));
-#endif
-
-	case DEVT_NET:
-		sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
-		break;
-	}
-	return(buf);
-}
-
 /*
  * Set currdev to suit the value being supplied in (value).
  */
diff --git a/stand/uboot/libuboot.h b/stand/uboot/libuboot.h
index 18a12c216d7e..b9039bcf7fdf 100644
--- a/stand/uboot/libuboot.h
+++ b/stand/uboot/libuboot.h
@@ -50,7 +50,6 @@ struct uboot_devdesc {
 #endif
 
 int uboot_getdev(void **vdev, const char *devspec, const char **path);
-char *uboot_fmtdev(void *vdev);
 int uboot_setcurrdev(struct env_var *ev, int flags, const void *value);
 
 extern int devs_no;
diff --git a/stand/uboot/main.c b/stand/uboot/main.c
index 6648dc607c11..573995663fe4 100644
--- a/stand/uboot/main.c
+++ b/stand/uboot/main.c
@@ -533,7 +533,7 @@ main(int argc, char **argv)
 		return (0xbadef1ce);
 	}
 
-	ldev = uboot_fmtdev(&currdev);
+	ldev = devformat(&currdev.dd);
 	env_setenv("currdev", EV_VOLATILE, ldev, uboot_setcurrdev, env_nounset);
 	env_setenv("loaddev", EV_VOLATILE, ldev, env_noset, env_nounset);
 	printf("Booting from %s\n", ldev);