Thread (10 messages) 10 messages, 2 authors, 2023-02-03

Re: [PATCH v2 2/6] hvcs: Use dev_groups to manage hvcs device attributes

flat view

From: Greg KH <gregkh@linuxfoundation.org>
Date: 2023-02-03 05:11:18
Also in: linux-serial

On Thu, Feb 02, 2023 at 04:28:00PM -0600, Brian King wrote:
quoted hunk ↗ jump to hunk
Use the dev_groups functionality to manage the attribute groups
for hvcs devices. This simplifies the code and also eliminates
errors coming from kernfs when attempting to remove a console
device that is in use.

Signed-off-by: Brian King <redacted>
---
 drivers/tty/hvc/hvcs.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index faf5ccfc561e..7f79444b4d89 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -432,7 +432,7 @@ static ssize_t hvcs_index_show(struct device *dev, struct device_attribute *attr
 
 static DEVICE_ATTR(index, S_IRUGO, hvcs_index_show, NULL);
 
-static struct attribute *hvcs_attrs[] = {
+static struct attribute *hvcs_dev_attrs[] = {
 	&dev_attr_partner_vtys.attr,
 	&dev_attr_partner_clcs.attr,
 	&dev_attr_current_vty.attr,
@@ -441,8 +441,13 @@ static struct attribute *hvcs_attrs[] = {
 	NULL,
 };
 
-static struct attribute_group hvcs_attr_group = {
-	.attrs = hvcs_attrs,
+static struct attribute_group hvcs_attr_dev_group = {
+	.attrs = hvcs_dev_attrs,
+};
+
+const static struct attribute_group *hvcs_attr_dev_groups[] = {
+	&hvcs_attr_dev_group,
+	NULL,
 };
Why not just use the ATTRIBUTE_GROUPS() macro here?

thanks,

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help