Skip to content

Commit ccec503

Browse files
hcahcaAlexander Gordeev
authored andcommitted
tty: hvc-iucv: Make use of iucv_alloc_device()
Make use of iucv_alloc_device() to get rid of quite some code. Acked-by: Alexandra Winter <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 3bbde49 commit ccec503

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

drivers/tty/hvc/hvc_iucv.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,11 +1035,6 @@ static const struct attribute_group *hvc_iucv_dev_attr_groups[] = {
10351035
NULL,
10361036
};
10371037

1038-
static void hvc_iucv_free(struct device *data)
1039-
{
1040-
kfree(data);
1041-
}
1042-
10431038
/**
10441039
* hvc_iucv_alloc() - Allocates a new struct hvc_iucv_private instance
10451040
* @id: hvc_iucv_table index
@@ -1090,18 +1085,12 @@ static int __init hvc_iucv_alloc(int id, unsigned int is_console)
10901085
memcpy(priv->srv_name, name, 8);
10911086
ASCEBC(priv->srv_name, 8);
10921087

1093-
/* create and setup device */
1094-
priv->dev = kzalloc(sizeof(*priv->dev), GFP_KERNEL);
1088+
priv->dev = iucv_alloc_device(hvc_iucv_dev_attr_groups, NULL,
1089+
priv, "hvc_iucv%d", id);
10951090
if (!priv->dev) {
10961091
rc = -ENOMEM;
10971092
goto out_error_dev;
10981093
}
1099-
dev_set_name(priv->dev, "hvc_iucv%d", id);
1100-
dev_set_drvdata(priv->dev, priv);
1101-
priv->dev->bus = &iucv_bus;
1102-
priv->dev->parent = iucv_root;
1103-
priv->dev->groups = hvc_iucv_dev_attr_groups;
1104-
priv->dev->release = hvc_iucv_free;
11051094
rc = device_register(priv->dev);
11061095
if (rc) {
11071096
put_device(priv->dev);

0 commit comments

Comments
 (0)