Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / drivers / serial / usbtty.c
index 29799dce93a00fa1a547118fc16d493ad4323da7..f1c1a260da5191b7b950e3325be6735e6904b413 100644 (file)
@@ -1,16 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2003
  * Gerry Hamel, geh@ti.com, Texas Instruments
  *
  * (C) Copyright 2006
  * Bryan O'Donoghue, bodonoghue@codehermit.ie
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <config.h>
 #include <circbuf.h>
+#include <env.h>
+#include <serial.h>
 #include <stdio_dev.h>
 #include <asm/unaligned.h>
 #include "usbtty.h"
@@ -525,10 +526,10 @@ int drv_usbtty_init (void)
        char * tt;
        int snlen;
 
-       /* Ger seiral number */
-       if (!(sn = getenv("serial#"))) {
+       /* Get serial number */
+       sn = env_get("serial#");
+       if (!sn)
                sn = "000000000000";
-       }
        snlen = strlen(sn);
        if (snlen > sizeof(serial_number) - 1) {
                printf ("Warning: serial number %s is too long (%d > %lu)\n",
@@ -540,10 +541,9 @@ int drv_usbtty_init (void)
 
        /* Decide on which type of UDC device to be.
         */
-
-       if(!(tt = getenv("usbtty"))) {
+       tt = env_get("usbtty");
+       if (!tt)
                tt = "generic";
-       }
        usbtty_init_terminal_type(strcmp(tt,"cdc_acm"));
 
        /* prepare buffers... */