From patchwork Tue Nov 29 07:02:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yang X-Patchwork-Id: 27094 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp175365wrr; Mon, 28 Nov 2022 23:07:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf4qBaar8VwzsQcfHqWKuWD/wtLIpaOpkWedLH0uSB02upC3j+g5eYXKD1qfPqGwWl8UAC78 X-Received: by 2002:a17:90a:307:b0:20a:c1bf:ad2d with SMTP id 7-20020a17090a030700b0020ac1bfad2dmr41973322pje.112.1669705623273; Mon, 28 Nov 2022 23:07:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669705623; cv=none; d=google.com; s=arc-20160816; b=G5pGiMeQR6yVIORWbo0XTOf/IVkXCU9YecnM059dEcfcB+9AWspS42a7t2V69UAcn9 SeseQwOwSQyRX3SGIcNBQd7y/4xT1lOEy80WTszJvsBsphfF3+95AiUEgauEtJY7f/XD Qn4gXhQlnODK+YmpfuetR/GS4O1xVQZHt52gbmFLVpfcNoyKSuLjTET5QRyqCWCngwos qC9Pu8OA2Yu7f6OgMxU9JOIX2UUoxFt5a/B/uUlwQu4Ug0mldVj8rJF4TvLUGF5TeoGR QBw9gAXNAgNJ7+DrD3xv/1NiA9pCakENik1o3CD1eXj6jsikUTo4/XDQvMHhVZZ1EWj+ pjww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=iRzqSX8L/RuxAu45bFzGVqYrE50M3hTc4yq8qJPskC8=; b=HZ5MmXFA5QnEBRD2u2ddDfbTu6cByivjgidI5tb9ScuLIUO38hDIwHNBtRlnToJDgj f0Jtzwt2nAWW5BtvlVjigkHjLnI+m2ZqnGVIwn0heVXn92h+qJ2nQa43FPettm3XjJhj eaoebYBizgVjD+Jhkb4J7xwEzU8RMQr9dpJcV8ZvY4kmvPTpSE1kzPTffreufM00VC51 Jd1RkYtQPvqgTMZMk3kw7aWcrLdEBne0QibIZNt6L6jM2p42qML/Mn+CCbgZIB8vicxC sf3PlsVnlyB8fRHNkzdk8/ubHRdmlkLhJ4ymdPW0XjOwPvUs0149Hvzn2UwkrEPn/Jcj 3Ugw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 13-20020a170902c24d00b00179e66b5d2csi12720318plg.398.2022.11.28.23.06.49; Mon, 28 Nov 2022 23:07:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229773AbiK2HCo (ORCPT + 99 others); Tue, 29 Nov 2022 02:02:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbiK2HCl (ORCPT ); Tue, 29 Nov 2022 02:02:41 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B450711812; Mon, 28 Nov 2022 23:02:37 -0800 (PST) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4NLtZL6Kz8z4xVnd; Tue, 29 Nov 2022 15:02:34 +0800 (CST) Received: from szxlzmapp02.zte.com.cn ([10.5.231.79]) by mse-fl2.zte.com.cn with SMTP id 2AT71vsp049656; Tue, 29 Nov 2022 15:02:26 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp02[null]) by mapi (Zmail) with MAPI id mid14; Tue, 29 Nov 2022 15:02:28 +0800 (CST) Date: Tue, 29 Nov 2022 15:02:28 +0800 (CST) X-Zmail-TransId: 2b046385ae847e71f525 X-Mailer: Zmail v1.0 Message-ID: <202211291502286285262@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , , , , , , Subject: =?utf-8?q?=5BPATCH_linux-next_v2=5D_net=3A_stmmac=3A_use_sysfs=5Fst?= =?utf-8?q?req=28=29_instead_of_strncmp=28=29?= X-MAIL: mse-fl2.zte.com.cn 2AT71vsp049656 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 6385AE8A.000 by FangMail milter! X-FangMail-Envelope: 1669705354/4NLtZL6Kz8z4xVnd/6385AE8A.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6385AE8A.000/4NLtZL6Kz8z4xVnd X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750813243815151361?= X-GMAIL-MSGID: =?utf-8?q?1750813243815151361?= From: Xu Panda Replace the open-code with sysfs_streq(). --- change for v2 - fix the mistake of redundant parameter. --- Signed-off-by: Xu Panda Signed-off-by: Yang Yang --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 0a9d13d7976f..5ec9f64dadd0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7562,31 +7562,31 @@ static int __init stmmac_cmdline_opt(char *str) if (!str || !*str) return 1; while ((opt = strsep(&str, ",")) != NULL) { - if (!strncmp(opt, "debug:", 6)) { + if (sysfs_streq(opt, "debug:")) { if (kstrtoint(opt + 6, 0, &debug)) goto err; - } else if (!strncmp(opt, "phyaddr:", 8)) { + } else if (sysfs_streq(opt, "phyaddr:")) { if (kstrtoint(opt + 8, 0, &phyaddr)) goto err; - } else if (!strncmp(opt, "buf_sz:", 7)) { + } else if (sysfs_streq(opt, "buf_sz:")) { if (kstrtoint(opt + 7, 0, &buf_sz)) goto err; - } else if (!strncmp(opt, "tc:", 3)) { + } else if (sysfs_streq(opt, "tc:")) { if (kstrtoint(opt + 3, 0, &tc)) goto err; - } else if (!strncmp(opt, "watchdog:", 9)) { + } else if (sysfs_streq(opt, "watchdog:")) { if (kstrtoint(opt + 9, 0, &watchdog)) goto err; - } else if (!strncmp(opt, "flow_ctrl:", 10)) { + } else if (sysfs_streq(opt, "flow_ctrl:")) { if (kstrtoint(opt + 10, 0, &flow_ctrl)) goto err; - } else if (!strncmp(opt, "pause:", 6)) { + } else if (sysfs_streq(opt, "pause:")) { if (kstrtoint(opt + 6, 0, &pause)) goto err; - } else if (!strncmp(opt, "eee_timer:", 10)) { + } else if (sysfs_streq(opt, "eee_timer:")) { if (kstrtoint(opt + 10, 0, &eee_timer)) goto err; - } else if (!strncmp(opt, "chain_mode:", 11)) { + } else if (sysfs_streq(opt, "chain_mode:")) { if (kstrtoint(opt + 11, 0, &chain_mode)) goto err; }