Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp62699pxu; Tue, 6 Oct 2020 00:15:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxq1VcdHxybQ0CkeAsRwoj55oGyN5lcoJbaBlDmvH1OmOupVNqAS3auVTNf89/VKXc0WKtX X-Received: by 2002:a50:9fa8:: with SMTP id c37mr3867418edf.233.1601968537613; Tue, 06 Oct 2020 00:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601968537; cv=none; d=google.com; s=arc-20160816; b=bBYwrmnRhKerYBKxs8wE57bNKhRVvsw0wtbeiZ0t2ISd5xNpyD3ArysHzK6HXT/rql iqbF8NVGmGa2wmVE0gQiECA6REE9nmeRf0OsO/f/R9AhCsxcwXw6J2vKhE5tpqRkdHWI bdqKv1a7s5RyGQKe4r4jcVgRoEkGnWlwSfv9c8Yfgng6FBu84Q9VZhpwnF0dqsqKf8Jc MJfTF74D+YM/nhvmML/HgQvIZ5etEH/iTnzpBxTFy4ypeLAZWBEa8MrkUJysml23f9q3 Z7pKszlG+e6nH8pHzx379VICEautySo2dKhVB4AeVq5qAYZnHxnNeVpqLRH1dfxfW3Nn 6zzQ== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:ironport-sdr:ironport-sdr; bh=G1V0nN4LTCOBEsVzzZ2CORQV6Ho3wXmkqVdwJZrTKVg=; b=CpIpKqXUL02PSCwExibv6inMJotBaP9vGYeJBOCcpYQAa6hA4EV6EjDrxwoZN/z5yW 7TEFQS8Jewq7cWtqMiz021YfCEOj7Q3CVNBbP99l5AOwG7YmDKQjE5j/4vNOnqGvsQFe kzf/K5VDRAo1mOwSwmKBYl9ZIPwb/RwsmBMjBEWe2VBZUjIfQwTn5lONZSFABQuYw/P0 wP4w7I7ddGYqWYUwifWvj0WOXy03Vqhnrz4Cx4+ZQYOrTw6ZWBmkJ7HqioclAW03pwYl 38KNASHc/FvWH7Yr9Uo0vgftJYCrok2kdzpxuFYH2lfXMuK9exzZ4PPeZF7wI18BO2tn jEJg== 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 oc24si1577671ejb.530.2020.10.06.00.15.15; Tue, 06 Oct 2020 00:15:37 -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 S1727255AbgJFHN4 (ORCPT + 99 others); Tue, 6 Oct 2020 03:13:56 -0400 Received: from mga09.intel.com ([134.134.136.24]:30954 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727151AbgJFHN4 (ORCPT ); Tue, 6 Oct 2020 03:13:56 -0400 IronPort-SDR: Gi5yuT+pyjOVZUoxOZDcVCm/Dd+kJVS29xCbVDW+aCFHk1SKEpqNLYtEgoTU6BH5tTiIn4TZ1W /Ikrl650HJ6w== X-IronPort-AV: E=McAfee;i="6000,8403,9765"; a="164535174" X-IronPort-AV: E=Sophos;i="5.77,342,1596524400"; d="scan'208";a="164535174" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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. 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;