From patchwork Wed Mar 29 07:57:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1762619 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=jP0mWa/8; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Pmf7F09v2z1yXv for ; Wed, 29 Mar 2023 18:58:16 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 24AF585B43; Wed, 29 Mar 2023 09:58:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="jP0mWa/8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 76F7B85C2B; Wed, 29 Mar 2023 09:58:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SPF_PERMERROR autolearn=ham autolearn_force=no version=3.4.2 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on20728.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eaf::728]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 60978857BD for ; Wed, 29 Mar 2023 09:58:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JuxY7SYGnlJOuCNPkntmNZaqLIoAiy5zATy5RnMm9StR27vh4YGUcvc6nx6RseMGbp2bU652kkXO5I3I+2W3v3efavpiIIl5DH69CJaJR/wBLGsr2lvKaJTaGvCRuXL2fGuXDNOIgPeGGjFYWH5SqLOVj1WR0ECHzF4vn16M/ex10STyyvfbNlSF0T80MI5dXeuMPf4uK6xn5ZJYq9HJe1mBdQQdW9IXhV1sRNPoFG8O+PMzQ/zUbt4t46rgll9acnY76yGTmtXKv9vuQKQQ1KfisVIh6dW4NMNuQD+IrVNO3lkjYXDAFtJ62Ve+4PXWEzrn2Mb15BIRGzCQXB7S/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HZIAIwRjh5xWwQ6X2ZrpvGBddP2l7m4KHUFjSxxkhW4=; b=m5XlySgWO6xbnYaCTY+jA0fwBp+BnYEPQZny+Ctkf6QwWCKK53Ee37qBMMqQlglnoMEBfEROQV0XJai235HPN0I9nPtTKEUpmf6troSt26UClJoED61CuQ58Spj4etJEtD8HibmgM1tf1j4dZ5IDKJ+jBXYTLY6Jz7vXXrq2nr+POyTQVjNIPy582vwnNOpuQx7cmxfclfl4w+/9wNO/jNwV3/ybZ4a81AjIEnID9fNoPs8KOU2IAne81YsoUex3KARefiUMIIamlrrJnyV5Z+wNk1wSdIqMGVQSuqaTAdAmATAcfT9EmGVDQZQHCOauXk0yEwm6V/NhEzEbtCHlaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HZIAIwRjh5xWwQ6X2ZrpvGBddP2l7m4KHUFjSxxkhW4=; b=jP0mWa/8v50P1BnY3/OHFPLHILDLeDl8jT6XThdmXw0KovwoyzrsQYgCpmRE3z2nc+pCc68QvuJiuX1dDqnwLEffqdxHPXG+rfN/kwkaVtKFMYiNKu8naZ+QQvTf8pJsdC2qM1n3Afn/VllE/YfbHBjtyT6NjmKpLXXhFqVdNNw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=prevas.dk; Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) by GV2PR10MB7464.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:e2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.10; Wed, 29 Mar 2023 07:57:59 +0000 Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::18c1:25d1:3fb0:1439]) by DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::18c1:25d1:3fb0:1439%6]) with mapi id 15.20.6254.018; Wed, 29 Mar 2023 07:57:59 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: =?utf-8?q?Pali_Roh=C3=A1r?= , Simon Glass , Bin Meng , Tom Rini , Rasmus Villemoes Subject: [PATCH] serial-uclass: drop redundant code in serial_check_stdout() Date: Wed, 29 Mar 2023 09:57:51 +0200 Message-Id: <20230329075751.2011739-1-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.37.2 X-ClientProxiedBy: MM0P280CA0095.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:9::13) To DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR10MB7100:EE_|GV2PR10MB7464:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a5009ab-5381-42cf-05c9-08db302b5044 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iDVKgq1iTdpuEYPjmb5yOhtY7UGcSAqCTL+GqyHvaFgpH2Q00yWlOUbdwsvDoce80fZHfRrwQp6q/Qcgx2m1jGlimpBqbywS2o4VECkGHAR6X9AXq3g2D1mtniY4dhyeBSVHU4wvjemE5ugN7vNGT/llD/RsQy/cRG2Rpgrm1cdpdF4FxxjX+yL1xrhPP+XDkufogE1jGmDP6CzKrw0NzTQg+BDklqPjqe/LhBaR4jV9PgmyzA5PUAocuwdxB9BxRdwVfN4IDLtUKQeypdw13u+GhnHz1GR0Yc2X6Dq+wMZveZxTuLyaopLuTfOcGSW6Q4/DYWuL87KOMW/JakrgfDmKQyToditVFpiRRaIAlJodSYqsPRiQZRg7jXJ/3fJlQf+L69CNQ+QOWd/OQaMMGMJyngxutARIkZH4x12IGkduhiFJHNvsxHMcf8p8eAWoC/jxTxe9CBvW9N/2hzYGjGwJ1WfObvI/7wOmex0J7UzdYuNK4I8cBFC3RYzlOI2/LEqmtd4YVGRiDQokYxHUWUvSdVwQGr/exxA4pRc5ZwgY0i6CUvpUYvzTIIg4avidrT1/3G5WC8a6HHN6mNrMSbQKMAxunlJUR/LodInCBzB/++qpZMec7O3jIWBnZPK5 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230028)(366004)(136003)(39850400004)(346002)(376002)(396003)(451199021)(2906002)(86362001)(44832011)(66899021)(83380400001)(8976002)(8936002)(5660300002)(66476007)(6916009)(66556008)(4326008)(8676002)(66946007)(41300700001)(316002)(2616005)(54906003)(478600001)(52116002)(38350700002)(107886003)(38100700002)(6486002)(36756003)(6512007)(6666004)(1076003)(186003)(26005)(6506007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: b2mDNy6O4D0eFVr/gNZ0pOsWqWrcW9+2biRK3B0Mfdo9/BOWJEl+7y3gLZFABomh+0K7JtHx1NH/YmNspyoLdGorpcgWQWioLuM32+spl+zPlUTQpuv6wYF69JKgW7OWcTFRQnuqvA4W82Z+9yN8Q3iuVxr/rZqM7Lo+dEkiFH9S0B1qQ/WbN9dJihmS8KemPIMeUMK0IxRcQxVaY7CqkV6iRML3OaNWLvEdjBz8hxXj7kJpUx3y0sVNYOfg3Ve2QtytTm92WhjyC5TFoJnmhTpGsmuqAoJSsmfCrO9Uowzllq5WOVa8gowd1OjXyOKZxSVSApn07wwW3zFYqEpW27q9rceqz86r/hqlCVHD0gWSqthWly8PVcjY6FV1JBfNiUNNfqA6MK6g5af4lKJTE4X4tnGd9KvVEHLdPm8X+UUBIqY0qySTJnxK2mh+wkhf7DtNdNfKplDLrGU/XNXG7n3twIgBtM/vSa6Oj0NnfN8yTugbFnfqK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xp+J2qaef7Htswl4qZYpIb78Mwod/zyCz/5fTrr9lhXzgxSiORrRStA== X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 4a5009ab-5381-42cf-05c9-08db302b5044 X-MS-Exchange-CrossTenant-AuthSource: DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2023 07:57:59.3486 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Xe/rbWj+LnM9nACyT5sXobCCXqdWNwwSq1eZiFJu7yBzOn5l924BoaavY14/XMXD9zwDWvDNIZIn9Vj39a/AoCukMceDubHh+fMXnJjv1U0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR10MB7464 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean As the updated comment says, this is already handled by fdt_path_offset_namelen() itself. Signed-off-by: Rasmus Villemoes --- drivers/serial/serial-uclass.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 77d3f37372..067fae2614 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -31,7 +31,7 @@ static const unsigned long baudrate_table[] = CFG_SYS_BAUDRATE_TABLE; static int serial_check_stdout(const void *blob, struct udevice **devp) { int node = -1; - const char *str, *p, *name; + const char *str, *p; int namelen; /* Check for a chosen console */ @@ -39,20 +39,16 @@ static int serial_check_stdout(const void *blob, struct udevice **devp) if (str) { p = strchr(str, ':'); namelen = p ? p - str : strlen(str); + /* + * This also deals with things like + * + * stdout-path = "serial0:115200n8"; + * + * since fdt_path_offset_namelen() treats a str not + * beginning with '/' as an alias and thus applies + * fdt_get_alias_namelen() to it. + */ node = fdt_path_offset_namelen(blob, str, namelen); - - if (node < 0) { - /* - * Deal with things like - * stdout-path = "serial0:115200n8"; - * - * We need to look up the alias and then follow it to - * the correct node. - */ - name = fdt_get_alias_namelen(blob, str, namelen); - if (name) - node = fdt_path_offset(blob, name); - } } if (node < 0)