From patchwork Sun Jul 12 16:27:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 11658321 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 90C9C60D for ; Sun, 12 Jul 2020 16:43:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5D420206B6 for ; Sun, 12 Jul 2020 16:43:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D420206B6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 346418D0009; Sun, 12 Jul 2020 12:43:56 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2F6A38D0003; Sun, 12 Jul 2020 12:43:56 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 234388D0009; Sun, 12 Jul 2020 12:43:56 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id 0CC798D0003 for ; Sun, 12 Jul 2020 12:43:56 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C3BC4824805A for ; Sun, 12 Jul 2020 16:43:55 +0000 (UTC) X-FDA: 77029995630.17.toad42_5c041c726ee1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 96DC7180D018B for ; Sun, 12 Jul 2020 16:43:55 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,dan.j.williams@intel.com,,RULES_HIT:30001:30029:30054:30064,0,RBL:192.55.52.136:@intel.com:.lbl8.mailshell.net-64.95.201.95 62.18.0.100;04yfafns3sqkrbzxxzhiwyttbgxacycjdnguuz66xxssx4ndb7m5thihf1ersgh.wp9rtuxyod8mrr8bi4oru1oarkdyduq4jsc76mq4f9f4at6qkrnpstm7fyij6wr.n-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: toad42_5c041c726ee1 X-Filterd-Recvd-Size: 3051 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Sun, 12 Jul 2020 16:43:54 +0000 (UTC) IronPort-SDR: Xib38mx8EseE+I7MrLTnKQ9Qae1B3EceYU1mD5/7daKAao2rXbWAJgY5laEX/v4LyJf7dwBDbP 4ME+6M0dbjWw== X-IronPort-AV: E=McAfee;i="6000,8403,9680"; a="128087113" X-IronPort-AV: E=Sophos;i="5.75,344,1589266800"; d="scan'208";a="128087113" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2020 09:43:53 -0700 IronPort-SDR: 6TzdCRE2fzwUtJmRD/9EfCFIElciJvmPqXsWPc0c8rNKEeKxhxcSvMuVYcR8Bq7fJeQlwMajAd GEvT4hAHTm6g== X-IronPort-AV: E=Sophos;i="5.75,344,1589266800"; d="scan'208";a="325264264" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2020 09:43:53 -0700 Subject: [PATCH v2 17/22] drivers/base: Make device_find_child_by_name() compatible with sysfs inputs From: Dan Williams To: linux-nvdimm@lists.01.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , peterz@infradead.org, vishal.l.verma@intel.com, dave.hansen@linux.intel.com, ard.biesheuvel@linaro.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, hch@lst.de, joao.m.martins@oracle.com Date: Sun, 12 Jul 2020 09:27:37 -0700 Message-ID: <159457125753.754248.6000936585361264069.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com> References: <159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 X-Rspamd-Queue-Id: 96DC7180D018B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use sysfs_streq() in device_find_child_by_name() to allow it to use a sysfs input string that might contain a trailing newline. The other "device by name" interfaces, {bus,driver,class}_find_device_by_name(), already account for sysfs strings. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Dan Williams Reviewed-by: Greg Kroah-Hartman --- drivers/base/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 67d39a90b45c..5d31b962c898 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3078,7 +3078,7 @@ struct device *device_find_child_by_name(struct device *parent, klist_iter_init(&parent->p->klist_children, &i); while ((child = next_device(&i))) - if (!strcmp(dev_name(child), name) && get_device(child)) + if (sysfs_streq(dev_name(child), name) && get_device(child)) break; klist_iter_exit(&i); return child;