Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4261552ybb; Mon, 23 Mar 2020 17:12:15 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtW5Dvs6uGrqoDC1FQZqSr5+N1WXbVgbTTTw8ONNvqYvYTlCY5cobvFpUN2lMK9YzIdg3rV X-Received: by 2002:aca:cdd1:: with SMTP id d200mr1425728oig.153.1585008735372; Mon, 23 Mar 2020 17:12:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585008735; cv=none; d=google.com; s=arc-20160816; b=AacIF5WrVxNHxZffKfMdYXRCEeD6d8itKkk1qlB/MVoOxtKrXBpf7LtYIOMu3ITda2 BpoeSswH4LxMcGLAOUs+O2Aw7XuYd9bt0SmDsCMpuQz6nCfRD6KnCzNDCTEXKbvEZ00S xnXUrrsqT9VTdMNNisNUP3CF0MX2dyDOnyziZ0MA+iGLmLvM/JOfuXjU7RZqdZoDa2qU Y+685mJfw02DEjlmKhYJA35MBck5uFzRjTCDqOn8Zy2hB2GgwT+w0A1bJfKvFxdYzTe8 iakI6NjQAUAadE8+vqpP1MmFrUZPvL1Qdr/TKflDxHD6Dh+4FBsmmr9wQ+7SnmGr6LSH De2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:ironport-sdr:ironport-sdr; bh=AuY2SZ2k5gKhTjP91L+d/diDDOCvBQJsxEhgG9F4SDQ=; b=pa8NCSytTq01lToNNwytVJyWo1fFvNEXENBqMC1162+RRiPhbk8IxUkuPsxi/YNyta /T4TkAWAwt3TsxE4+jlg5Pop4z0kD6GIqdhhlZLTASUKDuCCBGkrbm9zRlVfxZjUrBch yM39ZSZ/ONdC2LqGqLPbNBaQIX29vGjmAnhUpzILAoX0QxN6oeOhHgGtbxatD7a6b3Bu 33bhsZj0ap41zTO1gslTv/huFxb4beOFWX9DpG9qy1CHieYlpC3csmbECX0hbmHwHBix OqrqAIEUlcHADdnMBx/Y1fREVYCbFOhc1HUfhfrc1ZwX1biwDJ5GovTXC3lThLtQqcSR YbJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f77si511620oob.89.2020.03.23.17.12.02; Mon, 23 Mar 2020 17:12:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727517AbgCXALU (ORCPT + 99 others); Mon, 23 Mar 2020 20:11:20 -0400 Received: from mga09.intel.com ([134.134.136.24]:56291 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727299AbgCXALU (ORCPT ); Mon, 23 Mar 2020 20:11:20 -0400 IronPort-SDR: 8A/iedMK6PWeaCH/TC5ECRKdYZm3TNAgPNJBZYMeKuvtgZNNbTWWgYZeC9a28qlzydaW5E0jfl YK04sMXwWUAQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2020 17:11:19 -0700 IronPort-SDR: +yzgMZ4pMuQpT1NE7He3vuTOG2pgPJ7SLhUCST9bTczk+5BUCwe+yqr8TSGaKO3j4lsCilPm5N j5h/viUtpnPw== X-IronPort-AV: E=Sophos;i="5.72,298,1580803200"; d="scan'208";a="325739407" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2020 17:11:19 -0700 Subject: [PATCH 07/12] drivers/base: Make device_find_child_by_name() compatible with sysfs inputs From: Dan Williams To: linux-mm@kvack.org Cc: vishal.l.verma@intel.com, dave.hansen@linux.intel.com, hch@lst.de, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, jmoyer@redhat.com Date: Mon, 23 Mar 2020 16:55:13 -0700 Message-ID: <158500771333.2088294.9851442753403203762.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <158500767138.2088294.17131646259803932461.stgit@dwillia2-desk3.amr.corp.intel.com> References: <158500767138.2088294.17131646259803932461.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 139cdf7e7327..4abfd4df42ec 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -2931,7 +2931,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;