IOMUX: Switch to use stdio_file_to_flags()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 11 Feb 2021 15:09:40 +0000 (17:09 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 16 Feb 2021 16:16:08 +0000 (11:16 -0500)
Deduplicate code by replacing with stdio_file_to_flags() helper.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
common/iomux.c

index 15bf533..5d02756 100644 (file)
@@ -75,15 +75,8 @@ int iomux_doenv(const int console, const char *arg)
                return 1;
        }
 
-       switch (console) {
-       case stdin:
-               io_flag = DEV_FLAGS_INPUT;
-               break;
-       case stdout:
-       case stderr:
-               io_flag = DEV_FLAGS_OUTPUT;
-               break;
-       default:
+       io_flag = stdio_file_to_flags(console);
+       if (io_flag < 0) {
                free(start);
                free(console_args);
                free(cons_set);