Commit ccec5032 authored by Heiko Carstens's avatar Heiko Carstens Committed by Alexander Gordeev

tty: hvc-iucv: Make use of iucv_alloc_device()

Make use of iucv_alloc_device() to get rid of quite some code.
Acked-by: default avatarAlexandra Winter <wintera@linux.ibm.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240506194454.1160315-6-hca@linux.ibm.comSigned-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
parent 3bbde49e
...@@ -1035,11 +1035,6 @@ static const struct attribute_group *hvc_iucv_dev_attr_groups[] = { ...@@ -1035,11 +1035,6 @@ static const struct attribute_group *hvc_iucv_dev_attr_groups[] = {
NULL, NULL,
}; };
static void hvc_iucv_free(struct device *data)
{
kfree(data);
}
/** /**
* hvc_iucv_alloc() - Allocates a new struct hvc_iucv_private instance * hvc_iucv_alloc() - Allocates a new struct hvc_iucv_private instance
* @id: hvc_iucv_table index * @id: hvc_iucv_table index
...@@ -1090,18 +1085,12 @@ static int __init hvc_iucv_alloc(int id, unsigned int is_console) ...@@ -1090,18 +1085,12 @@ static int __init hvc_iucv_alloc(int id, unsigned int is_console)
memcpy(priv->srv_name, name, 8); memcpy(priv->srv_name, name, 8);
ASCEBC(priv->srv_name, 8); ASCEBC(priv->srv_name, 8);
/* create and setup device */ priv->dev = iucv_alloc_device(hvc_iucv_dev_attr_groups, NULL,
priv->dev = kzalloc(sizeof(*priv->dev), GFP_KERNEL); priv, "hvc_iucv%d", id);
if (!priv->dev) { if (!priv->dev) {
rc = -ENOMEM; rc = -ENOMEM;
goto out_error_dev; goto out_error_dev;
} }
dev_set_name(priv->dev, "hvc_iucv%d", id);
dev_set_drvdata(priv->dev, priv);
priv->dev->bus = &iucv_bus;
priv->dev->parent = iucv_root;
priv->dev->groups = hvc_iucv_dev_attr_groups;
priv->dev->release = hvc_iucv_free;
rc = device_register(priv->dev); rc = device_register(priv->dev);
if (rc) { if (rc) {
put_device(priv->dev); put_device(priv->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment