aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ehea
diff options
context:
space:
mode:
authorJoachim Fenkes <fenkes@de.ibm.com>2007-09-26 05:45:51 -0400
committerPaul Mackerras <paulus@samba.org>2007-10-17 08:30:08 -0400
commit6b08f3ae8eec27a9e557468a48540bc64fd4a524 (patch)
tree0739be87e3262ddef0535949186670f4ae5eb850 /drivers/net/ehea
parent55347cc9962fbf2048a3cf78e92c3f52035ac524 (diff)
[POWERPC] ibmebus: Move to of_device and of_platform_driver, match eHCA and eHEA drivers
Replace struct ibmebus_dev and struct ibmebus_driver with struct of_device and struct of_platform_driver, respectively. Match the external ibmebus interface and drivers using it. Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Roland Dreier <rolandd@cisco.com> Acked-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/net/ehea')
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c72
2 files changed, 37 insertions, 37 deletions
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
389struct ehea_adapter { 389struct 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
99struct semaphore dlpar_mem_lock; 99struct semaphore dlpar_mem_lock;
100 100
101static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, 101static 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
104static int __devexit ehea_remove(struct ibmebus_dev *dev); 104static int __devexit ehea_remove(struct of_device *dev);
105 105
106static struct of_device_id ehea_device_table[] = { 106static 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
114static struct ibmebus_driver ehea_driver = { 114static 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:
1083out_free_req: 1083out_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
1089out_free_qpeq: 1089out_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,
3157static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port); 3157static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port);
3158static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port); 3158static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port);
3159 3159
3160int ehea_create_device_sysfs(struct ibmebus_dev *dev) 3160int 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);
3167out: 3167out:
3168 return ret; 3168 return ret;
3169} 3169}
3170 3170
3171void ehea_remove_device_sysfs(struct ibmebus_dev *dev) 3171void 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
3177static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, 3177static 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
3260out_free_irq: 3260out_free_irq:
3261 ibmebus_free_irq(NULL, adapter->neq->attr.ist1, adapter); 3261 ibmebus_free_irq(adapter->neq->attr.ist1, adapter);
3262 3262
3263out_kill_eq: 3263out_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
3272static int __devexit ehea_remove(struct ibmebus_dev *dev) 3272static 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);