Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp396270ybh; Sun, 12 Jul 2020 09:47:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxX8S5CIB77InyHRj092KlevtlH/4mBpcg3/d6NF3CHqq01eH990mMS/Plg7qdS0s1Hwwxb X-Received: by 2002:a05:6402:1ade:: with SMTP id ba30mr26639431edb.231.1594572447274; Sun, 12 Jul 2020 09:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594572447; cv=none; d=google.com; s=arc-20160816; b=vYvSdyBN111xixHIu+/MfYac+uRYTZukK1eOgTM3ZbxY3xb0fU0vf6H9jgXeMObeEo 5Pri4cvr8y5J+a1jIJSlgsgn0jaN2aDI+vCRo+JXD0G2yBRfo5z+WwOavPFYSy6j8739 yrg+cVgkQXgxSlHmknvR58vnvN3M6ppo65HdUILsd69Yd9aHnhU8Pm9mN7h2ZJTHsCEp qWV60UOZ1kH2BAgRtrP2v/dJnqBtFgUBGf/eb31ah2+0yNsi2ztC1pT1+TPecdqwNfp3 RO0PKTYRKp79tz3UxvUv+2xzmPrd1SFPtzkCM/qyfAXk7ficLsIqb6CagaFncNpHqmqj 4w6g== 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=gAzlZGitIsZySfrvByALO5X3DtSTer1GPvyTo/KnIGo=; b=nFEd3rqOuoqsQs8zR4bHHHVL3N7fzpqxzk8Di2V2pgu11F0WJFd/f4QbalEal4t5Kc WLy4msRUwfuxY87P8UECHlpmvyshSUi/S24yqoZVN9CHSApthYJJfQ6Pzdt3TDb0p145 PzTIk59EqylZ0NPgps6LyKxjSQPsAjPpxZetnrfEnHeywPOmimu94uQ3pXaQNBJ+9L7e r01nFKBFhKf+MHzXCAZTisoCYrxyihgGJ2mz6j3o5dZe9Wr/f5lVLffN0Zzx+lbw9OYQ Tya5Zns8mIr572IC+4soTdBAvyAYa3vKsDnmX5ZzWcdj7R0otMh/i/7lb/8G3/ZxUoQc do1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id mb18si8356613ejb.384.2020.07.12.09.47.04; Sun, 12 Jul 2020 09:47:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729320AbgGLQn5 (ORCPT + 99 others); Sun, 12 Jul 2020 12:43:57 -0400 Received: from mga05.intel.com ([192.55.52.43]:25486 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728972AbgGLQny (ORCPT ); Sun, 12 Jul 2020 12:43:54 -0400 IronPort-SDR: W/uVagDg6QODjyUKwjwOTuYALFu6fdxpVClUmTtGylNqlMopOsBYyDRxqe43EBG9r4UwoT231V 762eT/2dM5xA== X-IronPort-AV: E=McAfee;i="6000,8403,9680"; a="233371314" X-IronPort-AV: E=Sophos;i="5.75,344,1589266800"; d="scan'208";a="233371314" 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; 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 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. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" 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 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;