From patchwork Tue Oct 6 06:55:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 11818159 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 7D300112E for ; Tue, 6 Oct 2020 07:13:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 40B4A20760 for ; Tue, 6 Oct 2020 07:13:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 40B4A20760 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 68F1E6B0072; Tue, 6 Oct 2020 03:13:58 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 63E296B0073; Tue, 6 Oct 2020 03:13:58 -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 5544A6B0074; Tue, 6 Oct 2020 03:13:58 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0187.hostedemail.com [216.40.44.187]) by kanga.kvack.org (Postfix) with ESMTP id 29DE96B0072 for ; Tue, 6 Oct 2020 03:13:58 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9AEA4246E for ; Tue, 6 Oct 2020 07:13:57 +0000 (UTC) X-FDA: 77340636114.11.toes60_3114feb271c4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 78BAD180F8B80 for ; Tue, 6 Oct 2020 07:13:57 +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.43:@intel.com:.lbl8.mailshell.net-64.95.201.95 62.18.0.100;04yfkgo9trmobxcj469pjw496nwxjop7ez4dnyaazxssx4ndb7617j6qkbxfrrh.6nqatx9yod8mrr8bgbjh8b6w383oigkkphog7pxj77ab7xmumaxn5zee897r3h4.1-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:26,LUA_SUMMARY:none X-HE-Tag: toes60_3114feb271c4 X-Filterd-Recvd-Size: 3046 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Tue, 6 Oct 2020 07:13:56 +0000 (UTC) IronPort-SDR: KvciLlLqH5JXHDvqt31nrGKK6kTVP/DN3Hs3svWRiE7fFFen/YafKfM/FPHpWRsqf7RIZgGpWW 8U2iU24mmmZA== X-IronPort-AV: E=McAfee;i="6000,8403,9765"; a="249096514" X-IronPort-AV: E=Sophos;i="5.77,342,1596524400"; d="scan'208";a="249096514" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2020 00:13:55 -0700 IronPort-SDR: sfrFYKkMkTEm8grxYVMT2eKlEnknJZoxXWdav0SCynO/g8Aa/yC7Bji2Yb1zXcWoNFHrAqd3i5 oJo/vSa5ovKw== X-IronPort-AV: E=Sophos;i="5.77,342,1596524400"; d="scan'208";a="354153340" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2020 00:13:54 -0700 Subject: [PATCH v6 07/11] drivers/base: make device_find_child_by_name() compatible with sysfs inputs From: Dan Williams To: akpm@linux-foundation.org Cc: Greg Kroah-Hartman , vishal.l.verma@intel.com, dave.hansen@linux.intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, david@redhat.com, joao.m.martins@oracle.com Date: Mon, 05 Oct 2020 23:55:24 -0700 Message-ID: <160196732484.2166475.16980505813689742952.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <160196728453.2166475.12832711415715687418.stgit@dwillia2-desk3.amr.corp.intel.com> References: <160196728453.2166475.12832711415715687418.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 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. Link: https://lkml.kernel.org/r/159643102106.4062302.12229802117645312104.stgit@dwillia2-desk3.amr.corp.intel.com Reviewed-by: Greg Kroah-Hartman Signed-off-by: Dan Williams --- 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 bb5806a2bd4c..8dd753539c06 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3324,7 +3324,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;