aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2012-05-15 11:55:36 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-05-16 08:42:47 -0400
commit00d5bdd17b6e2648ecff718e71c328864c9aae00 (patch)
tree7fe43de922b3701c730f713d31702e8cb7745a70 /drivers/s390/net
parent20cdffa437f51f3afdf41e431ca17014434d3037 (diff)
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: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/net')
-rw-r--r--drivers/s390/net/lcs.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 687efe4d589..0abba936421 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -2051,10 +2051,17 @@ static struct attribute * lcs_attrs[] = {
2051 &dev_attr_recover.attr, 2051 &dev_attr_recover.attr,
2052 NULL, 2052 NULL,
2053}; 2053};
2054
2055static struct attribute_group lcs_attr_group = { 2054static struct attribute_group lcs_attr_group = {
2056 .attrs = lcs_attrs, 2055 .attrs = lcs_attrs,
2057}; 2056};
2057static const struct attribute_group *lcs_attr_groups[] = {
2058 &lcs_attr_group,
2059 NULL,
2060};
2061static const struct device_type lcs_devtype = {
2062 .name = "lcs",
2063 .groups = lcs_attr_groups,
2064};
2058 2065
2059/** 2066/**
2060 * lcs_probe_device is called on establishing a new ccwgroup_device. 2067 * lcs_probe_device is called on establishing a new ccwgroup_device.
@@ -2063,7 +2070,6 @@ static int
2063lcs_probe_device(struct ccwgroup_device *ccwgdev) 2070lcs_probe_device(struct ccwgroup_device *ccwgdev)
2064{ 2071{
2065 struct lcs_card *card; 2072 struct lcs_card *card;
2066 int ret;
2067 2073
2068 if (!get_device(&ccwgdev->dev)) 2074 if (!get_device(&ccwgdev->dev))
2069 return -ENODEV; 2075 return -ENODEV;
@@ -2075,12 +2081,6 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev)
2075 put_device(&ccwgdev->dev); 2081 put_device(&ccwgdev->dev);
2076 return -ENOMEM; 2082 return -ENOMEM;
2077 } 2083 }
2078 ret = sysfs_create_group(&ccwgdev->dev.kobj, &lcs_attr_group);
2079 if (ret) {
2080 lcs_free_card(card);
2081 put_device(&ccwgdev->dev);
2082 return ret;
2083 }
2084 dev_set_drvdata(&ccwgdev->dev, card); 2084 dev_set_drvdata(&ccwgdev->dev, card);
2085 ccwgdev->cdev[0]->handler = lcs_irq; 2085 ccwgdev->cdev[0]->handler = lcs_irq;
2086 ccwgdev->cdev[1]->handler = lcs_irq; 2086 ccwgdev->cdev[1]->handler = lcs_irq;
@@ -2089,7 +2089,9 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev)
2089 card->thread_start_mask = 0; 2089 card->thread_start_mask = 0;
2090 card->thread_allowed_mask = 0; 2090 card->thread_allowed_mask = 0;
2091 card->thread_running_mask = 0; 2091 card->thread_running_mask = 0;
2092 return 0; 2092 ccwgdev->dev.type = &lcs_devtype;
2093
2094 return 0;
2093} 2095}
2094 2096
2095static int 2097static int
@@ -2323,9 +2325,9 @@ lcs_remove_device(struct ccwgroup_device *ccwgdev)
2323 } 2325 }
2324 if (card->dev) 2326 if (card->dev)
2325 unregister_netdev(card->dev); 2327 unregister_netdev(card->dev);
2326 sysfs_remove_group(&ccwgdev->dev.kobj, &lcs_attr_group);
2327 lcs_cleanup_card(card); 2328 lcs_cleanup_card(card);
2328 lcs_free_card(card); 2329 lcs_free_card(card);
2330 dev_set_drvdata(&ccwgdev->dev, NULL);
2329 put_device(&ccwgdev->dev); 2331 put_device(&ccwgdev->dev);
2330} 2332}
2331 2333
@@ -2412,7 +2414,7 @@ static struct ccwgroup_driver lcs_group_driver = {
2412 }, 2414 },
2413 .max_slaves = 2, 2415 .max_slaves = 2,
2414 .driver_id = 0xD3C3E2, 2416 .driver_id = 0xD3C3E2,
2415 .probe = lcs_probe_device, 2417 .setup = lcs_probe_device,
2416 .remove = lcs_remove_device, 2418 .remove = lcs_remove_device,
2417 .set_online = lcs_new_device, 2419 .set_online = lcs_new_device,
2418 .set_offline = lcs_shutdown_device, 2420 .set_offline = lcs_shutdown_device,
@@ -2423,17 +2425,14 @@ static struct ccwgroup_driver lcs_group_driver = {
2423 .restore = lcs_restore, 2425 .restore = lcs_restore,
2424}; 2426};
2425 2427
2426static ssize_t 2428static ssize_t lcs_driver_group_store(struct device_driver *ddrv,
2427lcs_driver_group_store(struct device_driver *ddrv, const char *buf, 2429 const char *buf, size_t count)
2428 size_t count)
2429{ 2430{
2430 int err; 2431 int err;
2431 err = ccwgroup_create_from_string(lcs_root_dev, 2432 err = ccwgroup_create_dev(lcs_root_dev, lcs_group_driver.driver_id,
2432 lcs_group_driver.driver_id, 2433 &lcs_group_driver, 2, buf);
2433 &lcs_ccw_driver, 2, buf);
2434 return err ? err : count; 2434 return err ? err : count;
2435} 2435}
2436
2437static DRIVER_ATTR(group, 0200, NULL, lcs_driver_group_store); 2436static DRIVER_ATTR(group, 0200, NULL, lcs_driver_group_store);
2438 2437
2439static struct attribute *lcs_group_attrs[] = { 2438static struct attribute *lcs_group_attrs[] = {