Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp409445ybh; Sun, 12 Jul 2020 10:11:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPIMWKGbV4uTTHitpSceg8uPN/IbpVaXx5PXtaXczSiHa5nDITjHkzUD4rpwUL/Zzhnroc X-Received: by 2002:a17:906:9716:: with SMTP id k22mr51811759ejx.200.1594573897652; Sun, 12 Jul 2020 10:11:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594573897; cv=none; d=google.com; s=arc-20160816; b=VffDAenoCNmjY2Q1HW8RAZiPol0u7OOi8CyCTP83KJI97rsnb2UAWb0cmfPQMj3aJG 6ZT/s+NeEOA3oFN01CzHHl1mfWTu9PAkGQsKrmrHf+pav/gMMExIwOTlbud2vOX+Odkr 6H7BYMTd9923VUUhDWhKXQBHYcLw6sQgvoCTnj7UGWlJ3bFj2TeYfapu/7vj78gqH6w5 1xVxX+4axQD3WWeypR72+pYT5/P3Wi/2lHpTTRykbEmA+BmBg0QL5TCIopDVi3HmnFFi jALztK1L28YvAFmL83OE2q/7vnjaHk86Se67aJe6vjyV4EWK6ibE1GURpRIJB2b/99+l Sb3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=kzOurP1MOWYAQ80CaabzZcPPBoBU/L8NvfQ1a0mPtLc=; b=L+7PHqk6pjsk5RqWOerwJ8ENpxaIw+pBbQNLzSDfp452r7+xuXrDQjyjZKgTFRRKiq m6zKzlI/SLpY+XdFTWS0iDI6kzBI5cpzgEBjpYYp/cq2a5z6mJzykWJdRXKymRlGbP1E OPmyG1TffhyTPWXPqakBe3RKDciiOD5qIdGi6VQqeM4UJwJy1nITilowpYXgZEKyPfZK o1F5xTG1ah+rKZ0fH9ytakgXPQCK4IWApMOpgBPTDv8CRv5cNIemhIqmBlbRxasUgdk8 6eP4+5WVVO0azYWBhbwwu+SIxbaKshxdcjcKsFIt69WUHhlRrZ0b/ra4/clJHN70NpQ2 RyhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OZqzQZEo; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s25si7639703ejv.413.2020.07.12.10.11.12; Sun, 12 Jul 2020 10:11: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; dkim=pass header.i=@kernel.org header.s=default header.b=OZqzQZEo; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729147AbgGLRJu (ORCPT + 99 others); Sun, 12 Jul 2020 13:09:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:34170 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728844AbgGLRJu (ORCPT ); Sun, 12 Jul 2020 13:09:50 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8DFDF20702; Sun, 12 Jul 2020 17:09:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594573790; bh=a848+2Ogmip7OA1pq5ZWFjhMfOh9SLYFsM119KDBbhQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OZqzQZEoZxSAGSrZFfXjXZQUtkypTiKs2Oet5qlnQPBEPa6ZT4u2d206gYnjrbJlG BxemuBXiEumBOik0eAXItqnjOv/68W9VGr6zWzI0KQhtqMhYMb+hxYxeobXV6CpOk6 myjlUwl2om3T4Vi71OVbj9wKlmHuif0siks+8bGo= Date: Sun, 12 Jul 2020 19:09:45 +0200 From: Greg Kroah-Hartman To: Dan Williams Cc: linux-nvdimm@lists.01.org, "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 Subject: Re: [PATCH v2 17/22] drivers/base: Make device_find_child_by_name() compatible with sysfs inputs Message-ID: <20200712170945.GA194499@kroah.com> References: <159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com> <159457125753.754248.6000936585361264069.stgit@dwillia2-desk3.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <159457125753.754248.6000936585361264069.stgit@dwillia2-desk3.amr.corp.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 12, 2020 at 09:27:37AM -0700, Dan Williams wrote: > 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)) Who wants to call this function with a name passed from userspace? Not objecting to it, just curious... thanks, greg k-h