X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fnet%2Fwan%2Fpc300_drv.c;h=57914fbd41d370c15df6c2a9531a069a77731166;hb=89a93f2f4834f8c126e8d9dd6b368d0b9e21ec3d;hp=999bf71937ca55f5540304242253f51d4ed67ce0;hpb=18062a91d2ddc40e19fc674afeb7cad58cfa23ab;p=linux-2.6 diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c index 999bf71937..57914fbd41 100644 --- a/drivers/net/wan/pc300_drv.c +++ b/drivers/net/wan/pc300_drv.c @@ -2365,17 +2365,17 @@ static void falc_intr(pc300_t * card) static irqreturn_t cpc_intr(int irq, void *dev_id) { - pc300_t *card; + pc300_t *card = dev_id; volatile ucchar plx_status; - if ((card = (pc300_t *) dev_id) == 0) { + if (!card) { #ifdef PC300_DEBUG_INTR printk("cpc_intr: spurious intr %d\n", irq); #endif return IRQ_NONE; /* spurious intr */ } - if (card->hw.rambase == 0) { + if (!card->hw.rambase) { #ifdef PC300_DEBUG_INTR printk("cpc_intr: spurious intr2 %d\n", irq); #endif @@ -2833,6 +2833,8 @@ static int clock_rate_calc(uclong rate, uclong clock, int *br_io) int br, tc; int br_pwr, error; + *br_io = 0; + if (rate == 0) return (0); @@ -3439,7 +3441,6 @@ static int __devinit cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { static int first_time = 1; - ucchar cpc_rev_id; int err, eeprom_outdated = 0; ucshort device_id; pc300_t *card; @@ -3455,7 +3456,7 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if ((err = pci_enable_device(pdev)) < 0) return err; - card = kmalloc(sizeof(pc300_t), GFP_KERNEL); + card = kzalloc(sizeof(pc300_t), GFP_KERNEL); if (card == NULL) { printk("PC300 found at RAM 0x%016llx, " "but could not allocate card structure.\n", @@ -3463,7 +3464,6 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) err = -ENOMEM; goto err_disable_dev; } - memset(card, 0, sizeof(pc300_t)); err = -ENODEV; @@ -3480,7 +3480,6 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) card->hw.falcsize = pci_resource_len(pdev, 4); card->hw.plxphys = pci_resource_start(pdev, 5); card->hw.plxsize = pci_resource_len(pdev, 5); - pci_read_config_byte(pdev, PCI_REVISION_ID, &cpc_rev_id); switch (device_id) { case PCI_DEVICE_ID_PC300_RX_1: @@ -3498,7 +3497,7 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) } #ifdef PC300_DEBUG_PCI printk("cpc (bus=0x0%x,pci_id=0x%x,", pdev->bus->number, pdev->devfn); - printk("rev_id=%d) IRQ%d\n", cpc_rev_id, card->hw.irq); + printk("rev_id=%d) IRQ%d\n", pdev->revision, card->hw.irq); printk("cpc:found ramaddr=0x%08lx plxaddr=0x%08lx " "ctladdr=0x%08lx falcaddr=0x%08lx\n", card->hw.ramphys, card->hw.plxphys, card->hw.scaphys, @@ -3649,7 +3648,7 @@ static void __devexit cpc_remove_one(struct pci_dev *pdev) { pc300_t *card = pci_get_drvdata(pdev); - if (card->hw.rambase != 0) { + if (card->hw.rambase) { int i; /* Disable interrupts on the PCI bridge */