summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-05-06 05:03:03 +0300
committerTom Rini <trini@konsulko.com>2023-05-13 16:52:32 +0300
commit9fea3a799dde140f2d75eeb4560a5c3237ca991d (patch)
tree79227017c2014878496cc4838ca5db2c89f2a5eb
parent76afc8457eb2f55771d9c9e2ba6106bac43a166b (diff)
downloadu-boot-9fea3a799dde140f2d75eeb4560a5c3237ca991d.tar.xz
usb: Tidy up the usb_start flag
This should be declared in a header file so that type-checking works correctly. Add a single declaration to usb.h and remove the others. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
-rw-r--r--cmd/usb.c1
-rw-r--r--common/usb.c2
-rw-r--r--drivers/usb/host/usb-uclass.c1
-rw-r--r--include/usb.h3
-rw-r--r--test/boot/bootdev.c4
-rw-r--r--test/dm/blk.c3
6 files changed, 6 insertions, 8 deletions
diff --git a/cmd/usb.c b/cmd/usb.c
index 73addb04c4..6193728384 100644
--- a/cmd/usb.c
+++ b/cmd/usb.c
@@ -620,7 +620,6 @@ static int do_usb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
struct usb_device *udev = NULL;
int i;
- extern char usb_started;
if (argc < 2)
return CMD_RET_USAGE;
diff --git a/common/usb.c b/common/usb.c
index ae9253dfc0..836506dcd9 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -43,7 +43,7 @@
#define USB_BUFSIZ 512
static int asynch_allowed;
-char usb_started; /* flag for the started/stopped USB status */
+bool usb_started; /* flag for the started/stopped USB status */
#if !CONFIG_IS_ENABLED(DM_USB)
static struct usb_device usb_dev[USB_MAX_DEVICE];
diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index 28f7ca9654..02c0138a20 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -18,7 +18,6 @@
#include <dm/lists.h>
#include <dm/uclass-internal.h>
-extern bool usb_started; /* flag for the started/stopped USB status */
static bool asynch_allowed;
struct usb_uclass_priv {
diff --git a/include/usb.h b/include/usb.h
index 80cb846720..42b001c3dd 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -11,12 +11,15 @@
#ifndef _USB_H_
#define _USB_H_
+#include <stdbool.h>
#include <fdtdec.h>
#include <usb_defs.h>
#include <linux/usb/ch9.h>
#include <asm/cache.h>
#include <part.h>
+extern bool usb_started; /* flag for the started/stopped USB status */
+
/*
* The EHCI spec says that we must align to at least 32 bytes. However,
* some platforms require larger alignment.
diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c
index 8cf3f30e0f..606bf4fcc1 100644
--- a/test/boot/bootdev.c
+++ b/test/boot/bootdev.c
@@ -19,9 +19,9 @@
/* Allow reseting the USB-started flag */
#if defined(CONFIG_USB_HOST) || defined(CONFIG_USB_GADGET)
-extern char usb_started;
+extern bool usb_started;
#else
-char usb_started;
+#include <usb.h>
#endif
/* Check 'bootdev list' command */
diff --git a/test/dm/blk.c b/test/dm/blk.c
index 0aa04c64ef..446c4423e6 100644
--- a/test/dm/blk.c
+++ b/test/dm/blk.c
@@ -16,9 +16,6 @@
DECLARE_GLOBAL_DATA_PTR;
-/* Allow resetting the USB-started flag */
-extern char usb_started;
-
/* Test that block devices can be created */
static int dm_test_blk_base(struct unit_test_state *uts)
{