diff options
-rw-r--r-- | arch/powerpc/kernel/ibmebus.c | 28 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_classes.h | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_eq.c | 6 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_main.c | 32 | ||||
-rw-r--r-- | drivers/net/ehea/ehea.h | 2 | ||||
-rw-r--r-- | drivers/net/ehea/ehea_main.c | 72 | ||||
-rw-r--r-- | include/asm-powerpc/ibmebus.h | 38 |
7 files changed, 79 insertions, 101 deletions
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c index d21658140b6e..289d7e935918 100644 --- a/arch/powerpc/kernel/ibmebus.c +++ b/arch/powerpc/kernel/ibmebus.c | |||
@@ -193,21 +193,26 @@ static int ibmebus_create_devices(const struct of_device_id *matches) | |||
193 | return ret; | 193 | return ret; |
194 | } | 194 | } |
195 | 195 | ||
196 | int ibmebus_register_driver(struct ibmebus_driver *drv) | 196 | int ibmebus_register_driver(struct of_platform_driver *drv) |
197 | { | 197 | { |
198 | return 0; | 198 | /* If the driver uses devices that ibmebus doesn't know, add them */ |
199 | ibmebus_create_devices(drv->match_table); | ||
200 | |||
201 | drv->driver.name = drv->name; | ||
202 | drv->driver.bus = &ibmebus_bus_type; | ||
203 | |||
204 | return driver_register(&drv->driver); | ||
199 | } | 205 | } |
200 | EXPORT_SYMBOL(ibmebus_register_driver); | 206 | EXPORT_SYMBOL(ibmebus_register_driver); |
201 | 207 | ||
202 | void ibmebus_unregister_driver(struct ibmebus_driver *drv) | 208 | void ibmebus_unregister_driver(struct of_platform_driver *drv) |
203 | { | 209 | { |
210 | driver_unregister(&drv->driver); | ||
204 | } | 211 | } |
205 | EXPORT_SYMBOL(ibmebus_unregister_driver); | 212 | EXPORT_SYMBOL(ibmebus_unregister_driver); |
206 | 213 | ||
207 | int ibmebus_request_irq(struct ibmebus_dev *dev, | 214 | int ibmebus_request_irq(u32 ist, irq_handler_t handler, |
208 | u32 ist, | 215 | unsigned long irq_flags, const char *devname, |
209 | irq_handler_t handler, | ||
210 | unsigned long irq_flags, const char * devname, | ||
211 | void *dev_id) | 216 | void *dev_id) |
212 | { | 217 | { |
213 | unsigned int irq = irq_create_mapping(NULL, ist); | 218 | unsigned int irq = irq_create_mapping(NULL, ist); |
@@ -215,12 +220,11 @@ int ibmebus_request_irq(struct ibmebus_dev *dev, | |||
215 | if (irq == NO_IRQ) | 220 | if (irq == NO_IRQ) |
216 | return -EINVAL; | 221 | return -EINVAL; |
217 | 222 | ||
218 | return request_irq(irq, handler, | 223 | return request_irq(irq, handler, irq_flags, devname, dev_id); |
219 | irq_flags, devname, dev_id); | ||
220 | } | 224 | } |
221 | EXPORT_SYMBOL(ibmebus_request_irq); | 225 | EXPORT_SYMBOL(ibmebus_request_irq); |
222 | 226 | ||
223 | void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id) | 227 | void ibmebus_free_irq(u32 ist, void *dev_id) |
224 | { | 228 | { |
225 | unsigned int irq = irq_find_mapping(NULL, ist); | 229 | unsigned int irq = irq_find_mapping(NULL, ist); |
226 | 230 | ||
@@ -231,9 +235,7 @@ EXPORT_SYMBOL(ibmebus_free_irq); | |||
231 | static ssize_t name_show(struct device *dev, | 235 | static ssize_t name_show(struct device *dev, |
232 | struct device_attribute *attr, char *buf) | 236 | struct device_attribute *attr, char *buf) |
233 | { | 237 | { |
234 | struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev); | 238 | return sprintf(buf, "%s\n", to_of_device(dev)->node->name); |
235 | const char *name = of_get_property(ebus_dev->ofdev.node, "name", NULL); | ||
236 | return sprintf(buf, "%s\n", name); | ||
237 | } | 239 | } |
238 | 240 | ||
239 | static struct device_attribute ibmebus_dev_attrs[] = { | 241 | static struct device_attribute ibmebus_dev_attrs[] = { |
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h index 0f7a55d35ea7..3f2d68cff764 100644 --- a/drivers/infiniband/hw/ehca/ehca_classes.h +++ b/drivers/infiniband/hw/ehca/ehca_classes.h | |||
@@ -107,7 +107,7 @@ struct ehca_sport { | |||
107 | 107 | ||
108 | struct ehca_shca { | 108 | struct ehca_shca { |
109 | struct ib_device ib_device; | 109 | struct ib_device ib_device; |
110 | struct ibmebus_dev *ibmebus_dev; | 110 | struct of_device *ofdev; |
111 | u8 num_ports; | 111 | u8 num_ports; |
112 | int hw_level; | 112 | int hw_level; |
113 | struct list_head shca_list; | 113 | struct list_head shca_list; |
diff --git a/drivers/infiniband/hw/ehca/ehca_eq.c b/drivers/infiniband/hw/ehca/ehca_eq.c index 1d41faa7a337..b4ac617a70e6 100644 --- a/drivers/infiniband/hw/ehca/ehca_eq.c +++ b/drivers/infiniband/hw/ehca/ehca_eq.c | |||
@@ -123,7 +123,7 @@ int ehca_create_eq(struct ehca_shca *shca, | |||
123 | 123 | ||
124 | /* register interrupt handlers and initialize work queues */ | 124 | /* register interrupt handlers and initialize work queues */ |
125 | if (type == EHCA_EQ) { | 125 | if (type == EHCA_EQ) { |
126 | ret = ibmebus_request_irq(NULL, eq->ist, ehca_interrupt_eq, | 126 | ret = ibmebus_request_irq(eq->ist, ehca_interrupt_eq, |
127 | IRQF_DISABLED, "ehca_eq", | 127 | IRQF_DISABLED, "ehca_eq", |
128 | (void *)shca); | 128 | (void *)shca); |
129 | if (ret < 0) | 129 | if (ret < 0) |
@@ -131,7 +131,7 @@ int ehca_create_eq(struct ehca_shca *shca, | |||
131 | 131 | ||
132 | tasklet_init(&eq->interrupt_task, ehca_tasklet_eq, (long)shca); | 132 | tasklet_init(&eq->interrupt_task, ehca_tasklet_eq, (long)shca); |
133 | } else if (type == EHCA_NEQ) { | 133 | } else if (type == EHCA_NEQ) { |
134 | ret = ibmebus_request_irq(NULL, eq->ist, ehca_interrupt_neq, | 134 | ret = ibmebus_request_irq(eq->ist, ehca_interrupt_neq, |
135 | IRQF_DISABLED, "ehca_neq", | 135 | IRQF_DISABLED, "ehca_neq", |
136 | (void *)shca); | 136 | (void *)shca); |
137 | if (ret < 0) | 137 | if (ret < 0) |
@@ -171,7 +171,7 @@ int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq) | |||
171 | u64 h_ret; | 171 | u64 h_ret; |
172 | 172 | ||
173 | spin_lock_irqsave(&eq->spinlock, flags); | 173 | spin_lock_irqsave(&eq->spinlock, flags); |
174 | ibmebus_free_irq(NULL, eq->ist, (void *)shca); | 174 | ibmebus_free_irq(eq->ist, (void *)shca); |
175 | 175 | ||
176 | h_ret = hipz_h_destroy_eq(shca->ipz_hca_handle, eq); | 176 | h_ret = hipz_h_destroy_eq(shca->ipz_hca_handle, eq); |
177 | 177 | ||
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c index 403467f66fe6..a3409fdb307c 100644 --- a/drivers/infiniband/hw/ehca/ehca_main.c +++ b/drivers/infiniband/hw/ehca/ehca_main.c | |||
@@ -404,7 +404,7 @@ int ehca_init_device(struct ehca_shca *shca) | |||
404 | shca->ib_device.node_type = RDMA_NODE_IB_CA; | 404 | shca->ib_device.node_type = RDMA_NODE_IB_CA; |
405 | shca->ib_device.phys_port_cnt = shca->num_ports; | 405 | shca->ib_device.phys_port_cnt = shca->num_ports; |
406 | shca->ib_device.num_comp_vectors = 1; | 406 | shca->ib_device.num_comp_vectors = 1; |
407 | shca->ib_device.dma_device = &shca->ibmebus_dev->ofdev.dev; | 407 | shca->ib_device.dma_device = &shca->ofdev->dev; |
408 | shca->ib_device.query_device = ehca_query_device; | 408 | shca->ib_device.query_device = ehca_query_device; |
409 | shca->ib_device.query_port = ehca_query_port; | 409 | shca->ib_device.query_port = ehca_query_port; |
410 | shca->ib_device.query_gid = ehca_query_gid; | 410 | shca->ib_device.query_gid = ehca_query_gid; |
@@ -658,7 +658,7 @@ static struct attribute_group ehca_dev_attr_grp = { | |||
658 | .attrs = ehca_dev_attrs | 658 | .attrs = ehca_dev_attrs |
659 | }; | 659 | }; |
660 | 660 | ||
661 | static int __devinit ehca_probe(struct ibmebus_dev *dev, | 661 | static int __devinit ehca_probe(struct of_device *dev, |
662 | const struct of_device_id *id) | 662 | const struct of_device_id *id) |
663 | { | 663 | { |
664 | struct ehca_shca *shca; | 664 | struct ehca_shca *shca; |
@@ -666,16 +666,16 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev, | |||
666 | struct ib_pd *ibpd; | 666 | struct ib_pd *ibpd; |
667 | int ret; | 667 | int ret; |
668 | 668 | ||
669 | handle = of_get_property(dev->ofdev.node, "ibm,hca-handle", NULL); | 669 | handle = of_get_property(dev->node, "ibm,hca-handle", NULL); |
670 | if (!handle) { | 670 | if (!handle) { |
671 | ehca_gen_err("Cannot get eHCA handle for adapter: %s.", | 671 | ehca_gen_err("Cannot get eHCA handle for adapter: %s.", |
672 | dev->ofdev.node->full_name); | 672 | dev->node->full_name); |
673 | return -ENODEV; | 673 | return -ENODEV; |
674 | } | 674 | } |
675 | 675 | ||
676 | if (!(*handle)) { | 676 | if (!(*handle)) { |
677 | ehca_gen_err("Wrong eHCA handle for adapter: %s.", | 677 | ehca_gen_err("Wrong eHCA handle for adapter: %s.", |
678 | dev->ofdev.node->full_name); | 678 | dev->node->full_name); |
679 | return -ENODEV; | 679 | return -ENODEV; |
680 | } | 680 | } |
681 | 681 | ||
@@ -686,9 +686,9 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev, | |||
686 | } | 686 | } |
687 | mutex_init(&shca->modify_mutex); | 687 | mutex_init(&shca->modify_mutex); |
688 | 688 | ||
689 | shca->ibmebus_dev = dev; | 689 | shca->ofdev = dev; |
690 | shca->ipz_hca_handle.handle = *handle; | 690 | shca->ipz_hca_handle.handle = *handle; |
691 | dev->ofdev.dev.driver_data = shca; | 691 | dev->dev.driver_data = shca; |
692 | 692 | ||
693 | ret = ehca_sense_attributes(shca); | 693 | ret = ehca_sense_attributes(shca); |
694 | if (ret < 0) { | 694 | if (ret < 0) { |
@@ -764,7 +764,7 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev, | |||
764 | } | 764 | } |
765 | } | 765 | } |
766 | 766 | ||
767 | ret = sysfs_create_group(&dev->ofdev.dev.kobj, &ehca_dev_attr_grp); | 767 | ret = sysfs_create_group(&dev->dev.kobj, &ehca_dev_attr_grp); |
768 | if (ret) /* only complain; we can live without attributes */ | 768 | if (ret) /* only complain; we can live without attributes */ |
769 | ehca_err(&shca->ib_device, | 769 | ehca_err(&shca->ib_device, |
770 | "Cannot create device attributes ret=%d", ret); | 770 | "Cannot create device attributes ret=%d", ret); |
@@ -814,12 +814,12 @@ probe1: | |||
814 | return -EINVAL; | 814 | return -EINVAL; |
815 | } | 815 | } |
816 | 816 | ||
817 | static int __devexit ehca_remove(struct ibmebus_dev *dev) | 817 | static int __devexit ehca_remove(struct of_device *dev) |
818 | { | 818 | { |
819 | struct ehca_shca *shca = dev->ofdev.dev.driver_data; | 819 | struct ehca_shca *shca = dev->dev.driver_data; |
820 | int ret; | 820 | int ret; |
821 | 821 | ||
822 | sysfs_remove_group(&dev->ofdev.dev.kobj, &ehca_dev_attr_grp); | 822 | sysfs_remove_group(&dev->dev.kobj, &ehca_dev_attr_grp); |
823 | 823 | ||
824 | if (ehca_open_aqp1 == 1) { | 824 | if (ehca_open_aqp1 == 1) { |
825 | int i; | 825 | int i; |
@@ -870,11 +870,11 @@ static struct of_device_id ehca_device_table[] = | |||
870 | {}, | 870 | {}, |
871 | }; | 871 | }; |
872 | 872 | ||
873 | static struct ibmebus_driver ehca_driver = { | 873 | static struct of_platform_driver ehca_driver = { |
874 | .name = "ehca", | 874 | .name = "ehca", |
875 | .id_table = ehca_device_table, | 875 | .match_table = ehca_device_table, |
876 | .probe = ehca_probe, | 876 | .probe = ehca_probe, |
877 | .remove = ehca_remove, | 877 | .remove = ehca_remove, |
878 | }; | 878 | }; |
879 | 879 | ||
880 | void ehca_poll_eqs(unsigned long data) | 880 | void ehca_poll_eqs(unsigned long data) |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index ac21526b6de8..b557bb44a36f 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -388,7 +388,7 @@ struct ehea_port_res { | |||
388 | #define EHEA_MAX_PORTS 16 | 388 | #define EHEA_MAX_PORTS 16 |
389 | struct ehea_adapter { | 389 | struct ehea_adapter { |
390 | u64 handle; | 390 | u64 handle; |
391 | struct ibmebus_dev *ebus_dev; | 391 | struct of_device *ofdev; |
392 | struct ehea_port *port[EHEA_MAX_PORTS]; | 392 | struct ehea_port *port[EHEA_MAX_PORTS]; |
393 | struct ehea_eq *neq; /* notification event queue */ | 393 | struct ehea_eq *neq; /* notification event queue */ |
394 | struct tasklet_struct neq_tasklet; | 394 | struct tasklet_struct neq_tasklet; |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 2ba57e6ace4d..fe5ffac7ac57 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -98,10 +98,10 @@ struct work_struct ehea_rereg_mr_task; | |||
98 | 98 | ||
99 | struct semaphore dlpar_mem_lock; | 99 | struct semaphore dlpar_mem_lock; |
100 | 100 | ||
101 | static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, | 101 | static int __devinit ehea_probe_adapter(struct of_device *dev, |
102 | const struct of_device_id *id); | 102 | const struct of_device_id *id); |
103 | 103 | ||
104 | static int __devexit ehea_remove(struct ibmebus_dev *dev); | 104 | static int __devexit ehea_remove(struct of_device *dev); |
105 | 105 | ||
106 | static struct of_device_id ehea_device_table[] = { | 106 | static struct of_device_id ehea_device_table[] = { |
107 | { | 107 | { |
@@ -111,9 +111,9 @@ static struct of_device_id ehea_device_table[] = { | |||
111 | {}, | 111 | {}, |
112 | }; | 112 | }; |
113 | 113 | ||
114 | static struct ibmebus_driver ehea_driver = { | 114 | static struct of_platform_driver ehea_driver = { |
115 | .name = "ehea", | 115 | .name = "ehea", |
116 | .id_table = ehea_device_table, | 116 | .match_table = ehea_device_table, |
117 | .probe = ehea_probe_adapter, | 117 | .probe = ehea_probe_adapter, |
118 | .remove = ehea_remove, | 118 | .remove = ehea_remove, |
119 | }; | 119 | }; |
@@ -1044,7 +1044,7 @@ static int ehea_reg_interrupts(struct net_device *dev) | |||
1044 | snprintf(port->int_aff_name, EHEA_IRQ_NAME_SIZE - 1, "%s-aff", | 1044 | snprintf(port->int_aff_name, EHEA_IRQ_NAME_SIZE - 1, "%s-aff", |
1045 | dev->name); | 1045 | dev->name); |
1046 | 1046 | ||
1047 | ret = ibmebus_request_irq(NULL, port->qp_eq->attr.ist1, | 1047 | ret = ibmebus_request_irq(port->qp_eq->attr.ist1, |
1048 | ehea_qp_aff_irq_handler, | 1048 | ehea_qp_aff_irq_handler, |
1049 | IRQF_DISABLED, port->int_aff_name, port); | 1049 | IRQF_DISABLED, port->int_aff_name, port); |
1050 | if (ret) { | 1050 | if (ret) { |
@@ -1062,7 +1062,7 @@ static int ehea_reg_interrupts(struct net_device *dev) | |||
1062 | pr = &port->port_res[i]; | 1062 | pr = &port->port_res[i]; |
1063 | snprintf(pr->int_send_name, EHEA_IRQ_NAME_SIZE - 1, | 1063 | snprintf(pr->int_send_name, EHEA_IRQ_NAME_SIZE - 1, |
1064 | "%s-queue%d", dev->name, i); | 1064 | "%s-queue%d", dev->name, i); |
1065 | ret = ibmebus_request_irq(NULL, pr->eq->attr.ist1, | 1065 | ret = ibmebus_request_irq(pr->eq->attr.ist1, |
1066 | ehea_recv_irq_handler, | 1066 | ehea_recv_irq_handler, |
1067 | IRQF_DISABLED, pr->int_send_name, | 1067 | IRQF_DISABLED, pr->int_send_name, |
1068 | pr); | 1068 | pr); |
@@ -1083,11 +1083,11 @@ out: | |||
1083 | out_free_req: | 1083 | out_free_req: |
1084 | while (--i >= 0) { | 1084 | while (--i >= 0) { |
1085 | u32 ist = port->port_res[i].eq->attr.ist1; | 1085 | u32 ist = port->port_res[i].eq->attr.ist1; |
1086 | ibmebus_free_irq(NULL, ist, &port->port_res[i]); | 1086 | ibmebus_free_irq(ist, &port->port_res[i]); |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | out_free_qpeq: | 1089 | out_free_qpeq: |
1090 | ibmebus_free_irq(NULL, port->qp_eq->attr.ist1, port); | 1090 | ibmebus_free_irq(port->qp_eq->attr.ist1, port); |
1091 | i = port->num_def_qps; | 1091 | i = port->num_def_qps; |
1092 | 1092 | ||
1093 | goto out; | 1093 | goto out; |
@@ -1104,14 +1104,14 @@ static void ehea_free_interrupts(struct net_device *dev) | |||
1104 | 1104 | ||
1105 | for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { | 1105 | for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { |
1106 | pr = &port->port_res[i]; | 1106 | pr = &port->port_res[i]; |
1107 | ibmebus_free_irq(NULL, pr->eq->attr.ist1, pr); | 1107 | ibmebus_free_irq(pr->eq->attr.ist1, pr); |
1108 | if (netif_msg_intr(port)) | 1108 | if (netif_msg_intr(port)) |
1109 | ehea_info("free send irq for res %d with handle 0x%X", | 1109 | ehea_info("free send irq for res %d with handle 0x%X", |
1110 | i, pr->eq->attr.ist1); | 1110 | i, pr->eq->attr.ist1); |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | /* associated events */ | 1113 | /* associated events */ |
1114 | ibmebus_free_irq(NULL, port->qp_eq->attr.ist1, port); | 1114 | ibmebus_free_irq(port->qp_eq->attr.ist1, port); |
1115 | if (netif_msg_intr(port)) | 1115 | if (netif_msg_intr(port)) |
1116 | ehea_info("associated event interrupt for handle 0x%X freed", | 1116 | ehea_info("associated event interrupt for handle 0x%X freed", |
1117 | port->qp_eq->attr.ist1); | 1117 | port->qp_eq->attr.ist1); |
@@ -2832,7 +2832,7 @@ static struct device *ehea_register_port(struct ehea_port *port, | |||
2832 | int ret; | 2832 | int ret; |
2833 | 2833 | ||
2834 | port->ofdev.node = of_node_get(dn); | 2834 | port->ofdev.node = of_node_get(dn); |
2835 | port->ofdev.dev.parent = &port->adapter->ebus_dev->ofdev.dev; | 2835 | port->ofdev.dev.parent = &port->adapter->ofdev->dev; |
2836 | port->ofdev.dev.bus = &ibmebus_bus_type; | 2836 | port->ofdev.dev.bus = &ibmebus_bus_type; |
2837 | 2837 | ||
2838 | sprintf(port->ofdev.dev.bus_id, "port%d", port_name_cnt++); | 2838 | sprintf(port->ofdev.dev.bus_id, "port%d", port_name_cnt++); |
@@ -3011,7 +3011,7 @@ static int ehea_setup_ports(struct ehea_adapter *adapter) | |||
3011 | const u32 *dn_log_port_id; | 3011 | const u32 *dn_log_port_id; |
3012 | int i = 0; | 3012 | int i = 0; |
3013 | 3013 | ||
3014 | lhea_dn = adapter->ebus_dev->ofdev.node; | 3014 | lhea_dn = adapter->ofdev->node; |
3015 | while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { | 3015 | while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { |
3016 | 3016 | ||
3017 | dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no", | 3017 | dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no", |
@@ -3051,7 +3051,7 @@ static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter, | |||
3051 | struct device_node *eth_dn = NULL; | 3051 | struct device_node *eth_dn = NULL; |
3052 | const u32 *dn_log_port_id; | 3052 | const u32 *dn_log_port_id; |
3053 | 3053 | ||
3054 | lhea_dn = adapter->ebus_dev->ofdev.node; | 3054 | lhea_dn = adapter->ofdev->node; |
3055 | while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { | 3055 | while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { |
3056 | 3056 | ||
3057 | dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no", | 3057 | dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no", |
@@ -3157,31 +3157,31 @@ static ssize_t ehea_remove_port(struct device *dev, | |||
3157 | static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port); | 3157 | static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port); |
3158 | static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port); | 3158 | static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port); |
3159 | 3159 | ||
3160 | int ehea_create_device_sysfs(struct ibmebus_dev *dev) | 3160 | int ehea_create_device_sysfs(struct of_device *dev) |
3161 | { | 3161 | { |
3162 | int ret = device_create_file(&dev->ofdev.dev, &dev_attr_probe_port); | 3162 | int ret = device_create_file(&dev->dev, &dev_attr_probe_port); |
3163 | if (ret) | 3163 | if (ret) |
3164 | goto out; | 3164 | goto out; |
3165 | 3165 | ||
3166 | ret = device_create_file(&dev->ofdev.dev, &dev_attr_remove_port); | 3166 | ret = device_create_file(&dev->dev, &dev_attr_remove_port); |
3167 | out: | 3167 | out: |
3168 | return ret; | 3168 | return ret; |
3169 | } | 3169 | } |
3170 | 3170 | ||
3171 | void ehea_remove_device_sysfs(struct ibmebus_dev *dev) | 3171 | void ehea_remove_device_sysfs(struct of_device *dev) |
3172 | { | 3172 | { |
3173 | device_remove_file(&dev->ofdev.dev, &dev_attr_probe_port); | 3173 | device_remove_file(&dev->dev, &dev_attr_probe_port); |
3174 | device_remove_file(&dev->ofdev.dev, &dev_attr_remove_port); | 3174 | device_remove_file(&dev->dev, &dev_attr_remove_port); |
3175 | } | 3175 | } |
3176 | 3176 | ||
3177 | static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, | 3177 | static int __devinit ehea_probe_adapter(struct of_device *dev, |
3178 | const struct of_device_id *id) | 3178 | const struct of_device_id *id) |
3179 | { | 3179 | { |
3180 | struct ehea_adapter *adapter; | 3180 | struct ehea_adapter *adapter; |
3181 | const u64 *adapter_handle; | 3181 | const u64 *adapter_handle; |
3182 | int ret; | 3182 | int ret; |
3183 | 3183 | ||
3184 | if (!dev || !dev->ofdev.node) { | 3184 | if (!dev || !dev->node) { |
3185 | ehea_error("Invalid ibmebus device probed"); | 3185 | ehea_error("Invalid ibmebus device probed"); |
3186 | return -EINVAL; | 3186 | return -EINVAL; |
3187 | } | 3187 | } |
@@ -3189,36 +3189,36 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, | |||
3189 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); | 3189 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); |
3190 | if (!adapter) { | 3190 | if (!adapter) { |
3191 | ret = -ENOMEM; | 3191 | ret = -ENOMEM; |
3192 | dev_err(&dev->ofdev.dev, "no mem for ehea_adapter\n"); | 3192 | dev_err(&dev->dev, "no mem for ehea_adapter\n"); |
3193 | goto out; | 3193 | goto out; |
3194 | } | 3194 | } |
3195 | 3195 | ||
3196 | list_add(&adapter->list, &adapter_list); | 3196 | list_add(&adapter->list, &adapter_list); |
3197 | 3197 | ||
3198 | adapter->ebus_dev = dev; | 3198 | adapter->ofdev = dev; |
3199 | 3199 | ||
3200 | adapter_handle = of_get_property(dev->ofdev.node, "ibm,hea-handle", | 3200 | adapter_handle = of_get_property(dev->node, "ibm,hea-handle", |
3201 | NULL); | 3201 | NULL); |
3202 | if (adapter_handle) | 3202 | if (adapter_handle) |
3203 | adapter->handle = *adapter_handle; | 3203 | adapter->handle = *adapter_handle; |
3204 | 3204 | ||
3205 | if (!adapter->handle) { | 3205 | if (!adapter->handle) { |
3206 | dev_err(&dev->ofdev.dev, "failed getting handle for adapter" | 3206 | dev_err(&dev->dev, "failed getting handle for adapter" |
3207 | " '%s'\n", dev->ofdev.node->full_name); | 3207 | " '%s'\n", dev->node->full_name); |
3208 | ret = -ENODEV; | 3208 | ret = -ENODEV; |
3209 | goto out_free_ad; | 3209 | goto out_free_ad; |
3210 | } | 3210 | } |
3211 | 3211 | ||
3212 | adapter->pd = EHEA_PD_ID; | 3212 | adapter->pd = EHEA_PD_ID; |
3213 | 3213 | ||
3214 | dev->ofdev.dev.driver_data = adapter; | 3214 | dev->dev.driver_data = adapter; |
3215 | 3215 | ||
3216 | 3216 | ||
3217 | /* initialize adapter and ports */ | 3217 | /* initialize adapter and ports */ |
3218 | /* get adapter properties */ | 3218 | /* get adapter properties */ |
3219 | ret = ehea_sense_adapter_attr(adapter); | 3219 | ret = ehea_sense_adapter_attr(adapter); |
3220 | if (ret) { | 3220 | if (ret) { |
3221 | dev_err(&dev->ofdev.dev, "sense_adapter_attr failed: %d", ret); | 3221 | dev_err(&dev->dev, "sense_adapter_attr failed: %d", ret); |
3222 | goto out_free_ad; | 3222 | goto out_free_ad; |
3223 | } | 3223 | } |
3224 | 3224 | ||
@@ -3226,18 +3226,18 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, | |||
3226 | EHEA_NEQ, EHEA_MAX_ENTRIES_EQ, 1); | 3226 | EHEA_NEQ, EHEA_MAX_ENTRIES_EQ, 1); |
3227 | if (!adapter->neq) { | 3227 | if (!adapter->neq) { |
3228 | ret = -EIO; | 3228 | ret = -EIO; |
3229 | dev_err(&dev->ofdev.dev, "NEQ creation failed"); | 3229 | dev_err(&dev->dev, "NEQ creation failed"); |
3230 | goto out_free_ad; | 3230 | goto out_free_ad; |
3231 | } | 3231 | } |
3232 | 3232 | ||
3233 | tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet, | 3233 | tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet, |
3234 | (unsigned long)adapter); | 3234 | (unsigned long)adapter); |
3235 | 3235 | ||
3236 | ret = ibmebus_request_irq(NULL, adapter->neq->attr.ist1, | 3236 | ret = ibmebus_request_irq(adapter->neq->attr.ist1, |
3237 | ehea_interrupt_neq, IRQF_DISABLED, | 3237 | ehea_interrupt_neq, IRQF_DISABLED, |
3238 | "ehea_neq", adapter); | 3238 | "ehea_neq", adapter); |
3239 | if (ret) { | 3239 | if (ret) { |
3240 | dev_err(&dev->ofdev.dev, "requesting NEQ IRQ failed"); | 3240 | dev_err(&dev->dev, "requesting NEQ IRQ failed"); |
3241 | goto out_kill_eq; | 3241 | goto out_kill_eq; |
3242 | } | 3242 | } |
3243 | 3243 | ||
@@ -3247,7 +3247,7 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, | |||
3247 | 3247 | ||
3248 | ret = ehea_setup_ports(adapter); | 3248 | ret = ehea_setup_ports(adapter); |
3249 | if (ret) { | 3249 | if (ret) { |
3250 | dev_err(&dev->ofdev.dev, "setup_ports failed"); | 3250 | dev_err(&dev->dev, "setup_ports failed"); |
3251 | goto out_rem_dev_sysfs; | 3251 | goto out_rem_dev_sysfs; |
3252 | } | 3252 | } |
3253 | 3253 | ||
@@ -3258,7 +3258,7 @@ out_rem_dev_sysfs: | |||
3258 | ehea_remove_device_sysfs(dev); | 3258 | ehea_remove_device_sysfs(dev); |
3259 | 3259 | ||
3260 | out_free_irq: | 3260 | out_free_irq: |
3261 | ibmebus_free_irq(NULL, adapter->neq->attr.ist1, adapter); | 3261 | ibmebus_free_irq(adapter->neq->attr.ist1, adapter); |
3262 | 3262 | ||
3263 | out_kill_eq: | 3263 | out_kill_eq: |
3264 | ehea_destroy_eq(adapter->neq); | 3264 | ehea_destroy_eq(adapter->neq); |
@@ -3269,9 +3269,9 @@ out: | |||
3269 | return ret; | 3269 | return ret; |
3270 | } | 3270 | } |
3271 | 3271 | ||
3272 | static int __devexit ehea_remove(struct ibmebus_dev *dev) | 3272 | static int __devexit ehea_remove(struct of_device *dev) |
3273 | { | 3273 | { |
3274 | struct ehea_adapter *adapter = dev->ofdev.dev.driver_data; | 3274 | struct ehea_adapter *adapter = dev->dev.driver_data; |
3275 | int i; | 3275 | int i; |
3276 | 3276 | ||
3277 | for (i = 0; i < EHEA_MAX_PORTS; i++) | 3277 | for (i = 0; i < EHEA_MAX_PORTS; i++) |
@@ -3284,7 +3284,7 @@ static int __devexit ehea_remove(struct ibmebus_dev *dev) | |||
3284 | 3284 | ||
3285 | flush_scheduled_work(); | 3285 | flush_scheduled_work(); |
3286 | 3286 | ||
3287 | ibmebus_free_irq(NULL, adapter->neq->attr.ist1, adapter); | 3287 | ibmebus_free_irq(adapter->neq->attr.ist1, adapter); |
3288 | tasklet_kill(&adapter->neq_tasklet); | 3288 | tasklet_kill(&adapter->neq_tasklet); |
3289 | 3289 | ||
3290 | ehea_destroy_eq(adapter->neq); | 3290 | ehea_destroy_eq(adapter->neq); |
diff --git a/include/asm-powerpc/ibmebus.h b/include/asm-powerpc/ibmebus.h index 87d396e28db2..1a9d9aea21fa 100644 --- a/include/asm-powerpc/ibmebus.h +++ b/include/asm-powerpc/ibmebus.h | |||
@@ -43,42 +43,18 @@ | |||
43 | #include <linux/device.h> | 43 | #include <linux/device.h> |
44 | #include <linux/interrupt.h> | 44 | #include <linux/interrupt.h> |
45 | #include <linux/mod_devicetable.h> | 45 | #include <linux/mod_devicetable.h> |
46 | #include <asm/of_device.h> | 46 | #include <linux/of_device.h> |
47 | #include <linux/of_platform.h> | ||
47 | 48 | ||
48 | extern struct bus_type ibmebus_bus_type; | 49 | extern struct bus_type ibmebus_bus_type; |
49 | 50 | ||
50 | struct ibmebus_dev { | 51 | int ibmebus_register_driver(struct of_platform_driver *drv); |
51 | struct of_device ofdev; | 52 | void ibmebus_unregister_driver(struct of_platform_driver *drv); |
52 | }; | ||
53 | 53 | ||
54 | struct ibmebus_driver { | 54 | int ibmebus_request_irq(u32 ist, irq_handler_t handler, |
55 | char *name; | 55 | unsigned long irq_flags, const char *devname, |
56 | struct of_device_id *id_table; | ||
57 | int (*probe) (struct ibmebus_dev *dev, const struct of_device_id *id); | ||
58 | int (*remove) (struct ibmebus_dev *dev); | ||
59 | struct device_driver driver; | ||
60 | }; | ||
61 | |||
62 | int ibmebus_register_driver(struct ibmebus_driver *drv); | ||
63 | void ibmebus_unregister_driver(struct ibmebus_driver *drv); | ||
64 | |||
65 | int ibmebus_request_irq(struct ibmebus_dev *dev, | ||
66 | u32 ist, | ||
67 | irq_handler_t handler, | ||
68 | unsigned long irq_flags, const char * devname, | ||
69 | void *dev_id); | 56 | void *dev_id); |
70 | void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id); | 57 | void ibmebus_free_irq(u32 ist, void *dev_id); |
71 | |||
72 | static inline struct ibmebus_driver *to_ibmebus_driver(struct device_driver *drv) | ||
73 | { | ||
74 | return container_of(drv, struct ibmebus_driver, driver); | ||
75 | } | ||
76 | |||
77 | static inline struct ibmebus_dev *to_ibmebus_dev(struct device *dev) | ||
78 | { | ||
79 | return container_of(dev, struct ibmebus_dev, ofdev.dev); | ||
80 | } | ||
81 | |||
82 | 58 | ||
83 | #endif /* __KERNEL__ */ | 59 | #endif /* __KERNEL__ */ |
84 | #endif /* _ASM_IBMEBUS_H */ | 60 | #endif /* _ASM_IBMEBUS_H */ |