From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25644C4167B for ; Fri, 4 Dec 2020 17:05:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9B6322CAF for ; Fri, 4 Dec 2020 17:05:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388398AbgLDRE7 (ORCPT ); Fri, 4 Dec 2020 12:04:59 -0500 Received: from latitanza.investici.org ([82.94.249.234]:62123 "EHLO latitanza.investici.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388350AbgLDRE6 (ORCPT ); Fri, 4 Dec 2020 12:04:58 -0500 Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4CnfFD0z88z8shw; Fri, 4 Dec 2020 17:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=privacyrequired.com; s=stigmate; t=1607101456; bh=uCxL4ML99SaQcfK9xq45I+PMG7IFylh5UnD0dOSencg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=slNUhh0QlyQxC6cLNojs2ZOUNY2iK2sFSY4J0zEmd6KN8IwBR5Dz5ymAsTAXf3n0n 49+L2mp7prZeQOoVTadCxnIztqS6xgkhVrcMuEdRc5WTPRRFp2yDc84K9bqkXfOZFy EO72gqadgNisKjYMhPuKd6O0/UKXgaiK7fP4gX+k= Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: laniel_francis@privacyrequired.com) by localhost (Postfix) with ESMTPSA id 4CnfFC26JPz8sfb; Fri, 4 Dec 2020 17:04:15 +0000 (UTC) From: laniel_francis@privacyrequired.com To: Hauke Mehrtens , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Thomas Bogendoerfer Cc: Francis Laniel , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v1 02/12] mips: Replace strstarts() by str_has_prefix(). Date: Fri, 4 Dec 2020 18:03:08 +0100 Message-Id: <20201204170319.20383-3-laniel_francis@privacyrequired.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201204170319.20383-1-laniel_francis@privacyrequired.com> References: <20201204170319.20383-1-laniel_francis@privacyrequired.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Francis Laniel The two functions indicates if a string begins with a given prefix. The only difference is that strstarts() returns a bool while str_has_prefix() returns the length of the prefix if the string begins with it or 0 otherwise. Signed-off-by: Francis Laniel --- arch/mips/bcm47xx/board.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c index 35266a70e22a..c21a15b581f6 100644 --- a/arch/mips/bcm47xx/board.c +++ b/arch/mips/bcm47xx/board.c @@ -243,7 +243,7 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void) if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0) { for (e1 = bcm47xx_board_list_hardware_version; e1->value1; e1++) { - if (strstarts(buf1, e1->value1)) + if (str_has_prefix(buf1, e1->value1)) return &e1->board; } } @@ -251,7 +251,7 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void) if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0 && bcm47xx_nvram_getenv("boardnum", buf2, sizeof(buf2)) >= 0) { for (e2 = bcm47xx_board_list_hw_version_num; e2->value1; e2++) { - if (!strstarts(buf1, e2->value1) && + if (!str_has_prefix(buf1, e2->value1) && !strcmp(buf2, e2->value2)) return &e2->board; } -- 2.20.1