diff mbox series

[v1,04/11] console: Switch to use stdio_file_to_flags()

Message ID 20210211150944.73252-4-andriy.shevchenko@linux.intel.com
State Accepted
Commit 7b9ca3f89c340f3a195e17ccdd7d512e0884e555
Delegated to: Tom Rini
Headers show
Series [v1,01/11] stdio: Get rid of dead code, i.e. stdio_deregister() | expand

Commit Message

Andy Shevchenko Feb. 11, 2021, 3:09 p.m. UTC
Deduplicate code by replacing with stdio_file_to_flags() helper.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 common/console.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

Comments

Tom Rini Feb. 16, 2021, 9:56 p.m. UTC | #1
On Thu, Feb 11, 2021 at 05:09:37PM +0200, Andy Shevchenko wrote:

> Deduplicate code by replacing with stdio_file_to_flags() helper.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/common/console.c b/common/console.c
index f3cc45cab548..b1c3ed17cc03 100644
--- a/common/console.c
+++ b/common/console.c
@@ -854,17 +854,9 @@  int console_assign(int file, const char *devname)
 	struct stdio_dev *dev;
 
 	/* Check for valid file */
-	switch (file) {
-	case stdin:
-		flag = DEV_FLAGS_INPUT;
-		break;
-	case stdout:
-	case stderr:
-		flag = DEV_FLAGS_OUTPUT;
-		break;
-	default:
-		return -1;
-	}
+	flag = stdio_file_to_flags(file);
+	if (flag < 0)
+		return flag;
 
 	/* Check for valid device name */