[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <159643102106.4062302.12229802117645312104.stgit@dwillia2-desk3.amr.corp.intel.com>
Date: Sun, 02 Aug 2020 22:03:41 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: akpm@...ux-foundation.org
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
peterz@...radead.org, vishal.l.verma@...el.com,
dave.hansen@...ux.intel.com, ard.biesheuvel@...aro.org,
vishal.l.verma@...el.com, linux-mm@...ck.org,
linux-nvdimm@...ts.01.org, joao.m.martins@...cle.com,
linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
dri-devel@...ts.freedesktop.org
Subject: [PATCH v4 14/23] drivers/base: Make device_find_child_by_name()
compatible with sysfs inputs
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" <rafael@...nel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Signed-off-by: Dan Williams <dan.j.williams@...el.com>
---
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;
Powered by blists - more mailing lists