Thomas Klein <[email protected]> :
[...]
> Somehow I don't get your point concerning the usage of 'k'. We need another
> iterator as the for loops using 'k' use 'i' as their terminating condition.
Something like the code below perhaps (with more local variables maybe):
static int ehea_reg_interrupts(struct net_device *dev)
{
struct ehea_port *port = netdev_priv(dev);
struct ehea_port_res *pr;
int i, ret;
for (i = 0; i < port->num_def_qps; i++) {
pr = &port->port_res[i];
snprintf(pr->int_recv_name, EHEA_IRQ_NAME_SIZE - 1
, "%s-recv%d", dev->name, i);
ret = ibmebus_request_irq(NULL, pr->recv_eq->attr.ist1,
ehea_recv_irq_handler, SA_INTERRUPT,
pr->int_recv_name, pr);
if (ret) {
ehea_error("failed registering irq for ehea_recv_int:"
"port_res_nr:%d, ist=%X", i,
pr->recv_eq->attr.ist1);
goto err_free_irq_recv_eq_0;
}
if (netif_msg_ifup(port))
ehea_info("irq_handle 0x%X for funct ehea_recv_int %d "
"registered", pr->recv_eq->attr.ist1, i);
}
snprintf(port->int_aff_name, EHEA_IRQ_NAME_SIZE - 1,
"%s-aff", dev->name);
ret = ibmebus_request_irq(NULL, port->qp_eq->attr.ist1,
ehea_qp_aff_irq_handler,
SA_INTERRUPT, port->int_aff_name, port);
if (ret) {
ehea_error("failed registering irq for qp_aff_irq_handler:"
" ist=%X", port->qp_eq->attr.ist1);
goto err_free_irq_recv_eq_0;
}
if (netif_msg_ifup(port))
ehea_info("irq_handle 0x%X for function qp_aff_irq_handler "
"registered", port->qp_eq->attr.ist1);
for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
pr = &port->port_res[i];
snprintf(pr->int_send_name, EHEA_IRQ_NAME_SIZE - 1,
"%s-send%d", dev->name, i);
ret = ibmebus_request_irq(NULL, pr->send_eq->attr.ist1,
ehea_send_irq_handler, SA_INTERRUPT,
pr->int_send_name, pr);
if (ret) {
ehea_error("failed registering irq for ehea_send"
" port_res_nr:%d, ist=%X", i,
pr->send_eq->attr.ist1);
goto err_free_irq_send_eq_1;
}
if (netif_msg_ifup(port))
ehea_info("irq_handle 0x%X for function ehea_send_int "
"%d registered", pr->send_eq->attr.ist1, i);
}
out:
return ret;
err_free_irq_send_eq_1:
// Post-dec works with unsigned int too.
while (i-- > 0) {
u32 ist = port->port_res[i].send_eq->attr.ist1;
ibmebus_free_irq(NULL, ist, &port->port_res[i]);
}
ibmebus_free_irq(NULL, port->qp_eq->attr.ist1, port);
i = port->num_def_qps;
err_free_irq_recv_eq_0:
while (i-- > 0) {
u32 ist = port->port_res[i].recv_eq->attr.ist1;
ibmebus_free_irq(NULL, ist, &port->port_res[k]);
}
goto out;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]