From patchwork Tue Nov 1 21:13:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13874 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3212757wru; Tue, 1 Nov 2022 14:16:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41JRJY/86E+z8lHZMRgP6HlXgSYGIh1V24QElSmJ7/c5PkKEH8rQI5yhC1mnrXf7NSYHL/ X-Received: by 2002:a17:906:4fcd:b0:78d:8059:17c with SMTP id i13-20020a1709064fcd00b0078d8059017cmr20240558ejw.423.1667337401652; Tue, 01 Nov 2022 14:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667337401; cv=none; d=google.com; s=arc-20160816; b=BmBKLcKzkUcCyRULFjmMBDcnBR7tdMavKJSjJtXjy9VrXD29LEN8uDHBR08SfJWfWA Pq4NooySS0pp2qctfgeesjYXtTPO0/3n06rY5hQAxeaD2jtOsiopx/W0NQfCrOzhJUdi OEW9tW/W5guIj6KdMw8JN+26nwNepCLXOPjERbKrlfKCzVF0H+bx90J0glVsA2yt6hWH 3svLpeddV2/6mYV6+BbIf/gmtCZq3HTx+QSAogiA0F3qV4e1NyOC18C1gkqdKSon4or0 3ogDOtvU6JKsH4ycGsoQvYDDXBMPspNh9q/0/y0nK1UkZUpnSmixInI/pOWr8zAzTgCE /suA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6FehCWP5GZsnbOm9N2W5sNe+xKUQ+z65ctTHstmqzjc=; b=KIWpEGt12en6Ef37C0NjtlDPQ8VPX3o7xBhno3yjU2ZFyyWUSkuWJnVcpQetiIHfsn drDrr1Dvtkpc15ziJVQAyXIId49rkd2mo6i3RHn5f0FsSzPkpkttDC6U9UA6tH8OiRtE ZvkK3tSh1CJB6JDsQwAuAT1Kbc7b2GlEYQcJOYT/qbhCM/TkHBdvNWuXmdw2/jXvGATc oL3rBIgMeRgKC6DkCEDDVWvYivNfKRMw/2MJWP+3/F/PoRC4X9AU9oOYgG+ZMmYhSDcI htem+MrBrSn9eEdlhUNlMTRHZWV9/1/mxYLglY6xBjzZdIkyPiupRVEtCCTwcfTFXTSd KOSg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b12-20020a1709064d4c00b007897abd2d17si9464666ejv.468.2022.11.01.14.16.17; Tue, 01 Nov 2022 14:16:41 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230395AbiKAVPp (ORCPT + 99 others); Tue, 1 Nov 2022 17:15:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbiKAVP2 (ORCPT ); Tue, 1 Nov 2022 17:15:28 -0400 Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A51341DDF2 for ; Tue, 1 Nov 2022 14:15:12 -0700 (PDT) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id pyanoKD2rsfCIpybHoWfIs; Tue, 01 Nov 2022 22:15:11 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 01 Nov 2022 22:15:11 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-usb@vger.kernel.org Subject: [PATCH 07/30] usb: core: Use kstrtobool() instead of strtobool() Date: Tue, 1 Nov 2022 22:13:55 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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?1748329983185964208?= X-GMAIL-MSGID: =?utf-8?q?1748329983185964208?= strtobool() is the same as kstrtobool(). However, the latter is more used within the kernel. In order to remove strtobool() and slightly simplify kstrtox.h, switch to the other function name. While at it, include the corresponding header file () Signed-off-by: Christophe JAILLET --- This patch is part of a serie that axes all usages of strtobool(). Each patch can be applied independently from the other ones. The last patch of the serie removes the definition of strtobool(). You may not be in copy of the cover letter. So, if needed, it is available at [1]. [1]: https://lore.kernel.org/all/cover.1667336095.git.christophe.jaillet@wanadoo.fr/ --- drivers/usb/core/port.c | 3 ++- drivers/usb/core/sysfs.c | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 38c1a4f4fdea..015204fc67a1 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -7,6 +7,7 @@ * Author: Lan Tianyu */ +#include #include #include #include @@ -63,7 +64,7 @@ static ssize_t disable_store(struct device *dev, struct device_attribute *attr, bool disabled; int rc; - rc = strtobool(buf, &disabled); + rc = kstrtobool(buf, &disabled); if (rc) return rc; diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 631574718d8a..8217032dfb85 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -13,6 +13,7 @@ #include +#include #include #include #include @@ -505,7 +506,7 @@ static ssize_t usb2_hardware_lpm_store(struct device *dev, if (ret < 0) return -EINTR; - ret = strtobool(buf, &value); + ret = kstrtobool(buf, &value); if (!ret) { udev->usb2_hw_lpm_allowed = value; @@ -975,7 +976,7 @@ static ssize_t interface_authorized_default_store(struct device *dev, int rc = count; bool val; - if (strtobool(buf, &val) != 0) + if (kstrtobool(buf, &val) != 0) return -EINVAL; if (val) @@ -1176,7 +1177,7 @@ static ssize_t interface_authorized_store(struct device *dev, struct usb_interface *intf = to_usb_interface(dev); bool val; - if (strtobool(buf, &val) != 0) + if (kstrtobool(buf, &val) != 0) return -EINVAL; if (val)