Message ID | 20230202222804.383229-4-brking@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
Series | hvcs: Various hvcs device hotplug fixes | expand |
On Thu, Feb 02, 2023 at 04:28:01PM -0600, Brian King wrote: > 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> > --- > drivers/tty/hvc/hvcs.c | 24 +++++++++++++++--------- > 1 file changed, 15 insertions(+), 9 deletions(-) > > diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c > index 7f79444b4d89..5de7ad555540 100644 > --- a/drivers/tty/hvc/hvcs.c > +++ b/drivers/tty/hvc/hvcs.c > @@ -473,6 +473,20 @@ 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, > +}; > + > +static struct attribute_group hvcs_attr_group = { > + .attrs = hvcs_attrs, > +}; > + > +const static struct attribute_group *hvcs_attr_groups[] = { > + &hvcs_attr_group, > + NULL, > +}; Again, ATTRIBUTE_GROUPS()? thanks, greg k-h
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c index 7f79444b4d89..5de7ad555540 100644 --- a/drivers/tty/hvc/hvcs.c +++ b/drivers/tty/hvc/hvcs.c @@ -473,6 +473,20 @@ 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, +}; + +static struct attribute_group hvcs_attr_group = { + .attrs = hvcs_attrs, +}; + +const static struct attribute_group *hvcs_attr_groups[] = { + &hvcs_attr_group, + NULL, +}; + static void hvcs_kick(void) { hvcs_kicked = 1; @@ -827,6 +841,7 @@ static struct vio_driver hvcs_vio_driver = { .remove = hvcs_remove, .name = hvcs_driver_name, .driver = { + .groups = hvcs_attr_groups, .dev_groups = hvcs_attr_dev_groups, }, }; @@ -1505,13 +1520,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; } @@ -1536,8 +1544,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();
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> --- drivers/tty/hvc/hvcs.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)