diff options
Diffstat (limited to 'drivers/s390/net/lcs.c')
-rw-r--r-- | drivers/s390/net/lcs.c | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 6056cf6da035..a3adf4b1c60d 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c | |||
@@ -2040,10 +2040,17 @@ static struct attribute * lcs_attrs[] = { | |||
2040 | &dev_attr_recover.attr, | 2040 | &dev_attr_recover.attr, |
2041 | NULL, | 2041 | NULL, |
2042 | }; | 2042 | }; |
2043 | |||
2044 | static struct attribute_group lcs_attr_group = { | 2043 | static struct attribute_group lcs_attr_group = { |
2045 | .attrs = lcs_attrs, | 2044 | .attrs = lcs_attrs, |
2046 | }; | 2045 | }; |
2046 | static const struct attribute_group *lcs_attr_groups[] = { | ||
2047 | &lcs_attr_group, | ||
2048 | NULL, | ||
2049 | }; | ||
2050 | static const struct device_type lcs_devtype = { | ||
2051 | .name = "lcs", | ||
2052 | .groups = lcs_attr_groups, | ||
2053 | }; | ||
2047 | 2054 | ||
2048 | /** | 2055 | /** |
2049 | * lcs_probe_device is called on establishing a new ccwgroup_device. | 2056 | * lcs_probe_device is called on establishing a new ccwgroup_device. |
@@ -2052,7 +2059,6 @@ static int | |||
2052 | lcs_probe_device(struct ccwgroup_device *ccwgdev) | 2059 | lcs_probe_device(struct ccwgroup_device *ccwgdev) |
2053 | { | 2060 | { |
2054 | struct lcs_card *card; | 2061 | struct lcs_card *card; |
2055 | int ret; | ||
2056 | 2062 | ||
2057 | if (!get_device(&ccwgdev->dev)) | 2063 | if (!get_device(&ccwgdev->dev)) |
2058 | return -ENODEV; | 2064 | return -ENODEV; |
@@ -2064,12 +2070,6 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev) | |||
2064 | put_device(&ccwgdev->dev); | 2070 | put_device(&ccwgdev->dev); |
2065 | return -ENOMEM; | 2071 | return -ENOMEM; |
2066 | } | 2072 | } |
2067 | ret = sysfs_create_group(&ccwgdev->dev.kobj, &lcs_attr_group); | ||
2068 | if (ret) { | ||
2069 | lcs_free_card(card); | ||
2070 | put_device(&ccwgdev->dev); | ||
2071 | return ret; | ||
2072 | } | ||
2073 | dev_set_drvdata(&ccwgdev->dev, card); | 2073 | dev_set_drvdata(&ccwgdev->dev, card); |
2074 | ccwgdev->cdev[0]->handler = lcs_irq; | 2074 | ccwgdev->cdev[0]->handler = lcs_irq; |
2075 | ccwgdev->cdev[1]->handler = lcs_irq; | 2075 | ccwgdev->cdev[1]->handler = lcs_irq; |
@@ -2078,7 +2078,9 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev) | |||
2078 | card->thread_start_mask = 0; | 2078 | card->thread_start_mask = 0; |
2079 | card->thread_allowed_mask = 0; | 2079 | card->thread_allowed_mask = 0; |
2080 | card->thread_running_mask = 0; | 2080 | card->thread_running_mask = 0; |
2081 | return 0; | 2081 | ccwgdev->dev.type = &lcs_devtype; |
2082 | |||
2083 | return 0; | ||
2082 | } | 2084 | } |
2083 | 2085 | ||
2084 | static int | 2086 | static int |
@@ -2306,9 +2308,9 @@ lcs_remove_device(struct ccwgroup_device *ccwgdev) | |||
2306 | } | 2308 | } |
2307 | if (card->dev) | 2309 | if (card->dev) |
2308 | unregister_netdev(card->dev); | 2310 | unregister_netdev(card->dev); |
2309 | sysfs_remove_group(&ccwgdev->dev.kobj, &lcs_attr_group); | ||
2310 | lcs_cleanup_card(card); | 2311 | lcs_cleanup_card(card); |
2311 | lcs_free_card(card); | 2312 | lcs_free_card(card); |
2313 | dev_set_drvdata(&ccwgdev->dev, NULL); | ||
2312 | put_device(&ccwgdev->dev); | 2314 | put_device(&ccwgdev->dev); |
2313 | } | 2315 | } |
2314 | 2316 | ||
@@ -2393,9 +2395,7 @@ static struct ccwgroup_driver lcs_group_driver = { | |||
2393 | .owner = THIS_MODULE, | 2395 | .owner = THIS_MODULE, |
2394 | .name = "lcs", | 2396 | .name = "lcs", |
2395 | }, | 2397 | }, |
2396 | .max_slaves = 2, | 2398 | .setup = lcs_probe_device, |
2397 | .driver_id = 0xD3C3E2, | ||
2398 | .probe = lcs_probe_device, | ||
2399 | .remove = lcs_remove_device, | 2399 | .remove = lcs_remove_device, |
2400 | .set_online = lcs_new_device, | 2400 | .set_online = lcs_new_device, |
2401 | .set_offline = lcs_shutdown_device, | 2401 | .set_offline = lcs_shutdown_device, |
@@ -2406,30 +2406,24 @@ static struct ccwgroup_driver lcs_group_driver = { | |||
2406 | .restore = lcs_restore, | 2406 | .restore = lcs_restore, |
2407 | }; | 2407 | }; |
2408 | 2408 | ||
2409 | static ssize_t | 2409 | static ssize_t lcs_driver_group_store(struct device_driver *ddrv, |
2410 | lcs_driver_group_store(struct device_driver *ddrv, const char *buf, | 2410 | const char *buf, size_t count) |
2411 | size_t count) | ||
2412 | { | 2411 | { |
2413 | int err; | 2412 | int err; |
2414 | err = ccwgroup_create_from_string(lcs_root_dev, | 2413 | err = ccwgroup_create_dev(lcs_root_dev, &lcs_group_driver, 2, buf); |
2415 | lcs_group_driver.driver_id, | ||
2416 | &lcs_ccw_driver, 2, buf); | ||
2417 | return err ? err : count; | 2414 | return err ? err : count; |
2418 | } | 2415 | } |
2419 | |||
2420 | static DRIVER_ATTR(group, 0200, NULL, lcs_driver_group_store); | 2416 | static DRIVER_ATTR(group, 0200, NULL, lcs_driver_group_store); |
2421 | 2417 | ||
2422 | static struct attribute *lcs_group_attrs[] = { | 2418 | static struct attribute *lcs_drv_attrs[] = { |
2423 | &driver_attr_group.attr, | 2419 | &driver_attr_group.attr, |
2424 | NULL, | 2420 | NULL, |
2425 | }; | 2421 | }; |
2426 | 2422 | static struct attribute_group lcs_drv_attr_group = { | |
2427 | static struct attribute_group lcs_group_attr_group = { | 2423 | .attrs = lcs_drv_attrs, |
2428 | .attrs = lcs_group_attrs, | ||
2429 | }; | 2424 | }; |
2430 | 2425 | static const struct attribute_group *lcs_drv_attr_groups[] = { | |
2431 | static const struct attribute_group *lcs_group_attr_groups[] = { | 2426 | &lcs_drv_attr_group, |
2432 | &lcs_group_attr_group, | ||
2433 | NULL, | 2427 | NULL, |
2434 | }; | 2428 | }; |
2435 | 2429 | ||
@@ -2453,7 +2447,7 @@ __init lcs_init_module(void) | |||
2453 | rc = ccw_driver_register(&lcs_ccw_driver); | 2447 | rc = ccw_driver_register(&lcs_ccw_driver); |
2454 | if (rc) | 2448 | if (rc) |
2455 | goto ccw_err; | 2449 | goto ccw_err; |
2456 | lcs_group_driver.driver.groups = lcs_group_attr_groups; | 2450 | lcs_group_driver.driver.groups = lcs_drv_attr_groups; |
2457 | rc = ccwgroup_driver_register(&lcs_group_driver); | 2451 | rc = ccwgroup_driver_register(&lcs_group_driver); |
2458 | if (rc) | 2452 | if (rc) |
2459 | goto ccwgroup_err; | 2453 | goto ccwgroup_err; |
@@ -2479,8 +2473,6 @@ __exit lcs_cleanup_module(void) | |||
2479 | { | 2473 | { |
2480 | pr_info("Terminating lcs module.\n"); | 2474 | pr_info("Terminating lcs module.\n"); |
2481 | LCS_DBF_TEXT(0, trace, "cleanup"); | 2475 | LCS_DBF_TEXT(0, trace, "cleanup"); |
2482 | driver_remove_file(&lcs_group_driver.driver, | ||
2483 | &driver_attr_group); | ||
2484 | ccwgroup_driver_unregister(&lcs_group_driver); | 2476 | ccwgroup_driver_unregister(&lcs_group_driver); |
2485 | ccw_driver_unregister(&lcs_ccw_driver); | 2477 | ccw_driver_unregister(&lcs_ccw_driver); |
2486 | root_device_unregister(lcs_root_dev); | 2478 | root_device_unregister(lcs_root_dev); |