Commit 00d5bdd1 authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

s390/lcs: switch to ccwgroup_create_dev

Switch to the new ccwgroup_create_dev interface. Also wrap device
attributes in a struct device_type and let the driver core create
these attributes automagically.
Reviewed-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 20cdffa4
...@@ -2051,10 +2051,17 @@ static struct attribute * lcs_attrs[] = { ...@@ -2051,10 +2051,17 @@ static struct attribute * lcs_attrs[] = {
&dev_attr_recover.attr, &dev_attr_recover.attr,
NULL, NULL,
}; };
static struct attribute_group lcs_attr_group = { static struct attribute_group lcs_attr_group = {
.attrs = lcs_attrs, .attrs = lcs_attrs,
}; };
static const struct attribute_group *lcs_attr_groups[] = {
&lcs_attr_group,
NULL,
};
static const struct device_type lcs_devtype = {
.name = "lcs",
.groups = lcs_attr_groups,
};
/** /**
* lcs_probe_device is called on establishing a new ccwgroup_device. * lcs_probe_device is called on establishing a new ccwgroup_device.
...@@ -2063,7 +2070,6 @@ static int ...@@ -2063,7 +2070,6 @@ static int
lcs_probe_device(struct ccwgroup_device *ccwgdev) lcs_probe_device(struct ccwgroup_device *ccwgdev)
{ {
struct lcs_card *card; struct lcs_card *card;
int ret;
if (!get_device(&ccwgdev->dev)) if (!get_device(&ccwgdev->dev))
return -ENODEV; return -ENODEV;
...@@ -2075,12 +2081,6 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev) ...@@ -2075,12 +2081,6 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev)
put_device(&ccwgdev->dev); put_device(&ccwgdev->dev);
return -ENOMEM; return -ENOMEM;
} }
ret = sysfs_create_group(&ccwgdev->dev.kobj, &lcs_attr_group);
if (ret) {
lcs_free_card(card);
put_device(&ccwgdev->dev);
return ret;
}
dev_set_drvdata(&ccwgdev->dev, card); dev_set_drvdata(&ccwgdev->dev, card);
ccwgdev->cdev[0]->handler = lcs_irq; ccwgdev->cdev[0]->handler = lcs_irq;
ccwgdev->cdev[1]->handler = lcs_irq; ccwgdev->cdev[1]->handler = lcs_irq;
...@@ -2089,6 +2089,8 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev) ...@@ -2089,6 +2089,8 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev)
card->thread_start_mask = 0; card->thread_start_mask = 0;
card->thread_allowed_mask = 0; card->thread_allowed_mask = 0;
card->thread_running_mask = 0; card->thread_running_mask = 0;
ccwgdev->dev.type = &lcs_devtype;
return 0; return 0;
} }
...@@ -2323,9 +2325,9 @@ lcs_remove_device(struct ccwgroup_device *ccwgdev) ...@@ -2323,9 +2325,9 @@ lcs_remove_device(struct ccwgroup_device *ccwgdev)
} }
if (card->dev) if (card->dev)
unregister_netdev(card->dev); unregister_netdev(card->dev);
sysfs_remove_group(&ccwgdev->dev.kobj, &lcs_attr_group);
lcs_cleanup_card(card); lcs_cleanup_card(card);
lcs_free_card(card); lcs_free_card(card);
dev_set_drvdata(&ccwgdev->dev, NULL);
put_device(&ccwgdev->dev); put_device(&ccwgdev->dev);
} }
...@@ -2412,7 +2414,7 @@ static struct ccwgroup_driver lcs_group_driver = { ...@@ -2412,7 +2414,7 @@ static struct ccwgroup_driver lcs_group_driver = {
}, },
.max_slaves = 2, .max_slaves = 2,
.driver_id = 0xD3C3E2, .driver_id = 0xD3C3E2,
.probe = lcs_probe_device, .setup = lcs_probe_device,
.remove = lcs_remove_device, .remove = lcs_remove_device,
.set_online = lcs_new_device, .set_online = lcs_new_device,
.set_offline = lcs_shutdown_device, .set_offline = lcs_shutdown_device,
...@@ -2423,17 +2425,14 @@ static struct ccwgroup_driver lcs_group_driver = { ...@@ -2423,17 +2425,14 @@ static struct ccwgroup_driver lcs_group_driver = {
.restore = lcs_restore, .restore = lcs_restore,
}; };
static ssize_t static ssize_t lcs_driver_group_store(struct device_driver *ddrv,
lcs_driver_group_store(struct device_driver *ddrv, const char *buf, const char *buf, size_t count)
size_t count)
{ {
int err; int err;
err = ccwgroup_create_from_string(lcs_root_dev, err = ccwgroup_create_dev(lcs_root_dev, lcs_group_driver.driver_id,
lcs_group_driver.driver_id, &lcs_group_driver, 2, buf);
&lcs_ccw_driver, 2, buf);
return err ? err : count; return err ? err : count;
} }
static DRIVER_ATTR(group, 0200, NULL, lcs_driver_group_store); static DRIVER_ATTR(group, 0200, NULL, lcs_driver_group_store);
static struct attribute *lcs_group_attrs[] = { static struct attribute *lcs_group_attrs[] = {
......
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