Commit 6b08f3ae authored by Joachim Fenkes's avatar Joachim Fenkes Committed by Paul Mackerras

[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: default avatarJoachim Fenkes <fenkes@de.ibm.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarRoland Dreier <rolandd@cisco.com>
Acked-by: default avatarJeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 55347cc9
...@@ -193,21 +193,26 @@ static int ibmebus_create_devices(const struct of_device_id *matches) ...@@ -193,21 +193,26 @@ static int ibmebus_create_devices(const struct of_device_id *matches)
return ret; return ret;
} }
int ibmebus_register_driver(struct ibmebus_driver *drv) int ibmebus_register_driver(struct of_platform_driver *drv)
{ {
return 0; /* If the driver uses devices that ibmebus doesn't know, add them */
ibmebus_create_devices(drv->match_table);
drv->driver.name = drv->name;
drv->driver.bus = &ibmebus_bus_type;
return driver_register(&drv->driver);
} }
EXPORT_SYMBOL(ibmebus_register_driver); EXPORT_SYMBOL(ibmebus_register_driver);
void ibmebus_unregister_driver(struct ibmebus_driver *drv) void ibmebus_unregister_driver(struct of_platform_driver *drv)
{ {
driver_unregister(&drv->driver);
} }
EXPORT_SYMBOL(ibmebus_unregister_driver); EXPORT_SYMBOL(ibmebus_unregister_driver);
int ibmebus_request_irq(struct ibmebus_dev *dev, int ibmebus_request_irq(u32 ist, irq_handler_t handler,
u32 ist, unsigned long irq_flags, const char *devname,
irq_handler_t handler,
unsigned long irq_flags, const char * devname,
void *dev_id) void *dev_id)
{ {
unsigned int irq = irq_create_mapping(NULL, ist); unsigned int irq = irq_create_mapping(NULL, ist);
...@@ -215,12 +220,11 @@ int ibmebus_request_irq(struct ibmebus_dev *dev, ...@@ -215,12 +220,11 @@ int ibmebus_request_irq(struct ibmebus_dev *dev,
if (irq == NO_IRQ) if (irq == NO_IRQ)
return -EINVAL; return -EINVAL;
return request_irq(irq, handler, return request_irq(irq, handler, irq_flags, devname, dev_id);
irq_flags, devname, dev_id);
} }
EXPORT_SYMBOL(ibmebus_request_irq); EXPORT_SYMBOL(ibmebus_request_irq);
void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id) void ibmebus_free_irq(u32 ist, void *dev_id)
{ {
unsigned int irq = irq_find_mapping(NULL, ist); unsigned int irq = irq_find_mapping(NULL, ist);
...@@ -231,9 +235,7 @@ EXPORT_SYMBOL(ibmebus_free_irq); ...@@ -231,9 +235,7 @@ EXPORT_SYMBOL(ibmebus_free_irq);
static ssize_t name_show(struct device *dev, static ssize_t name_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev); return sprintf(buf, "%s\n", to_of_device(dev)->node->name);
const char *name = of_get_property(ebus_dev->ofdev.node, "name", NULL);
return sprintf(buf, "%s\n", name);
} }
static struct device_attribute ibmebus_dev_attrs[] = { static struct device_attribute ibmebus_dev_attrs[] = {
......
...@@ -107,7 +107,7 @@ struct ehca_sport { ...@@ -107,7 +107,7 @@ struct ehca_sport {
struct ehca_shca { struct ehca_shca {
struct ib_device ib_device; struct ib_device ib_device;
struct ibmebus_dev *ibmebus_dev; struct of_device *ofdev;
u8 num_ports; u8 num_ports;
int hw_level; int hw_level;
struct list_head shca_list; struct list_head shca_list;
......
...@@ -123,7 +123,7 @@ int ehca_create_eq(struct ehca_shca *shca, ...@@ -123,7 +123,7 @@ int ehca_create_eq(struct ehca_shca *shca,
/* register interrupt handlers and initialize work queues */ /* register interrupt handlers and initialize work queues */
if (type == EHCA_EQ) { if (type == EHCA_EQ) {
ret = ibmebus_request_irq(NULL, eq->ist, ehca_interrupt_eq, ret = ibmebus_request_irq(eq->ist, ehca_interrupt_eq,
IRQF_DISABLED, "ehca_eq", IRQF_DISABLED, "ehca_eq",
(void *)shca); (void *)shca);
if (ret < 0) if (ret < 0)
...@@ -131,7 +131,7 @@ int ehca_create_eq(struct ehca_shca *shca, ...@@ -131,7 +131,7 @@ int ehca_create_eq(struct ehca_shca *shca,
tasklet_init(&eq->interrupt_task, ehca_tasklet_eq, (long)shca); tasklet_init(&eq->interrupt_task, ehca_tasklet_eq, (long)shca);
} else if (type == EHCA_NEQ) { } else if (type == EHCA_NEQ) {
ret = ibmebus_request_irq(NULL, eq->ist, ehca_interrupt_neq, ret = ibmebus_request_irq(eq->ist, ehca_interrupt_neq,
IRQF_DISABLED, "ehca_neq", IRQF_DISABLED, "ehca_neq",
(void *)shca); (void *)shca);
if (ret < 0) if (ret < 0)
...@@ -171,7 +171,7 @@ int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq) ...@@ -171,7 +171,7 @@ int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq)
u64 h_ret; u64 h_ret;
spin_lock_irqsave(&eq->spinlock, flags); spin_lock_irqsave(&eq->spinlock, flags);
ibmebus_free_irq(NULL, eq->ist, (void *)shca); ibmebus_free_irq(eq->ist, (void *)shca);
h_ret = hipz_h_destroy_eq(shca->ipz_hca_handle, eq); h_ret = hipz_h_destroy_eq(shca->ipz_hca_handle, eq);
......
...@@ -404,7 +404,7 @@ int ehca_init_device(struct ehca_shca *shca) ...@@ -404,7 +404,7 @@ int ehca_init_device(struct ehca_shca *shca)
shca->ib_device.node_type = RDMA_NODE_IB_CA; shca->ib_device.node_type = RDMA_NODE_IB_CA;
shca->ib_device.phys_port_cnt = shca->num_ports; shca->ib_device.phys_port_cnt = shca->num_ports;
shca->ib_device.num_comp_vectors = 1; shca->ib_device.num_comp_vectors = 1;
shca->ib_device.dma_device = &shca->ibmebus_dev->ofdev.dev; shca->ib_device.dma_device = &shca->ofdev->dev;
shca->ib_device.query_device = ehca_query_device; shca->ib_device.query_device = ehca_query_device;
shca->ib_device.query_port = ehca_query_port; shca->ib_device.query_port = ehca_query_port;
shca->ib_device.query_gid = ehca_query_gid; shca->ib_device.query_gid = ehca_query_gid;
...@@ -658,7 +658,7 @@ static struct attribute_group ehca_dev_attr_grp = { ...@@ -658,7 +658,7 @@ static struct attribute_group ehca_dev_attr_grp = {
.attrs = ehca_dev_attrs .attrs = ehca_dev_attrs
}; };
static int __devinit ehca_probe(struct ibmebus_dev *dev, static int __devinit ehca_probe(struct of_device *dev,
const struct of_device_id *id) const struct of_device_id *id)
{ {
struct ehca_shca *shca; struct ehca_shca *shca;
...@@ -666,16 +666,16 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev, ...@@ -666,16 +666,16 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev,
struct ib_pd *ibpd; struct ib_pd *ibpd;
int ret; int ret;
handle = of_get_property(dev->ofdev.node, "ibm,hca-handle", NULL); handle = of_get_property(dev->node, "ibm,hca-handle", NULL);
if (!handle) { if (!handle) {
ehca_gen_err("Cannot get eHCA handle for adapter: %s.", ehca_gen_err("Cannot get eHCA handle for adapter: %s.",
dev->ofdev.node->full_name); dev->node->full_name);
return -ENODEV; return -ENODEV;
} }
if (!(*handle)) { if (!(*handle)) {
ehca_gen_err("Wrong eHCA handle for adapter: %s.", ehca_gen_err("Wrong eHCA handle for adapter: %s.",
dev->ofdev.node->full_name); dev->node->full_name);
return -ENODEV; return -ENODEV;
} }
...@@ -686,9 +686,9 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev, ...@@ -686,9 +686,9 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev,
} }
mutex_init(&shca->modify_mutex); mutex_init(&shca->modify_mutex);
shca->ibmebus_dev = dev; shca->ofdev = dev;
shca->ipz_hca_handle.handle = *handle; shca->ipz_hca_handle.handle = *handle;
dev->ofdev.dev.driver_data = shca; dev->dev.driver_data = shca;
ret = ehca_sense_attributes(shca); ret = ehca_sense_attributes(shca);
if (ret < 0) { if (ret < 0) {
...@@ -764,7 +764,7 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev, ...@@ -764,7 +764,7 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev,
} }
} }
ret = sysfs_create_group(&dev->ofdev.dev.kobj, &ehca_dev_attr_grp); ret = sysfs_create_group(&dev->dev.kobj, &ehca_dev_attr_grp);
if (ret) /* only complain; we can live without attributes */ if (ret) /* only complain; we can live without attributes */
ehca_err(&shca->ib_device, ehca_err(&shca->ib_device,
"Cannot create device attributes ret=%d", ret); "Cannot create device attributes ret=%d", ret);
...@@ -814,12 +814,12 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev, ...@@ -814,12 +814,12 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev,
return -EINVAL; return -EINVAL;
} }
static int __devexit ehca_remove(struct ibmebus_dev *dev) static int __devexit ehca_remove(struct of_device *dev)
{ {
struct ehca_shca *shca = dev->ofdev.dev.driver_data; struct ehca_shca *shca = dev->dev.driver_data;
int ret; int ret;
sysfs_remove_group(&dev->ofdev.dev.kobj, &ehca_dev_attr_grp); sysfs_remove_group(&dev->dev.kobj, &ehca_dev_attr_grp);
if (ehca_open_aqp1 == 1) { if (ehca_open_aqp1 == 1) {
int i; int i;
...@@ -870,9 +870,9 @@ static struct of_device_id ehca_device_table[] = ...@@ -870,9 +870,9 @@ static struct of_device_id ehca_device_table[] =
{}, {},
}; };
static struct ibmebus_driver ehca_driver = { static struct of_platform_driver ehca_driver = {
.name = "ehca", .name = "ehca",
.id_table = ehca_device_table, .match_table = ehca_device_table,
.probe = ehca_probe, .probe = ehca_probe,
.remove = ehca_remove, .remove = ehca_remove,
}; };
......
...@@ -388,7 +388,7 @@ struct ehea_port_res { ...@@ -388,7 +388,7 @@ struct ehea_port_res {
#define EHEA_MAX_PORTS 16 #define EHEA_MAX_PORTS 16
struct ehea_adapter { struct ehea_adapter {
u64 handle; u64 handle;
struct ibmebus_dev *ebus_dev; struct of_device *ofdev;
struct ehea_port *port[EHEA_MAX_PORTS]; struct ehea_port *port[EHEA_MAX_PORTS];
struct ehea_eq *neq; /* notification event queue */ struct ehea_eq *neq; /* notification event queue */
struct tasklet_struct neq_tasklet; struct tasklet_struct neq_tasklet;
......
...@@ -98,10 +98,10 @@ struct work_struct ehea_rereg_mr_task; ...@@ -98,10 +98,10 @@ struct work_struct ehea_rereg_mr_task;
struct semaphore dlpar_mem_lock; struct semaphore dlpar_mem_lock;
static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, static int __devinit ehea_probe_adapter(struct of_device *dev,
const struct of_device_id *id); const struct of_device_id *id);
static int __devexit ehea_remove(struct ibmebus_dev *dev); static int __devexit ehea_remove(struct of_device *dev);
static struct of_device_id ehea_device_table[] = { static struct of_device_id ehea_device_table[] = {
{ {
...@@ -111,9 +111,9 @@ static struct of_device_id ehea_device_table[] = { ...@@ -111,9 +111,9 @@ static struct of_device_id ehea_device_table[] = {
{}, {},
}; };
static struct ibmebus_driver ehea_driver = { static struct of_platform_driver ehea_driver = {
.name = "ehea", .name = "ehea",
.id_table = ehea_device_table, .match_table = ehea_device_table,
.probe = ehea_probe_adapter, .probe = ehea_probe_adapter,
.remove = ehea_remove, .remove = ehea_remove,
}; };
...@@ -1044,7 +1044,7 @@ static int ehea_reg_interrupts(struct net_device *dev) ...@@ -1044,7 +1044,7 @@ static int ehea_reg_interrupts(struct net_device *dev)
snprintf(port->int_aff_name, EHEA_IRQ_NAME_SIZE - 1, "%s-aff", snprintf(port->int_aff_name, EHEA_IRQ_NAME_SIZE - 1, "%s-aff",
dev->name); dev->name);
ret = ibmebus_request_irq(NULL, port->qp_eq->attr.ist1, ret = ibmebus_request_irq(port->qp_eq->attr.ist1,
ehea_qp_aff_irq_handler, ehea_qp_aff_irq_handler,
IRQF_DISABLED, port->int_aff_name, port); IRQF_DISABLED, port->int_aff_name, port);
if (ret) { if (ret) {
...@@ -1062,7 +1062,7 @@ static int ehea_reg_interrupts(struct net_device *dev) ...@@ -1062,7 +1062,7 @@ static int ehea_reg_interrupts(struct net_device *dev)
pr = &port->port_res[i]; pr = &port->port_res[i];
snprintf(pr->int_send_name, EHEA_IRQ_NAME_SIZE - 1, snprintf(pr->int_send_name, EHEA_IRQ_NAME_SIZE - 1,
"%s-queue%d", dev->name, i); "%s-queue%d", dev->name, i);
ret = ibmebus_request_irq(NULL, pr->eq->attr.ist1, ret = ibmebus_request_irq(pr->eq->attr.ist1,
ehea_recv_irq_handler, ehea_recv_irq_handler,
IRQF_DISABLED, pr->int_send_name, IRQF_DISABLED, pr->int_send_name,
pr); pr);
...@@ -1083,11 +1083,11 @@ static int ehea_reg_interrupts(struct net_device *dev) ...@@ -1083,11 +1083,11 @@ static int ehea_reg_interrupts(struct net_device *dev)
out_free_req: out_free_req:
while (--i >= 0) { while (--i >= 0) {
u32 ist = port->port_res[i].eq->attr.ist1; u32 ist = port->port_res[i].eq->attr.ist1;
ibmebus_free_irq(NULL, ist, &port->port_res[i]); ibmebus_free_irq(ist, &port->port_res[i]);
} }
out_free_qpeq: out_free_qpeq:
ibmebus_free_irq(NULL, port->qp_eq->attr.ist1, port); ibmebus_free_irq(port->qp_eq->attr.ist1, port);
i = port->num_def_qps; i = port->num_def_qps;
goto out; goto out;
...@@ -1104,14 +1104,14 @@ static void ehea_free_interrupts(struct net_device *dev) ...@@ -1104,14 +1104,14 @@ static void ehea_free_interrupts(struct net_device *dev)
for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
pr = &port->port_res[i]; pr = &port->port_res[i];
ibmebus_free_irq(NULL, pr->eq->attr.ist1, pr); ibmebus_free_irq(pr->eq->attr.ist1, pr);
if (netif_msg_intr(port)) if (netif_msg_intr(port))
ehea_info("free send irq for res %d with handle 0x%X", ehea_info("free send irq for res %d with handle 0x%X",
i, pr->eq->attr.ist1); i, pr->eq->attr.ist1);
} }
/* associated events */ /* associated events */
ibmebus_free_irq(NULL, port->qp_eq->attr.ist1, port); ibmebus_free_irq(port->qp_eq->attr.ist1, port);
if (netif_msg_intr(port)) if (netif_msg_intr(port))
ehea_info("associated event interrupt for handle 0x%X freed", ehea_info("associated event interrupt for handle 0x%X freed",
port->qp_eq->attr.ist1); port->qp_eq->attr.ist1);
...@@ -2832,7 +2832,7 @@ static struct device *ehea_register_port(struct ehea_port *port, ...@@ -2832,7 +2832,7 @@ static struct device *ehea_register_port(struct ehea_port *port,
int ret; int ret;
port->ofdev.node = of_node_get(dn); port->ofdev.node = of_node_get(dn);
port->ofdev.dev.parent = &port->adapter->ebus_dev->ofdev.dev; port->ofdev.dev.parent = &port->adapter->ofdev->dev;
port->ofdev.dev.bus = &ibmebus_bus_type; port->ofdev.dev.bus = &ibmebus_bus_type;
sprintf(port->ofdev.dev.bus_id, "port%d", port_name_cnt++); 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,7 +3011,7 @@ static int ehea_setup_ports(struct ehea_adapter *adapter)
const u32 *dn_log_port_id; const u32 *dn_log_port_id;
int i = 0; int i = 0;
lhea_dn = adapter->ebus_dev->ofdev.node; lhea_dn = adapter->ofdev->node;
while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no", 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,7 +3051,7 @@ static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter,
struct device_node *eth_dn = NULL; struct device_node *eth_dn = NULL;
const u32 *dn_log_port_id; const u32 *dn_log_port_id;
lhea_dn = adapter->ebus_dev->ofdev.node; lhea_dn = adapter->ofdev->node;
while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no", 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,31 +3157,31 @@ static ssize_t ehea_remove_port(struct device *dev,
static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port); static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port);
static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port); static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port);
int ehea_create_device_sysfs(struct ibmebus_dev *dev) int ehea_create_device_sysfs(struct of_device *dev)
{ {
int ret = device_create_file(&dev->ofdev.dev, &dev_attr_probe_port); int ret = device_create_file(&dev->dev, &dev_attr_probe_port);
if (ret) if (ret)
goto out; goto out;
ret = device_create_file(&dev->ofdev.dev, &dev_attr_remove_port); ret = device_create_file(&dev->dev, &dev_attr_remove_port);
out: out:
return ret; return ret;
} }
void ehea_remove_device_sysfs(struct ibmebus_dev *dev) void ehea_remove_device_sysfs(struct of_device *dev)
{ {
device_remove_file(&dev->ofdev.dev, &dev_attr_probe_port); device_remove_file(&dev->dev, &dev_attr_probe_port);
device_remove_file(&dev->ofdev.dev, &dev_attr_remove_port); device_remove_file(&dev->dev, &dev_attr_remove_port);
} }
static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, static int __devinit ehea_probe_adapter(struct of_device *dev,
const struct of_device_id *id) const struct of_device_id *id)
{ {
struct ehea_adapter *adapter; struct ehea_adapter *adapter;
const u64 *adapter_handle; const u64 *adapter_handle;
int ret; int ret;
if (!dev || !dev->ofdev.node) { if (!dev || !dev->node) {
ehea_error("Invalid ibmebus device probed"); ehea_error("Invalid ibmebus device probed");
return -EINVAL; return -EINVAL;
} }
...@@ -3189,36 +3189,36 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, ...@@ -3189,36 +3189,36 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
if (!adapter) { if (!adapter) {
ret = -ENOMEM; ret = -ENOMEM;
dev_err(&dev->ofdev.dev, "no mem for ehea_adapter\n"); dev_err(&dev->dev, "no mem for ehea_adapter\n");
goto out; goto out;
} }
list_add(&adapter->list, &adapter_list); list_add(&adapter->list, &adapter_list);
adapter->ebus_dev = dev; adapter->ofdev = dev;
adapter_handle = of_get_property(dev->ofdev.node, "ibm,hea-handle", adapter_handle = of_get_property(dev->node, "ibm,hea-handle",
NULL); NULL);
if (adapter_handle) if (adapter_handle)
adapter->handle = *adapter_handle; adapter->handle = *adapter_handle;
if (!adapter->handle) { if (!adapter->handle) {
dev_err(&dev->ofdev.dev, "failed getting handle for adapter" dev_err(&dev->dev, "failed getting handle for adapter"
" '%s'\n", dev->ofdev.node->full_name); " '%s'\n", dev->node->full_name);
ret = -ENODEV; ret = -ENODEV;
goto out_free_ad; goto out_free_ad;
} }
adapter->pd = EHEA_PD_ID; adapter->pd = EHEA_PD_ID;
dev->ofdev.dev.driver_data = adapter; dev->dev.driver_data = adapter;
/* initialize adapter and ports */ /* initialize adapter and ports */
/* get adapter properties */ /* get adapter properties */
ret = ehea_sense_adapter_attr(adapter); ret = ehea_sense_adapter_attr(adapter);
if (ret) { if (ret) {
dev_err(&dev->ofdev.dev, "sense_adapter_attr failed: %d", ret); dev_err(&dev->dev, "sense_adapter_attr failed: %d", ret);
goto out_free_ad; goto out_free_ad;
} }
...@@ -3226,18 +3226,18 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, ...@@ -3226,18 +3226,18 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
EHEA_NEQ, EHEA_MAX_ENTRIES_EQ, 1); EHEA_NEQ, EHEA_MAX_ENTRIES_EQ, 1);
if (!adapter->neq) { if (!adapter->neq) {
ret = -EIO; ret = -EIO;
dev_err(&dev->ofdev.dev, "NEQ creation failed"); dev_err(&dev->dev, "NEQ creation failed");
goto out_free_ad; goto out_free_ad;
} }
tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet, tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet,
(unsigned long)adapter); (unsigned long)adapter);
ret = ibmebus_request_irq(NULL, adapter->neq->attr.ist1, ret = ibmebus_request_irq(adapter->neq->attr.ist1,
ehea_interrupt_neq, IRQF_DISABLED, ehea_interrupt_neq, IRQF_DISABLED,
"ehea_neq", adapter); "ehea_neq", adapter);
if (ret) { if (ret) {
dev_err(&dev->ofdev.dev, "requesting NEQ IRQ failed"); dev_err(&dev->dev, "requesting NEQ IRQ failed");
goto out_kill_eq; goto out_kill_eq;
} }
...@@ -3247,7 +3247,7 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, ...@@ -3247,7 +3247,7 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
ret = ehea_setup_ports(adapter); ret = ehea_setup_ports(adapter);
if (ret) { if (ret) {
dev_err(&dev->ofdev.dev, "setup_ports failed"); dev_err(&dev->dev, "setup_ports failed");
goto out_rem_dev_sysfs; goto out_rem_dev_sysfs;
} }
...@@ -3258,7 +3258,7 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, ...@@ -3258,7 +3258,7 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
ehea_remove_device_sysfs(dev); ehea_remove_device_sysfs(dev);
out_free_irq: out_free_irq:
ibmebus_free_irq(NULL, adapter->neq->attr.ist1, adapter); ibmebus_free_irq(adapter->neq->attr.ist1, adapter);
out_kill_eq: out_kill_eq:
ehea_destroy_eq(adapter->neq); ehea_destroy_eq(adapter->neq);
...@@ -3269,9 +3269,9 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, ...@@ -3269,9 +3269,9 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
return ret; return ret;
} }
static int __devexit ehea_remove(struct ibmebus_dev *dev) static int __devexit ehea_remove(struct of_device *dev)
{ {
struct ehea_adapter *adapter = dev->ofdev.dev.driver_data; struct ehea_adapter *adapter = dev->dev.driver_data;
int i; int i;
for (i = 0; i < EHEA_MAX_PORTS; i++) for (i = 0; i < EHEA_MAX_PORTS; i++)
...@@ -3284,7 +3284,7 @@ static int __devexit ehea_remove(struct ibmebus_dev *dev) ...@@ -3284,7 +3284,7 @@ static int __devexit ehea_remove(struct ibmebus_dev *dev)
flush_scheduled_work(); flush_scheduled_work();
ibmebus_free_irq(NULL, adapter->neq->attr.ist1, adapter); ibmebus_free_irq(adapter->neq->attr.ist1, adapter);
tasklet_kill(&adapter->neq_tasklet); tasklet_kill(&adapter->neq_tasklet);
ehea_destroy_eq(adapter->neq); ehea_destroy_eq(adapter->neq);
......
...@@ -43,42 +43,18 @@ ...@@ -43,42 +43,18 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <asm/of_device.h> #include <linux/of_device.h>
#include <linux/of_platform.h>
extern struct bus_type ibmebus_bus_type; extern struct bus_type ibmebus_bus_type;
struct ibmebus_dev { int ibmebus_register_driver(struct of_platform_driver *drv);
struct of_device ofdev; void ibmebus_unregister_driver(struct of_platform_driver *drv);
};
struct ibmebus_driver { int ibmebus_request_irq(u32 ist, irq_handler_t handler,
char *name; unsigned long irq_flags, const char *devname,
struct of_device_id *id_table;
int (*probe) (struct ibmebus_dev *dev, const struct of_device_id *id);
int (*remove) (struct ibmebus_dev *dev);
struct device_driver driver;
};
int ibmebus_register_driver(struct ibmebus_driver *drv);
void ibmebus_unregister_driver(struct ibmebus_driver *drv);
int ibmebus_request_irq(struct ibmebus_dev *dev,
u32 ist,
irq_handler_t handler,
unsigned long irq_flags, const char * devname,
void *dev_id); void *dev_id);
void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id); void ibmebus_free_irq(u32 ist, void *dev_id);
static inline struct ibmebus_driver *to_ibmebus_driver(struct device_driver *drv)
{
return container_of(drv, struct ibmebus_driver, driver);
}
static inline struct ibmebus_dev *to_ibmebus_dev(struct device *dev)
{
return container_of(dev, struct ibmebus_dev, ofdev.dev);
}
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _ASM_IBMEBUS_H */ #endif /* _ASM_IBMEBUS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment