Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1398544pxk; Fri, 25 Sep 2020 13:47:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYIqVxkzyhjQkla8gBMEqsZPYiFzhLGqefSFm1Z2oBZv0gV2uZfslznNbj94Vdt8ASNCDl X-Received: by 2002:a50:9b19:: with SMTP id o25mr3218624edi.340.1601066839282; Fri, 25 Sep 2020 13:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601066839; cv=none; d=google.com; s=arc-20160816; b=be95nfHLYSdwlAGmRSjZeBwDYf3gyP3Vhn+vO+BfbuM/cLr7amfRsIyshBXaxzd0is zz1HYdNQYBYVOhLYkuYTOHMDu1rsgUN1x0lmGAT04DqIyc6UrJaOR+ZCUYAULYLSskDv +GuOAaUwKwvGhvP7p+xffcFBhD7f+G1+IQyV0OpeEYvtzGedFRXCas/mSQW1R+GR8SBw bcwimoaWkMYDAHdwu5yWLvwVRnmQTlUgdF1xBDEPmlzpUsv6Lt7YRGgEmJNPY5/wt9Wf M3OOZ8RY0p6/PxHEaVGxIhFqtuW/pMlADTkYf0gAGh/OGp//ID3RYYm/BgLFbxYzOXUJ UhDA== 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=eKY8hOZROP10FcLX/ZXDOvrlpVj6DFyaUWiF1UP86WLykUCuLN+oD4RDw7LbCc+edj SmQq2KglyEq0oNnmUUE1Dg6LbAM3f5e6Z7YN8KUA1W90C5tQ7YuH2iHfkv8IIPoS3ZhJ S5zQfERVKQPMi2Immj8YH0fMQD1Zc8x6apshwSuFS/MR6asv8xkzXiT4p76ug4Vx1xOW tfNNzEvs0p0az9KGW8rSpENhoQ9yAlywxBhSVAj1sZEIvAjWpt905nYW9epZZu6PYx6V 2C+9FU+8EW6yQ3nMZETQhT/E/PpMLiAeV95ozLRz5F0h0kRqWmyfZzVXKlrR1gF2rQUL CiZA== 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 f23si2552081edm.413.2020.09.25.13.46.56; Fri, 25 Sep 2020 13:47:19 -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 S1728069AbgIYUpX (ORCPT + 99 others); Fri, 25 Sep 2020 16:45:23 -0400 Received: from mga05.intel.com ([192.55.52.43]:41393 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729060AbgIYUpT (ORCPT ); Fri, 25 Sep 2020 16:45:19 -0400 IronPort-SDR: YQo5HMeHaGsP8nA/Mbn8gRNRPUxZwLwtYO36IXLYguO+Nh+HYeRflUoKl160ME3PLFlSph7Zn/ NuGGL8AUkVvg== X-IronPort-AV: E=McAfee;i="6000,8403,9755"; a="246406661" X-IronPort-AV: E=Sophos;i="5.77,303,1596524400"; d="scan'208";a="246406661" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2020 12:30:47 -0700 IronPort-SDR: mGOyAahmSl88IwnzaNU6XOo3LN2NougVjjaFx3eJJas0MrZYJr9vmHgPlYnWY9ZfCvni9i9zdV ozDGcFiSDMoQ== X-IronPort-AV: E=Sophos;i="5.77,303,1596524400"; d="scan'208";a="343718802" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2020 12:30:47 -0700 Subject: [PATCH v5 08/17] 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-nvdimm@lists.01.org, linux-kernel@vger.kernel.org Date: Fri, 25 Sep 2020 12:12:25 -0700 Message-ID: <160106114576.30709.2960091665444712180.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <160106109960.30709.7379926726669669398.stgit@dwillia2-desk3.amr.corp.intel.com> References: <160106109960.30709.7379926726669669398.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;