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=-6.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 F094DC433E0 for ; Thu, 28 May 2020 14:51:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0FDF2084C for ; Thu, 28 May 2020 14:51:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728657AbgE1Ovn (ORCPT ); Thu, 28 May 2020 10:51:43 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:42638 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728622AbgE1OvB (ORCPT ); Thu, 28 May 2020 10:51:01 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id AA28E80307C3; Thu, 28 May 2020 14:50:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4CaP9DcyhWGQ; Thu, 28 May 2020 17:50:59 +0300 (MSK) From: Serge Semin To: Arnd Bergmann List-Id: CC: Serge Semin , Serge Semin , Alexey Malahov , Olof Johansson , Andy Shevchenko , , Subject: [PATCH 4/6] bus: bt1-apb: Use sysfs_streq instead of strncmp Date: Thu, 28 May 2020 17:50:48 +0300 Message-ID: <20200528145050.5203-4-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20200528145050.5203-1-Sergey.Semin@baikalelectronics.ru> References: <20200528145050.5203-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a ready-to-use method to compare a retrieved from a sysfs node string with another string. It treats both NUL and newline-then-NUL as equivalent string terminations. So use it instead of manually truncating the line length in the strncmp() method. Signed-off-by: Serge Semin Cc: Alexey Malahov Cc: Olof Johansson Cc: Andy Shevchenko Cc: soc@kernel.org --- drivers/bus/bt1-apb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/bus/bt1-apb.c b/drivers/bus/bt1-apb.c index 7e57fc2af745..b25ff941e7c7 100644 --- a/drivers/bus/bt1-apb.c +++ b/drivers/bus/bt1-apb.c @@ -325,9 +325,9 @@ static ssize_t inject_error_store(struct device *dev, * Either dummy read from the unmapped address in the APB IO area * or manually set the IRQ status. */ - if (!strncmp(data, "nodev", 5)) + if (sysfs_streq(data, "nodev")) readl(apb->res); - else if (!strncmp(data, "irq", 3)) + else if (sysfs_streq(data, "irq")) regmap_update_bits(apb->regs, APB_EHB_ISR, APB_EHB_ISR_PENDING, APB_EHB_ISR_PENDING); else -- 2.26.2