aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/lcs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/net/lcs.c')
-rw-r--r--drivers/s390/net/lcs.c73
1 files changed, 24 insertions, 49 deletions
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 687efe4d589a..a3adf4b1c60d 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -30,7 +30,6 @@
30#include <linux/if.h> 30#include <linux/if.h>
31#include <linux/netdevice.h> 31#include <linux/netdevice.h>
32#include <linux/etherdevice.h> 32#include <linux/etherdevice.h>
33#include <linux/trdevice.h>
34#include <linux/fddidevice.h> 33#include <linux/fddidevice.h>
35#include <linux/inetdevice.h> 34#include <linux/inetdevice.h>
36#include <linux/in.h> 35#include <linux/in.h>
@@ -50,8 +49,7 @@
50#include "lcs.h" 49#include "lcs.h"
51 50
52 51
53#if !defined(CONFIG_ETHERNET) && \ 52#if !defined(CONFIG_ETHERNET) && !defined(CONFIG_FDDI)
54 !defined(CONFIG_TR) && !defined(CONFIG_FDDI)
55#error Cannot compile lcs.c without some net devices switched on. 53#error Cannot compile lcs.c without some net devices switched on.
56#endif 54#endif
57 55
@@ -1166,10 +1164,7 @@ static void
1166lcs_get_mac_for_ipm(__be32 ipm, char *mac, struct net_device *dev) 1164lcs_get_mac_for_ipm(__be32 ipm, char *mac, struct net_device *dev)
1167{ 1165{
1168 LCS_DBF_TEXT(4,trace, "getmac"); 1166 LCS_DBF_TEXT(4,trace, "getmac");
1169 if (dev->type == ARPHRD_IEEE802_TR) 1167 ip_eth_mc_map(ipm, mac);
1170 ip_tr_mc_map(ipm, mac);
1171 else
1172 ip_eth_mc_map(ipm, mac);
1173} 1168}
1174 1169
1175/** 1170/**
@@ -1641,12 +1636,6 @@ lcs_startlan_auto(struct lcs_card *card)
1641 return 0; 1636 return 0;
1642 1637
1643#endif 1638#endif
1644#ifdef CONFIG_TR
1645 card->lan_type = LCS_FRAME_TYPE_TR;
1646 rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP);
1647 if (rc == 0)
1648 return 0;
1649#endif
1650#ifdef CONFIG_FDDI 1639#ifdef CONFIG_FDDI
1651 card->lan_type = LCS_FRAME_TYPE_FDDI; 1640 card->lan_type = LCS_FRAME_TYPE_FDDI;
1652 rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP); 1641 rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP);
@@ -2051,10 +2040,17 @@ static struct attribute * lcs_attrs[] = {
2051 &dev_attr_recover.attr, 2040 &dev_attr_recover.attr,
2052 NULL, 2041 NULL,
2053}; 2042};
2054
2055static struct attribute_group lcs_attr_group = { 2043static struct attribute_group lcs_attr_group = {
2056 .attrs = lcs_attrs, 2044 .attrs = lcs_attrs,
2057}; 2045};
2046static const struct attribute_group *lcs_attr_groups[] = {
2047 &lcs_attr_group,
2048 NULL,
2049};
2050static const struct device_type lcs_devtype = {
2051 .name = "lcs",
2052 .groups = lcs_attr_groups,
2053};
2058 2054
2059/** 2055/**
2060 * lcs_probe_device is called on establishing a new ccwgroup_device. 2056 * lcs_probe_device is called on establishing a new ccwgroup_device.
@@ -2063,7 +2059,6 @@ static int
2063lcs_probe_device(struct ccwgroup_device *ccwgdev) 2059lcs_probe_device(struct ccwgroup_device *ccwgdev)
2064{ 2060{
2065 struct lcs_card *card; 2061 struct lcs_card *card;
2066 int ret;
2067 2062
2068 if (!get_device(&ccwgdev->dev)) 2063 if (!get_device(&ccwgdev->dev))
2069 return -ENODEV; 2064 return -ENODEV;
@@ -2075,12 +2070,6 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev)
2075 put_device(&ccwgdev->dev); 2070 put_device(&ccwgdev->dev);
2076 return -ENOMEM; 2071 return -ENOMEM;
2077 } 2072 }
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); 2073 dev_set_drvdata(&ccwgdev->dev, card);
2085 ccwgdev->cdev[0]->handler = lcs_irq; 2074 ccwgdev->cdev[0]->handler = lcs_irq;
2086 ccwgdev->cdev[1]->handler = lcs_irq; 2075 ccwgdev->cdev[1]->handler = lcs_irq;
@@ -2089,7 +2078,9 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev)
2089 card->thread_start_mask = 0; 2078 card->thread_start_mask = 0;
2090 card->thread_allowed_mask = 0; 2079 card->thread_allowed_mask = 0;
2091 card->thread_running_mask = 0; 2080 card->thread_running_mask = 0;
2092 return 0; 2081 ccwgdev->dev.type = &lcs_devtype;
2082
2083 return 0;
2093} 2084}
2094 2085
2095static int 2086static int
@@ -2172,12 +2163,6 @@ lcs_new_device(struct ccwgroup_device *ccwgdev)
2172 dev = alloc_etherdev(0); 2163 dev = alloc_etherdev(0);
2173 break; 2164 break;
2174#endif 2165#endif
2175#ifdef CONFIG_TR
2176 case LCS_FRAME_TYPE_TR:
2177 card->lan_type_trans = tr_type_trans;
2178 dev = alloc_trdev(0);
2179 break;
2180#endif
2181#ifdef CONFIG_FDDI 2166#ifdef CONFIG_FDDI
2182 case LCS_FRAME_TYPE_FDDI: 2167 case LCS_FRAME_TYPE_FDDI:
2183 card->lan_type_trans = fddi_type_trans; 2168 card->lan_type_trans = fddi_type_trans;
@@ -2323,9 +2308,9 @@ lcs_remove_device(struct ccwgroup_device *ccwgdev)
2323 } 2308 }
2324 if (card->dev) 2309 if (card->dev)
2325 unregister_netdev(card->dev); 2310 unregister_netdev(card->dev);
2326 sysfs_remove_group(&ccwgdev->dev.kobj, &lcs_attr_group);
2327 lcs_cleanup_card(card); 2311 lcs_cleanup_card(card);
2328 lcs_free_card(card); 2312 lcs_free_card(card);
2313 dev_set_drvdata(&ccwgdev->dev, NULL);
2329 put_device(&ccwgdev->dev); 2314 put_device(&ccwgdev->dev);
2330} 2315}
2331 2316
@@ -2410,9 +2395,7 @@ static struct ccwgroup_driver lcs_group_driver = {
2410 .owner = THIS_MODULE, 2395 .owner = THIS_MODULE,
2411 .name = "lcs", 2396 .name = "lcs",
2412 }, 2397 },
2413 .max_slaves = 2, 2398 .setup = lcs_probe_device,
2414 .driver_id = 0xD3C3E2,
2415 .probe = lcs_probe_device,
2416 .remove = lcs_remove_device, 2399 .remove = lcs_remove_device,
2417 .set_online = lcs_new_device, 2400 .set_online = lcs_new_device,
2418 .set_offline = lcs_shutdown_device, 2401 .set_offline = lcs_shutdown_device,
@@ -2423,30 +2406,24 @@ static struct ccwgroup_driver lcs_group_driver = {
2423 .restore = lcs_restore, 2406 .restore = lcs_restore,
2424}; 2407};
2425 2408
2426static ssize_t 2409static ssize_t lcs_driver_group_store(struct device_driver *ddrv,
2427lcs_driver_group_store(struct device_driver *ddrv, const char *buf, 2410 const char *buf, size_t count)
2428 size_t count)
2429{ 2411{
2430 int err; 2412 int err;
2431 err = ccwgroup_create_from_string(lcs_root_dev, 2413 err = ccwgroup_create_dev(lcs_root_dev, &lcs_group_driver, 2, buf);
2432 lcs_group_driver.driver_id,
2433 &lcs_ccw_driver, 2, buf);
2434 return err ? err : count; 2414 return err ? err : count;
2435} 2415}
2436
2437static DRIVER_ATTR(group, 0200, NULL, lcs_driver_group_store); 2416static DRIVER_ATTR(group, 0200, NULL, lcs_driver_group_store);
2438 2417
2439static struct attribute *lcs_group_attrs[] = { 2418static struct attribute *lcs_drv_attrs[] = {
2440 &driver_attr_group.attr, 2419 &driver_attr_group.attr,
2441 NULL, 2420 NULL,
2442}; 2421};
2443 2422static struct attribute_group lcs_drv_attr_group = {
2444static struct attribute_group lcs_group_attr_group = { 2423 .attrs = lcs_drv_attrs,
2445 .attrs = lcs_group_attrs,
2446}; 2424};
2447 2425static const struct attribute_group *lcs_drv_attr_groups[] = {
2448static const struct attribute_group *lcs_group_attr_groups[] = { 2426 &lcs_drv_attr_group,
2449 &lcs_group_attr_group,
2450 NULL, 2427 NULL,
2451}; 2428};
2452 2429
@@ -2470,7 +2447,7 @@ __init lcs_init_module(void)
2470 rc = ccw_driver_register(&lcs_ccw_driver); 2447 rc = ccw_driver_register(&lcs_ccw_driver);
2471 if (rc) 2448 if (rc)
2472 goto ccw_err; 2449 goto ccw_err;
2473 lcs_group_driver.driver.groups = lcs_group_attr_groups; 2450 lcs_group_driver.driver.groups = lcs_drv_attr_groups;
2474 rc = ccwgroup_driver_register(&lcs_group_driver); 2451 rc = ccwgroup_driver_register(&lcs_group_driver);
2475 if (rc) 2452 if (rc)
2476 goto ccwgroup_err; 2453 goto ccwgroup_err;
@@ -2496,8 +2473,6 @@ __exit lcs_cleanup_module(void)
2496{ 2473{
2497 pr_info("Terminating lcs module.\n"); 2474 pr_info("Terminating lcs module.\n");
2498 LCS_DBF_TEXT(0, trace, "cleanup"); 2475 LCS_DBF_TEXT(0, trace, "cleanup");
2499 driver_remove_file(&lcs_group_driver.driver,
2500 &driver_attr_group);
2501 ccwgroup_driver_unregister(&lcs_group_driver); 2476 ccwgroup_driver_unregister(&lcs_group_driver);
2502 ccw_driver_unregister(&lcs_ccw_driver); 2477 ccw_driver_unregister(&lcs_ccw_driver);
2503 root_device_unregister(lcs_root_dev); 2478 root_device_unregister(lcs_root_dev);