提交 98fc4839 编写于 作者: J Jeff Garzik

[ISDN] HiSax hfc_pci: minor cleanups

* trim trailing whitespace
* remove CONFIG_PCI ifdefs, this driver is always PCI (Kconfig enforced)
* remove return statements at the tail of a function
* remove indentation levels by returning an error code immediately.
  Makes the code much more readable, and easier to update to PCI hotplug
  API.
Signed-off-by: NJeff Garzik <jeff@garzik.org>
上级 d825a492
......@@ -67,8 +67,6 @@ static const PCI_ENTRY id_list[] =
};
#ifdef CONFIG_PCI
/******************************************/
/* free hardware resources used by driver */
/******************************************/
......@@ -511,7 +509,6 @@ main_rec_hfcpci(struct BCState *bcs)
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
if (count && receive)
goto Begin;
return;
}
/**************************/
......@@ -582,7 +579,6 @@ hfcpci_fill_dfifo(struct IsdnCardState *cs)
dev_kfree_skb_any(cs->tx_skb);
cs->tx_skb = NULL;
return;
}
/**************************/
......@@ -729,7 +725,6 @@ hfcpci_fill_fifo(struct BCState *bcs)
dev_kfree_skb_any(bcs->tx_skb);
bcs->tx_skb = NULL;
test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
return;
}
/**********************************************/
......@@ -924,7 +919,6 @@ receive_emsg(struct IsdnCardState *cs)
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
if (count && receive)
goto Begin;
return;
} /* receive_emsg */
/*********************/
......@@ -1642,8 +1636,6 @@ hfcpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
/* this variable is used as card index when more than one cards are present */
static struct pci_dev *dev_hfcpci __devinitdata = NULL;
#endif /* CONFIG_PCI */
int __devinit
setup_hfcpci(struct IsdnCard *card)
{
......@@ -1656,13 +1648,16 @@ setup_hfcpci(struct IsdnCard *card)
#ifdef __BIG_ENDIAN
#error "not running on big endian machines now"
#endif
strcpy(tmp, hfcpci_revision);
printk(KERN_INFO "HiSax: HFC-PCI driver Rev. %s\n", HiSax_getrev(tmp));
#ifdef CONFIG_PCI
cs->hw.hfcpci.int_s1 = 0;
cs->dc.hfcpci.ph_state = 0;
cs->hw.hfcpci.fifo = 255;
if (cs->typ == ISDN_CTYPE_HFC_PCI) {
if (cs->typ != ISDN_CTYPE_HFC_PCI)
return(0);
i = 0;
while (id_list[i].vendor_id) {
tmp_hfcpci = pci_find_device(id_list[i].vendor_id,
......@@ -1680,7 +1675,11 @@ setup_hfcpci(struct IsdnCard *card)
}
}
if (tmp_hfcpci) {
if (!tmp_hfcpci) {
printk(KERN_WARNING "HFC-PCI: No PCI card found\n");
return (0);
}
i--;
dev_hfcpci = tmp_hfcpci; /* old device */
cs->hw.hfcpci.dev = dev_hfcpci;
......@@ -1691,10 +1690,7 @@ setup_hfcpci(struct IsdnCard *card)
}
cs->hw.hfcpci.pci_io = (char *)(unsigned long)dev_hfcpci->resource[1].start;
printk(KERN_INFO "HiSax: HFC-PCI card manufacturer: %s card name: %s\n", id_list[i].vendor_name, id_list[i].card_name);
} else {
printk(KERN_WARNING "HFC-PCI: No PCI card found\n");
return (0);
}
if (!cs->hw.hfcpci.pci_io) {
printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
return (0);
......@@ -1716,7 +1712,9 @@ setup_hfcpci(struct IsdnCard *card)
cs->hw.hfcpci.fifos,
(u_int) virt_to_bus(cs->hw.hfcpci.fifos),
cs->irq, HZ);
spin_lock_irqsave(&cs->lock, flags);
pci_write_config_word(cs->hw.hfcpci.dev, PCI_COMMAND, PCI_ENA_MEMIO); /* enable memory mapped ports, disable busmaster */
cs->hw.hfcpci.int_m2 = 0; /* disable alle interrupts */
cs->hw.hfcpci.int_m1 = 0;
......@@ -1724,6 +1722,7 @@ setup_hfcpci(struct IsdnCard *card)
Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2);
/* At this point the needed PCI config is done */
/* fifos are still not enabled */
INIT_WORK(&cs->tqueue, hfcpci_bh);
cs->setstack_d = setstack_hfcpci;
cs->BC_Send_Data = &hfcpci_send_data;
......@@ -1740,12 +1739,8 @@ setup_hfcpci(struct IsdnCard *card)
init_timer(&cs->hw.hfcpci.timer);
cs->cardmsg = &hfcpci_card_msg;
cs->auxcmd = &hfcpci_auxcmd;
spin_unlock_irqrestore(&cs->lock, flags);
return (1);
} else
return (0); /* no valid card type */
#else
printk(KERN_WARNING "HFC-PCI: NO_PCI_BIOS\n");
return (0);
#endif /* CONFIG_PCI */
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册