summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorBrian King <brking@linux.vnet.ibm.com>2023-02-03 18:57:59 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-02-08 15:09:14 +0300
commit503a90dd619d52dcac2cc68bd742aa914c7cd47a (patch)
tree84abd0105e54d854c76e4065eb24565864c233cc /drivers/tty
parent760aa5e81f33e0da82512c4288489739a6d1c556 (diff)
downloadlinux-503a90dd619d52dcac2cc68bd742aa914c7cd47a.tar.xz
hvcs: Use driver groups to manage driver attributes
Rather than manually creating attributes for the hvcs driver, let the driver core do this for us. This also fixes some hotplug remove issues and ensures that cleanup of these attributes is done in the right order. Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Link: https://lore.kernel.org/r/20230203155802.404324-3-brking@linux.vnet.ibm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/hvc/hvcs.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index 0416601357e1..522910716025 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -466,6 +466,13 @@ static ssize_t rescan_store(struct device_driver *ddp, const char * buf,
static DRIVER_ATTR_RW(rescan);
+static struct attribute *hvcs_attrs[] = {
+ &driver_attr_rescan.attr,
+ NULL,
+};
+
+ATTRIBUTE_GROUPS(hvcs);
+
static void hvcs_kick(void)
{
hvcs_kicked = 1;
@@ -820,6 +827,7 @@ static struct vio_driver hvcs_vio_driver = {
.remove = hvcs_remove,
.name = hvcs_driver_name,
.driver = {
+ .groups = hvcs_groups,
.dev_groups = hvcs_dev_groups,
},
};
@@ -1498,13 +1506,6 @@ static int __init hvcs_module_init(void)
pr_info("HVCS: Driver registered.\n");
- /* This needs to be done AFTER the vio_register_driver() call or else
- * the kobjects won't be initialized properly.
- */
- rc = driver_create_file(&(hvcs_vio_driver.driver), &driver_attr_rescan);
- if (rc)
- pr_warn("HVCS: Failed to create rescan file (err %d)\n", rc);
-
return 0;
}
@@ -1529,8 +1530,6 @@ static void __exit hvcs_module_exit(void)
hvcs_pi_buff = NULL;
spin_unlock(&hvcs_pi_lock);
- driver_remove_file(&hvcs_vio_driver.driver, &driver_attr_rescan);
-
tty_unregister_driver(hvcs_tty_driver);
hvcs_free_index_list();