diff options
Diffstat (limited to 'drivers/net/ehea')
-rw-r--r-- | drivers/net/ehea/ehea.h | 2 | ||||
-rw-r--r-- | drivers/net/ehea/ehea_main.c | 77 |
2 files changed, 62 insertions, 17 deletions
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 1405d0b0b7e7..136a6c19e259 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
40 | 40 | ||
41 | #define DRV_NAME "ehea" | 41 | #define DRV_NAME "ehea" |
42 | #define DRV_VERSION "EHEA_0055" | 42 | #define DRV_VERSION "EHEA_0057" |
43 | 43 | ||
44 | #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | 44 | #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ |
45 | | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) | 45 | | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index e6fe2cfbd999..368f8e3eb4a0 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -78,6 +78,28 @@ MODULE_PARM_DESC(sq_entries, " Number of entries for the Send Queue " | |||
78 | __MODULE_STRING(EHEA_DEF_ENTRIES_SQ) ")"); | 78 | __MODULE_STRING(EHEA_DEF_ENTRIES_SQ) ")"); |
79 | MODULE_PARM_DESC(use_mcs, " 0:NAPI, 1:Multiple receive queues, Default = 1 "); | 79 | MODULE_PARM_DESC(use_mcs, " 0:NAPI, 1:Multiple receive queues, Default = 1 "); |
80 | 80 | ||
81 | static int port_name_cnt = 0; | ||
82 | |||
83 | static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, | ||
84 | const struct of_device_id *id); | ||
85 | |||
86 | static int __devexit ehea_remove(struct ibmebus_dev *dev); | ||
87 | |||
88 | static struct of_device_id ehea_device_table[] = { | ||
89 | { | ||
90 | .name = "lhea", | ||
91 | .compatible = "IBM,lhea", | ||
92 | }, | ||
93 | {}, | ||
94 | }; | ||
95 | |||
96 | static struct ibmebus_driver ehea_driver = { | ||
97 | .name = "ehea", | ||
98 | .id_table = ehea_device_table, | ||
99 | .probe = ehea_probe_adapter, | ||
100 | .remove = ehea_remove, | ||
101 | }; | ||
102 | |||
81 | void ehea_dump(void *adr, int len, char *msg) { | 103 | void ehea_dump(void *adr, int len, char *msg) { |
82 | int x; | 104 | int x; |
83 | unsigned char *deb = adr; | 105 | unsigned char *deb = adr; |
@@ -2364,6 +2386,34 @@ static void __devinit logical_port_release(struct device *dev) | |||
2364 | of_node_put(port->ofdev.node); | 2386 | of_node_put(port->ofdev.node); |
2365 | } | 2387 | } |
2366 | 2388 | ||
2389 | static int ehea_driver_sysfs_add(struct device *dev, | ||
2390 | struct device_driver *driver) | ||
2391 | { | ||
2392 | int ret; | ||
2393 | |||
2394 | ret = sysfs_create_link(&driver->kobj, &dev->kobj, | ||
2395 | kobject_name(&dev->kobj)); | ||
2396 | if (ret == 0) { | ||
2397 | ret = sysfs_create_link(&dev->kobj, &driver->kobj, | ||
2398 | "driver"); | ||
2399 | if (ret) | ||
2400 | sysfs_remove_link(&driver->kobj, | ||
2401 | kobject_name(&dev->kobj)); | ||
2402 | } | ||
2403 | return ret; | ||
2404 | } | ||
2405 | |||
2406 | static void ehea_driver_sysfs_remove(struct device *dev, | ||
2407 | struct device_driver *driver) | ||
2408 | { | ||
2409 | struct device_driver *drv = driver; | ||
2410 | |||
2411 | if (drv) { | ||
2412 | sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj)); | ||
2413 | sysfs_remove_link(&dev->kobj, "driver"); | ||
2414 | } | ||
2415 | } | ||
2416 | |||
2367 | static struct device *ehea_register_port(struct ehea_port *port, | 2417 | static struct device *ehea_register_port(struct ehea_port *port, |
2368 | struct device_node *dn) | 2418 | struct device_node *dn) |
2369 | { | 2419 | { |
@@ -2371,8 +2421,9 @@ static struct device *ehea_register_port(struct ehea_port *port, | |||
2371 | 2421 | ||
2372 | port->ofdev.node = of_node_get(dn); | 2422 | port->ofdev.node = of_node_get(dn); |
2373 | port->ofdev.dev.parent = &port->adapter->ebus_dev->ofdev.dev; | 2423 | port->ofdev.dev.parent = &port->adapter->ebus_dev->ofdev.dev; |
2424 | port->ofdev.dev.bus = &ibmebus_bus_type; | ||
2374 | 2425 | ||
2375 | sprintf(port->ofdev.dev.bus_id, "port%d", port->logical_port_id); | 2426 | sprintf(port->ofdev.dev.bus_id, "port%d", port_name_cnt++); |
2376 | port->ofdev.dev.release = logical_port_release; | 2427 | port->ofdev.dev.release = logical_port_release; |
2377 | 2428 | ||
2378 | ret = of_device_register(&port->ofdev); | 2429 | ret = of_device_register(&port->ofdev); |
@@ -2387,8 +2438,16 @@ static struct device *ehea_register_port(struct ehea_port *port, | |||
2387 | goto out_unreg_of_dev; | 2438 | goto out_unreg_of_dev; |
2388 | } | 2439 | } |
2389 | 2440 | ||
2441 | ret = ehea_driver_sysfs_add(&port->ofdev.dev, &ehea_driver.driver); | ||
2442 | if (ret) { | ||
2443 | ehea_error("failed to register sysfs driver link"); | ||
2444 | goto out_rem_dev_file; | ||
2445 | } | ||
2446 | |||
2390 | return &port->ofdev.dev; | 2447 | return &port->ofdev.dev; |
2391 | 2448 | ||
2449 | out_rem_dev_file: | ||
2450 | device_remove_file(&port->ofdev.dev, &dev_attr_log_port_id); | ||
2392 | out_unreg_of_dev: | 2451 | out_unreg_of_dev: |
2393 | of_device_unregister(&port->ofdev); | 2452 | of_device_unregister(&port->ofdev); |
2394 | out: | 2453 | out: |
@@ -2397,6 +2456,7 @@ out: | |||
2397 | 2456 | ||
2398 | static void ehea_unregister_port(struct ehea_port *port) | 2457 | static void ehea_unregister_port(struct ehea_port *port) |
2399 | { | 2458 | { |
2459 | ehea_driver_sysfs_remove(&port->ofdev.dev, &ehea_driver.driver); | ||
2400 | device_remove_file(&port->ofdev.dev, &dev_attr_log_port_id); | 2460 | device_remove_file(&port->ofdev.dev, &dev_attr_log_port_id); |
2401 | of_device_unregister(&port->ofdev); | 2461 | of_device_unregister(&port->ofdev); |
2402 | } | 2462 | } |
@@ -2841,21 +2901,6 @@ static int check_module_parm(void) | |||
2841 | return ret; | 2901 | return ret; |
2842 | } | 2902 | } |
2843 | 2903 | ||
2844 | static struct of_device_id ehea_device_table[] = { | ||
2845 | { | ||
2846 | .name = "lhea", | ||
2847 | .compatible = "IBM,lhea", | ||
2848 | }, | ||
2849 | {}, | ||
2850 | }; | ||
2851 | |||
2852 | static struct ibmebus_driver ehea_driver = { | ||
2853 | .name = "ehea", | ||
2854 | .id_table = ehea_device_table, | ||
2855 | .probe = ehea_probe_adapter, | ||
2856 | .remove = ehea_remove, | ||
2857 | }; | ||
2858 | |||
2859 | int __init ehea_module_init(void) | 2904 | int __init ehea_module_init(void) |
2860 | { | 2905 | { |
2861 | int ret; | 2906 | int ret; |