Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1805252pxa; Sun, 2 Aug 2020 22:21:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8Hgm4O4DemdU7puWMUPFXDnWDYYMHuH1Fp5hrdesC33YGVbxm7DWvjLt0q7ohgKdT+PUM X-Received: by 2002:a17:906:84cf:: with SMTP id f15mr3253803ejy.259.1596432087731; Sun, 02 Aug 2020 22:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596432087; cv=none; d=google.com; s=arc-20160816; b=WK4y19d5I8VGlpEomIsn5LjYHwA+AEdiTShnoOIja6C1RbTxBx6IAdYexTKUzN34F9 RPDbyZLMH5br1JbeLrIdVsh52wB1Iz0bNwO4ydUW5/VClqrosq0nB5L5KEk+3S5RSgUU 7xv4bkCBY2K/yYINx3sRx5YAIrTjSyK7ylax1cxIuFaaCAfKObEpvWar9g4LX1sk4KH9 xhFkSfxjfjeOGsWj0HzonqyN19jK+X/mW70r3Mup+khmWUdN16YnxH2+lfgCkp9MDftR VJ2So0IrvzSY1C+w8AU5UAe0rZkfMCHUKSEwgVZ6kwgnfPKtQ/sqK+0tZgyaUv8g5m9X MnzA== 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=Oljc7cNLG4/B5t0D4Y+sV6KZyURLVWLQcCv7GR/4f/0=; b=T3xyylAjYdTJG7lnwWxB/eBAb1l6iYzkt3iChXi4M2nI0dQLlhad8qWyh0T9IZcne+ 3A3IY+NnwxDv6Zt3fjXL1u6L1JxS/CKGHaVSvzmkyK9YN8TPxM5C5wLX6CV8kyCV9mZ1 6M3wu5rjEnFQgwQ4Z56/dmJU0KZjlWVoNooFH60hKb2H50ZB3SXfoh4nunPk7PDoOxWV P48mynRIdB2+UOsGFQ+kghA1ELD+jQcWYUbvOZYkQ2tH9MNTDRg9LmmEh0YxArRJ+hj7 u1MhiXepMpGO1hKcZX/pyJCVwfYlbgGzvKYqJsfDcJvQK68W8wIKDR6+bpieG0/GsOHn Vd2A== 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 by29si9745481edb.452.2020.08.02.22.21.06; Sun, 02 Aug 2020 22:21: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 S1728213AbgHCFUA (ORCPT + 99 others); Mon, 3 Aug 2020 01:20:00 -0400 Received: from mga07.intel.com ([134.134.136.100]:16879 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727831AbgHCFUA (ORCPT ); Mon, 3 Aug 2020 01:20:00 -0400 IronPort-SDR: Pkt9hVaxyj4aqOhQDDTqe8yxEJeu7gjFSShCn4/KIrH1kYtbKmB5EFjvLp+kSLNlTM7HsxPmxr Y5pepAd2K5rg== X-IronPort-AV: E=McAfee;i="6000,8403,9701"; a="216472184" X-IronPort-AV: E=Sophos;i="5.75,429,1589266800"; d="scan'208";a="216472184" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2020 22:19:59 -0700 IronPort-SDR: 1P3zlw70YK4CpXzkgSelhDwpbESepA0dWywWnFc5gq0JD7383hb5d8+IfsWhWoC5qtQg2dxy/x IDKWeYxwiZ+w== X-IronPort-AV: E=Sophos;i="5.75,429,1589266800"; d="scan'208";a="366195655" 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; 02 Aug 2020 22:19:59 -0700 Subject: [PATCH v4 14/23] drivers/base: Make device_find_child_by_name() compatible with sysfs inputs From: Dan Williams To: akpm@linux-foundation.org Cc: "Rafael J. Wysocki" , Greg Kroah-Hartman , peterz@infradead.org, vishal.l.verma@intel.com, dave.hansen@linux.intel.com, ard.biesheuvel@linaro.org, vishal.l.verma@intel.com, linux-mm@kvack.org, linux-nvdimm@lists.01.org, joao.m.martins@oracle.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org Date: Sun, 02 Aug 2020 22:03:41 -0700 Message-ID: <159643102106.4062302.12229802117645312104.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <159643094279.4062302.17779410714418721328.stgit@dwillia2-desk3.amr.corp.intel.com> References: <159643094279.4062302.17779410714418721328.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: "Rafael J. Wysocki" 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 2169c5132558..231189dd6599 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3328,7 +3328,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;