提交 760aa5e8 编写于 作者: B Brian King 提交者: Greg Kroah-Hartman

hvcs: Use dev_groups to manage hvcs device attributes

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: NBrian King <brking@linux.vnet.ibm.com>
Link: https://lore.kernel.org/r/20230203155802.404324-2-brking@linux.vnet.ibm.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 ef25e16e
...@@ -432,7 +432,7 @@ static ssize_t hvcs_index_show(struct device *dev, struct device_attribute *attr ...@@ -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 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_vtys.attr,
&dev_attr_partner_clcs.attr, &dev_attr_partner_clcs.attr,
&dev_attr_current_vty.attr, &dev_attr_current_vty.attr,
...@@ -441,9 +441,7 @@ static struct attribute *hvcs_attrs[] = { ...@@ -441,9 +441,7 @@ static struct attribute *hvcs_attrs[] = {
NULL, NULL,
}; };
static struct attribute_group hvcs_attr_group = { ATTRIBUTE_GROUPS(hvcs_dev);
.attrs = hvcs_attrs,
};
static ssize_t rescan_show(struct device_driver *ddp, char *buf) static ssize_t rescan_show(struct device_driver *ddp, char *buf)
{ {
...@@ -688,8 +686,6 @@ static void hvcs_destruct_port(struct tty_port *p) ...@@ -688,8 +686,6 @@ static void hvcs_destruct_port(struct tty_port *p)
spin_unlock_irqrestore(&hvcsd->lock, flags); spin_unlock_irqrestore(&hvcsd->lock, flags);
spin_unlock(&hvcs_structs_lock); spin_unlock(&hvcs_structs_lock);
sysfs_remove_group(&vdev->dev.kobj, &hvcs_attr_group);
kfree(hvcsd); kfree(hvcsd);
} }
...@@ -721,7 +717,6 @@ static int hvcs_probe( ...@@ -721,7 +717,6 @@ static int hvcs_probe(
{ {
struct hvcs_struct *hvcsd; struct hvcs_struct *hvcsd;
int index, rc; int index, rc;
int retval;
if (!dev || !id) { if (!dev || !id) {
printk(KERN_ERR "HVCS: probed with invalid parameter.\n"); printk(KERN_ERR "HVCS: probed with invalid parameter.\n");
...@@ -778,13 +773,6 @@ static int hvcs_probe( ...@@ -778,13 +773,6 @@ static int hvcs_probe(
list_add_tail(&(hvcsd->next), &hvcs_structs); list_add_tail(&(hvcsd->next), &hvcs_structs);
spin_unlock(&hvcs_structs_lock); spin_unlock(&hvcs_structs_lock);
retval = sysfs_create_group(&dev->dev.kobj, &hvcs_attr_group);
if (retval) {
printk(KERN_ERR "HVCS: Can't create sysfs attrs for vty-server@%X\n",
hvcsd->vdev->unit_address);
return retval;
}
printk(KERN_INFO "HVCS: vty-server@%X added to the vio bus.\n", dev->unit_address); printk(KERN_INFO "HVCS: vty-server@%X added to the vio bus.\n", dev->unit_address);
/* /*
...@@ -831,6 +819,9 @@ static struct vio_driver hvcs_vio_driver = { ...@@ -831,6 +819,9 @@ static struct vio_driver hvcs_vio_driver = {
.probe = hvcs_probe, .probe = hvcs_probe,
.remove = hvcs_remove, .remove = hvcs_remove,
.name = hvcs_driver_name, .name = hvcs_driver_name,
.driver = {
.dev_groups = hvcs_dev_groups,
},
}; };
/* Only called from hvcs_get_pi please */ /* Only called from hvcs_get_pi please */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册