[2.6.19 PATCH 1/7] ehea: interface to network stack

Jan-Bernd Themann ossthema at de.ibm.com
Wed Sep 6 22:53:38 EST 2006


Hi,

ok, I admit this solution looks a bit nicer. We changed it in a similar way.

Jan-Bernd

On Tuesday 05 September 2006 20:58, Francois Romieu wrote:
> Thomas Klein <osstklei at de.ibm.com> :
> [...]
> > 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;
> }
> 



More information about the Linuxppc-dev mailing list