(dev->eq_table.inta_pin < 31 ? 4 : 0);
(dev->eq_table.inta_pin < 32 ? 4 : 0);
int __devinit mthca_init_eq_table(struct mthca_dev *dev){	int err;	u8 status;	u8 intr;	int i;	err = mthca_alloc_init(&dev->eq_table.alloc,			       dev->limits.num_eqs,			       dev->limits.num_eqs - 1,			       dev->limits.reserved_eqs);	if (err)		return err;	err = mthca_map_eq_regs(dev);	if (err)		goto err_out_free;	if (dev->mthca_flags & MTHCA_FLAG_MSI ||	    dev->mthca_flags & MTHCA_FLAG_MSI_X) {		dev->eq_table.clr_mask = 0;	} else {		dev->eq_table.clr_mask =			swab32(1 << (dev->eq_table.inta_pin & 31));		dev->eq_table.clr_int  = dev->clr_base +			(dev->eq_table.inta_pin < 31 ? 4 : 0);	}	dev->eq_table.arm_mask = 0;	intr = (dev->mthca_flags & MTHCA_FLAG_MSI) ?		128 : dev->eq_table.inta_pin;	err = mthca_create_eq(dev, dev->limits.num_cqs,			      (dev->mthca_flags & MTHCA_FLAG_MSI_X) ? 128 : intr,			      &dev->eq_table.eq[MTHCA_EQ_COMP]);	if (err)		goto err_out_unmap;	err = mthca_create_eq(dev, MTHCA_NUM_ASYNC_EQE,			      (dev->mthca_flags & MTHCA_FLAG_MSI_X) ? 129 : intr,			      &dev->eq_table.eq[MTHCA_EQ_ASYNC]);	if (err)		goto err_out_comp;	err = mthca_create_eq(dev, MTHCA_NUM_CMD_EQE,			      (dev->mthca_flags & MTHCA_FLAG_MSI_X) ? 130 : intr,			      &dev->eq_table.eq[MTHCA_EQ_CMD]);	if (err)		goto err_out_async;	if (dev->mthca_flags & MTHCA_FLAG_MSI_X) {		static const char *eq_name[] = {			[MTHCA_EQ_COMP]  = DRV_NAME " (comp)",			[MTHCA_EQ_ASYNC] = DRV_NAME " (async)",			[MTHCA_EQ_CMD]   = DRV_NAME " (cmd)"		};		for (i = 0; i < MTHCA_NUM_EQ; ++i) {			err = request_irq(dev->eq_table.eq[i].msi_x_vector,					  mthca_is_memfree(dev) ?					  mthca_arbel_msi_x_interrupt :					  mthca_tavor_msi_x_interrupt,					  0, eq_name[i], dev->eq_table.eq + i);			if (err)				goto err_out_cmd;			dev->eq_table.eq[i].have_irq = 1;		}	} else {		err = request_irq(dev->pdev->irq,				  mthca_is_memfree(dev) ?				  mthca_arbel_interrupt :				  mthca_tavor_interrupt,				  SA_SHIRQ, DRV_NAME, dev);		if (err)			goto err_out_cmd;		dev->eq_table.have_irq = 1;	}	err = mthca_MAP_EQ(dev, async_mask(dev),			   0, dev->eq_table.eq[MTHCA_EQ_ASYNC].eqn, &status);	if (err)		mthca_warn(dev, "MAP_EQ for async EQ %d failed (%d)\n",			   dev->eq_table.eq[MTHCA_EQ_ASYNC].eqn, err);	if (status)		mthca_warn(dev, "MAP_EQ for async EQ %d returned status 0x%02x\n",			   dev->eq_table.eq[MTHCA_EQ_ASYNC].eqn, status);	err = mthca_MAP_EQ(dev, MTHCA_CMD_EVENT_MASK,			   0, dev->eq_table.eq[MTHCA_EQ_CMD].eqn, &status);	if (err)		mthca_warn(dev, "MAP_EQ for cmd EQ %d failed (%d)\n",			   dev->eq_table.eq[MTHCA_EQ_CMD].eqn, err);	if (status)		mthca_warn(dev, "MAP_EQ for cmd EQ %d returned status 0x%02x\n",			   dev->eq_table.eq[MTHCA_EQ_CMD].eqn, status);	for (i = 0; i < MTHCA_EQ_CMD; ++i)		if (mthca_is_memfree(dev))			arbel_eq_req_not(dev, dev->eq_table.eq[i].eqn_mask);		else			tavor_eq_req_not(dev, dev->eq_table.eq[i].eqn);	return 0;err_out_cmd:	mthca_free_irqs(dev);	mthca_free_eq(dev, &dev->eq_table.eq[MTHCA_EQ_CMD]);err_out_async:	mthca_free_eq(dev, &dev->eq_table.eq[MTHCA_EQ_ASYNC]);err_out_comp:	mthca_free_eq(dev, &dev->eq_table.eq[MTHCA_EQ_COMP]);err_out_unmap:	mthca_unmap_eq_regs(dev);err_out_free:	mthca_alloc_cleanup(&dev->eq_table.alloc);	return err;}