Re: [PATCH] ISDN: Change pci_find_device() calls to pci_get_device()
On Fri, 2007-09-21 at 10:55 +0200, Gregory 'GaLi' Cavelier wrote: > The following patch removes the obsolete pci_find_device() calls and replaces > them with pci_get_device() for all ISDN drivers. > > Compilation is fine but I haven't tested it since I don't own a ISDN card. > Should be fine since the return value and parameters of pci_find_device() and > pci_get_device() are the same. > > The is my first patch so be nice to me :) I'll try to be nice:-) Kindly check the linux kernel archives before you start of with any patches in the kernel. archives can be found here http://marc.info/?l=linux-kernel&w=2 > > I hope it's not too long, I can split it if you prefer. > > Signed-off-by: Gregory 'GaLi' Cavelier <[EMAIL PROTECTED]> > > diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c > index 28e2667..b04a178 100644 > --- a/drivers/isdn/hisax/avm_pci.c > +++ b/drivers/isdn/hisax/avm_pci.c > @@ -789,7 +789,7 @@ setup_avm_pcipnp(struct IsdnCard *card) > } > #endif > #ifdef CONFIG_PCI > - if ((dev_avm = pci_get_device(PCI_VENDOR_ID_AVM, > + if ((dev_avm = pci_find_device(PCI_VENDOR_ID_AVM, > PCI_DEVICE_ID_AVM_A1, dev_avm))) { > if (pci_enable_device(dev_avm)) > return(0); > diff --git a/drivers/isdn/hisax/bkm_a4t.c b/drivers/isdn/hisax/bkm_a4t.c > index b5e761d..3d1bdc8 100644 > --- a/drivers/isdn/hisax/bkm_a4t.c > +++ b/drivers/isdn/hisax/bkm_a4t.c > @@ -340,7 +340,7 @@ setup_bkm_a4t(struct IsdnCard *card) > } else > return (0); > > - while ((dev_a4t = pci_get_device(PCI_VENDOR_ID_ZORAN, > + while ((dev_a4t = pci_find_device(PCI_VENDOR_ID_ZORAN, > PCI_DEVICE_ID_ZORAN_36120, dev_a4t))) { > ret = a4t_pci_probe(dev_a4t, cs, &found, &pci_memaddr); > if (!ret) > diff --git a/drivers/isdn/hisax/bkm_a8.c b/drivers/isdn/hisax/bkm_a8.c > index 340313f..6339bb4 100644 > --- a/drivers/isdn/hisax/bkm_a8.c > +++ b/drivers/isdn/hisax/bkm_a8.c > @@ -309,7 +309,7 @@ setup_sct_quadro(struct IsdnCard *card) > (sub_vendor_id != PCI_VENDOR_ID_BERKOM))) > return (0); > if (cs->subtyp == SCT_1) { > - while ((dev_a8 = pci_get_device(PCI_VENDOR_ID_PLX, > + while ((dev_a8 = pci_find_device(PCI_VENDOR_ID_PLX, > PCI_DEVICE_ID_PLX_9050, dev_a8))) { > > sub_vendor_id = dev_a8->subsystem_vendor; > diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c > index 8c7b03e..6eebeb4 100644 > --- a/drivers/isdn/hisax/diva.c > +++ b/drivers/isdn/hisax/diva.c > @@ -1047,21 +1047,21 @@ setup_diva(struct IsdnCard *card) > #endif > #ifdef CONFIG_PCI > cs->subtyp = 0; > - if ((dev_diva = pci_get_device(PCI_VENDOR_ID_EICON, > + if ((dev_diva = pci_find_device(PCI_VENDOR_ID_EICON, > PCI_DEVICE_ID_EICON_DIVA20, dev_diva))) { > if (pci_enable_device(dev_diva)) > return(0); > cs->subtyp = DIVA_PCI; > cs->irq = dev_diva->irq; > cs->hw.diva.cfg_reg = pci_resource_start(dev_diva, 2); > - } else if ((dev_diva_u = pci_get_device(PCI_VENDOR_ID_EICON, > + } else if ((dev_diva_u = pci_find_device(PCI_VENDOR_ID_EICON, > PCI_DEVICE_ID_EICON_DIVA20_U, dev_diva_u))) { > if (pci_enable_device(dev_diva_u)) > return(0); > cs->subtyp = DIVA_PCI; > cs->irq = dev_diva_u->irq; > cs->hw.diva.cfg_reg = pci_resource_start(dev_diva_u, > 2); > - } else if ((dev_diva201 = pci_get_device(PCI_VENDOR_ID_EICON, > + } else if ((dev_diva201 = pci_find_device(PCI_VENDOR_ID_EICON, > PCI_DEVICE_ID_EICON_DIVA201, dev_diva201))) { > if (pci_enable_device(dev_diva201)) > return(0); > @@ -1071,7 +1071,7 @@ setup_diva(struct IsdnCard *card) > (ulong) > ioremap(pci_resource_start(dev_diva201, 0), 4096); > cs->hw.diva.cfg_reg = > (ulong) > ioremap(pci_resource_start(dev_diva201, 1), 4096); > - } else if ((dev_diva202 = pci_get_device(PCI_VENDOR_ID_EICON, > + } else if ((dev_diva202 = pci_find_device(PCI_VENDOR_ID_EICON, > PCI_DEVICE_ID_EICON_DIVA202, dev_diva202))) { > if (pci_enable_device(dev_diva202)) > return(0); > diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c > index 2932755..fab3e4e 100644 > --- a/drivers/isdn/hisax/elsa.c > +++ b/drivers/isdn/hisax/elsa.c >
drivers/net/tokenring/3c359.c
Hi, Replacing kmalloc with kzalloc and cleaning up memset in drivers/net/tokenring/3c359.c Signed-off-by: Surya Prabhakar <[EMAIL PROTECTED]> --- diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c index 9f1b6ab..d36dd53 100644 --- a/drivers/net/tokenring/3c359.c +++ b/drivers/net/tokenring/3c359.c @@ -641,14 +641,14 @@ static int xl_open(struct net_device *dev) * Now to set up the Rx and Tx buffer structures */ /* These MUST be on 8 byte boundaries */ - xl_priv->xl_tx_ring = kmalloc((sizeof(struct xl_tx_desc) * XL_TX_RING_SIZE) + 7, GFP_DMA | GFP_KERNEL) ; + xl_priv->xl_tx_ring = kzalloc((sizeof(struct xl_tx_desc) * XL_TX_RING_SIZE) + 7, GFP_DMA | GFP_KERNEL) ; if (xl_priv->xl_tx_ring == NULL) { printk(KERN_WARNING "%s: Not enough memory to allocate rx buffers.\n", dev->name); free_irq(dev->irq,dev); return -ENOMEM; } - xl_priv->xl_rx_ring = kmalloc((sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE) +7, GFP_DMA | GFP_KERNEL) ; + xl_priv->xl_rx_ring = kzalloc((sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE) +7, GFP_DMA | GFP_KERNEL) ; if (xl_priv->xl_tx_ring == NULL) { printk(KERN_WARNING "%s: Not enough memory to allocate rx buffers.\n", dev->name); @@ -656,8 +656,6 @@ static int xl_open(struct net_device *dev) kfree(xl_priv->xl_tx_ring); return -ENOMEM; } - memset(xl_priv->xl_tx_ring,0,sizeof(struct xl_tx_desc) * XL_TX_RING_SIZE) ; - memset(xl_priv->xl_rx_ring,0,sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE) ; /* Setup Rx Ring */ for (i=0 ; i < XL_RX_RING_SIZE ; i++) { -- thanks surya. - 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/
[KJ] replacing kmalloc with kzalloc in drivers/net/sb1250-mac.c
Hi, Replacing kmalloc with kzalloc and cleaning up memset in drivers/net/sb1250-mac.c Signed-off-by: Surya Prabhakar <[EMAIL PROTECTED]> --- diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c index e7fdcf1..2dca5a7 100644 --- a/drivers/net/sb1250-mac.c +++ b/drivers/net/sb1250-mac.c @@ -760,7 +760,7 @@ static void sbdma_initctx(sbmacdma_t *d, d->sbdma_dscrtable_unaligned = d->sbdma_dscrtable = (sbdmadscr_t *) - kmalloc((d->sbdma_maxdescr+1)*sizeof(sbdmadscr_t), GFP_KERNEL); + kzalloc((d->sbdma_maxdescr+1)*sizeof(sbdmadscr_t), GFP_KERNEL); /* * The descriptor table must be aligned to at least 16 bytes or the @@ -769,8 +769,6 @@ static void sbdma_initctx(sbmacdma_t *d, d->sbdma_dscrtable = (sbdmadscr_t *) ALIGN((unsigned long)d->sbdma_dscrtable, sizeof(sbdmadscr_t)); - memset(d->sbdma_dscrtable,0,d->sbdma_maxdescr*sizeof(sbdmadscr_t)); - d->sbdma_dscrtable_end = d->sbdma_dscrtable + d->sbdma_maxdescr; d->sbdma_dscrtable_phys = virt_to_phys(d->sbdma_dscrtable); @@ -780,9 +778,7 @@ static void sbdma_initctx(sbmacdma_t *d, */ d->sbdma_ctxtable = (struct sk_buff **) - kmalloc(d->sbdma_maxdescr*sizeof(struct sk_buff *), GFP_KERNEL); - - memset(d->sbdma_ctxtable,0,d->sbdma_maxdescr*sizeof(struct sk_buff *)); + kzalloc(d->sbdma_maxdescr*sizeof(struct sk_buff *), GFP_KERNEL); #ifdef CONFIG_SBMAC_COALESCE /* -- thanks surya. - 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/
[KJ] replacing kmalloc with kzalloc in drivers/mtd/devices/docprobe.c
Hi, Replacing kmalloc with kzalloc and cleaning up memset in drivers/mtd/devices/docprobe.c. Signed-off-by: Surya Prabhakar <[EMAIL PROTECTED]> --- diff --git a/drivers/mtd/devices/docprobe.c b/drivers/mtd/devices/docprobe.c index 54aa759..53be397 100644 --- a/drivers/mtd/devices/docprobe.c +++ b/drivers/mtd/devices/docprobe.c @@ -254,7 +254,7 @@ static void __init DoC_Probe(unsigned long physadr) return; } docfound = 1; - mtd = kmalloc(sizeof(struct DiskOnChip) + sizeof(struct mtd_info), GFP_KERNEL); + mtd = kzalloc(sizeof(struct DiskOnChip) + sizeof(struct mtd_info), GFP_KERNEL); if (!mtd) { printk(KERN_WARNING "Cannot allocate memory for data structures. Dropping.\n"); @@ -264,9 +264,6 @@ static void __init DoC_Probe(unsigned long physadr) this = (struct DiskOnChip *)(&mtd[1]); - memset((char *)mtd,0, sizeof(struct mtd_info)); - memset((char *)this, 0, sizeof(struct DiskOnChip)); - mtd->priv = this; this->virtadr = docptr; this->physadr = physadr; -- thanks surya. - 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/
[KJ] replacing kmalloc with kzalloc in drivers/mtd/chips/jedec_probe.c
Hi, Replacing kmalloc with kzalloc and cleaning up memset in drivers/mtd/chips/jedec_probe.c. Signed-off-by: Surya Prabhakar <[EMAIL PROTECTED]> --- diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c index 58e561e..ba5fc39 100644 --- a/drivers/mtd/chips/jedec_probe.c +++ b/drivers/mtd/chips/jedec_probe.c @@ -1853,14 +1853,12 @@ static int cfi_jedec_setup(struct cfi_private *p_cfi, int index) num_erase_regions = jedec_table[index].NumEraseRegions; - p_cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL); + p_cfi->cfiq = kzalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL); if (!p_cfi->cfiq) { //xx printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name); return 0; } - memset(p_cfi->cfiq,0,sizeof(struct cfi_ident)); - p_cfi->cfiq->P_ID = jedec_table[index].CmdSet; p_cfi->cfiq->NumEraseRegions = jedec_table[index].NumEraseRegions; p_cfi->cfiq->DevSize = jedec_table[index].DevSize; -- thanks surya. - 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/
[KJ] replacing kmalloc with kzalloc in drivers/mtd/chips/cfi_probe.c
Hi, Replacing kmalloc with kzalloc and cleaning up memset in arch/i386/kernel/io_apic.c Signed-off-by: Surya Prabhakar <[EMAIL PROTECTED]> --- diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c index 60e11a0..efb51f7 100644 --- a/drivers/mtd/chips/cfi_probe.c +++ b/drivers/mtd/chips/cfi_probe.c @@ -203,14 +203,12 @@ static int __xipram cfi_chip_setup(struct map_info *map, if (!num_erase_regions) return 0; - cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL); + cfi->cfiq = kzalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL); if (!cfi->cfiq) { printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name); return 0; } - memset(cfi->cfiq,0,sizeof(struct cfi_ident)); - cfi->cfi_mode = CFI_MODE_CFI; /* Read the CFI info structure */ -- thanks surya. - 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/
[KJ-resend]replacing kmalloc with kzalloc in drivers/mtd/chips/cfi_probe.c
Hi, Replacing kmalloc with kzalloc and cleaning up memset in drivers/mtd/chips/cfi_probe.c. Kindly ignore the previous similar patch. Signed-off-by: Surya Prabhakar <[EMAIL PROTECTED]> --- diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c index 60e11a0..efb51f7 100644 --- a/drivers/mtd/chips/cfi_probe.c +++ b/drivers/mtd/chips/cfi_probe.c @@ -203,14 +203,12 @@ static int __xipram cfi_chip_setup(struct map_info *map, if (!num_erase_regions) return 0; - cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL); + cfi->cfiq = kzalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL); if (!cfi->cfiq) { printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name); return 0; } - memset(cfi->cfiq,0,sizeof(struct cfi_ident)); - cfi->cfi_mode = CFI_MODE_CFI; /* Read the CFI info structure */ thanks surya. - 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/
cli/sti cleanup in drivers/net/cris/eth_v10.c
Hi, Removed the cli/sti reference in eth_v10.c and updated it with proper spinlock code. Signed-off-by: Surya Prabhakar <[EMAIL PROTECTED]> --- diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index 5bdf5ca..d1f7225 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c @@ -642,6 +642,7 @@ e100_set_mac_address(struct net_device *dev, void *p) static int e100_open(struct net_device *dev) { + struct net_local *np = (struct net_local *)dev->priv; unsigned long flags; /* enable the MDIO output pin */ @@ -723,9 +724,7 @@ e100_open(struct net_device *dev) SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, crc, enable); *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; - save_flags(flags); - cli(); - + spin_lock_irqsave(&np->lock, flags); /* enable the irq's for ethernet DMA */ *R_IRQ_MASK2_SET = @@ -757,7 +756,7 @@ e100_open(struct net_device *dev) *R_DMA_CH0_FIRST = 0; *R_DMA_CH0_DESCR = virt_to_phys(myLastTxDesc); - restore_flags(flags); + spin_unlock_irqrestore(&np->lock, flags); /* Probe for transceiver */ if (e100_probe_transceiver(dev)) -- thanks surya. - 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/
[KJ] replacing kmalloc with kzalloc in io_apic.c
Hi, Replacing kmalloc with kzalloc and cleaning up memset in arch/i386/kernel/io_apic.c Signed-off-by: Surya Prabhakar <[EMAIL PROTECTED]> --- diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index 4b8a8da..1329615 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -690,14 +690,12 @@ static int __init balanced_irq_init(void) physical_balance = 1; for_each_online_cpu(i) { - irq_cpu_data[i].irq_delta = kmalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL); - irq_cpu_data[i].last_irq = kmalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL); + irq_cpu_data[i].irq_delta = kzalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL); + irq_cpu_data[i].last_irq = kzalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL); if (irq_cpu_data[i].irq_delta == NULL || irq_cpu_data[i].last_irq == NULL) { printk(KERN_ERR "balanced_irq_init: out of memory"); goto failed; } - memset(irq_cpu_data[i].irq_delta,0,sizeof(unsigned long) * NR_IRQS); - memset(irq_cpu_data[i].last_irq,0,sizeof(unsigned long) * NR_IRQS); } printk(KERN_INFO "Starting balanced_irq\n"); thanks surya. - 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/
Drop patch update-isdn-tree-to-use-pci_get_device.patch from -mm tree
Hi Andrew, I would request you to drop the patch update-isdn-tree-to-use-pci_get_device.patch from the -mm tree since a new bug is been identified in that by jeff. thanks. surya. - 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/
Re: [PATCH 1/12] drivers/isdn/hisax/avm_pci.c: replace pci_find_device with pci_get_device
On Sun, 2007-07-15 at 03:40 -0400, Jeff Garzik wrote: > To be more clear, your solution is incorrect unless the pci_dev_put() > occurs after the last reference to hw.{elsa,diva,hfc,njet,...}.dev, > which is where the HiSax ISDN drivers store their reference to struct > pci_dev during the runtime life of the PCI device. > > Am I missing where your patch does this? It is really missing :-( > > By way of further interest, a few hours _before_ (yes, really) I saw > your patches, I resumed converting the ISDN HiSax PCI drivers to use the > PCI driver API. You can find this work in > git://git.kernel.org/.../jgarzik/misc-2.6.git#isdn-pci. > > If you fix your patches' lifetime problems, I will ACK them myself, > since my effort is a spare time effort. But just wanted you to be aware > that I am deep into the code you are fixing, and can at least speak > somewhat knowledgeably on the specific lines of code you are changing. I can see the bug. Thanks for updating me. I really missed the point that these whole set of drivers are a part of hisax.ko... most of the initialization is done in hisax/config.c Now are you suggesting that we should have a pci_dev_put in config.c where you have the module_exit. I am not sure where I can call the dev_put. consider hisax/avm_pci.c in which if we have a code like the below dev_avm = pci_get_device(PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1, dev_avm))) { dev_avm is getting initialized in this file static struct pci_dev *dev_avm __devinitdata = NULL; so can I do an extern static struct pci_dev *dev_avm; in the config.c and call pci_dev_put(dev_avm) in config.c file's module_exit or whereever there is an error return? > > Jeff > > > -surya. - 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/
updated sbpcd.c
Hi emoenke, Can this patch be verified and pulled into your tree. thanks. Surya. From: Jesper Juhl <[EMAIL PROTECTED]> To: Surya <[EMAIL PROTECTED]> Cc: , Linux Kernel , [EMAIL PROTECTED] Subject: Re: [PATCH]: check_region cleanup in sbpcd.c Date: Tue, 26 Jun 2007 01:07:41 +0200 On 12/06/07, Surya <[EMAIL PROTECTED]> wrote: [snip] > > > I am sending with all the corrections, if its ok to acknowledge it? > Looks good to me. > > Signed-off-by: Surya Prabhakar <[EMAIL PROTECTED]> Reviewed-by: Jesper Juhl <[EMAIL PROTECTED]> snip-- Signed-off-by: Surya Prabhakar <[EMAIL PROTECTED]> --- diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c index a1283b1..5414172 100644 --- a/drivers/cdrom/sbpcd.c +++ b/drivers/cdrom/sbpcd.c @@ -358,6 +358,9 @@ * Add bio/kdev_t changes for 2.5.x required to make it work again. * Still room for improvement in the request handling here if anyone * actually cares. Bring your own chainsaw.Paul G. 02/2002 + * + * Deprecated check_region cleanup to request_region + * -Surya Prabhakar N08/07/2007 */ @@ -555,6 +558,7 @@ static struct cdrom_read_audio read_audio; static unsigned char msgnum; static char msgbuf[80]; +static int addr[2] = {1, CDROM_PORT}; static int max_drives = MAX_DRIVES; module_param(max_drives, int, 0); #ifndef MODULE @@ -5638,7 +5642,6 @@ int __init sbpcd_init(void) #endif { int i=0, j=0; - int addr[2]={1, CDROM_PORT}; int port_index; sti(); @@ -5670,9 +5673,9 @@ int __init sbpcd_init(void) { addr[1]=sbpcd[port_index]; if (addr[1]==0) break; - if (check_region(addr[1],4)) + if (!request_region(addr[1],4, "sbpcd driver")) { - msg(DBG_INF,"check_region: %03X is not free.\n",addr[1]); + msg(DBG_INF,"request_region: %03X is not free.\n",addr[1]); continue; } if (sbpcd[port_index+1]==2) type=str_sp; @@ -5699,6 +5702,7 @@ int __init sbpcd_init(void) if (ndrives==0) { msg(DBG_INF, "No drive found.\n"); + release_region(addr[1],4); #ifdef MODULE return -EIO; #else @@ -5775,6 +5779,7 @@ int __init sbpcd_init(void) if (!request_region(CDo_command,4,major_name)) { printk(KERN_WARNING "sbpcd: Unable to request region 0x%x\n", CDo_command); + release_region(addr[1],4); return -EIO; } @@ -5788,6 +5793,8 @@ int __init sbpcd_init(void) #endif /* SOUND_BASE */ if (register_blkdev(MAJOR_NR, major_name)) { + release_region(CDo_command,4); + release_region(addr[1],4); #ifdef MODULE return -EIO; #else @@ -5801,6 +5808,7 @@ int __init sbpcd_init(void) sbpcd_queue = blk_init_queue(do_sbpcd_request, &sbpcd_lock); if (!sbpcd_queue) { release_region(CDo_command,4); + release_region(addr[1],4); unregister_blkdev(MAJOR_NR, major_name); return -ENOMEM; } @@ -5834,6 +5842,7 @@ int __init sbpcd_init(void) printk("Can't unregister %s\n", major_name); } release_region(CDo_command,4); + release_region(addr[1],4); blk_cleanup_queue(sbpcd_queue); return -EIO; } @@ -5850,6 +5859,7 @@ int __init sbpcd_init(void) if (sbpcd_infop == NULL) { release_region(CDo_command,4); + release_region(addr[1],4); blk_cleanup_queue(sbpcd_queue); return -ENOMEM; } @@ -5894,6 +5904,7 @@ static void sbpcd_exit(void) return; } release_region(CDo_command,4); + release_region(addr[1],4); blk_cleanup_queue(sbpcd_queue); for (j=0;jhttp://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/