Commit ba45f366 authored by William Stinson's avatar William Stinson Committed by Jeff Garzik

baycom_ser_fdx hamradio driver request_region janitor updates:

	1) remove call to check_region
	2) test result of request_region
	3) call release_region in case of driver intialisation error later on
 
parent 6b70b7d4
...@@ -417,21 +417,27 @@ static int ser12_open(struct net_device *dev) ...@@ -417,21 +417,27 @@ static int ser12_open(struct net_device *dev)
return -ENXIO; return -ENXIO;
if (bc->baud < 300 || bc->baud > 4800) if (bc->baud < 300 || bc->baud > 4800)
return -EINVAL; return -EINVAL;
if (check_region(dev->base_addr, SER12_EXTENT)) if (!request_region(dev->base_addr, SER12_EXTENT, "baycom_ser_fdx")) {
printk(KERN_WARNING "BAYCOM_SER_FSX: I/O port 0x%04lx busy \n",
dev->base_addr);
return -EACCES; return -EACCES;
}
memset(&bc->modem, 0, sizeof(bc->modem)); memset(&bc->modem, 0, sizeof(bc->modem));
bc->hdrv.par.bitrate = bc->baud; bc->hdrv.par.bitrate = bc->baud;
bc->baud_us = 1000000/bc->baud; bc->baud_us = 1000000/bc->baud;
bc->baud_uartdiv = (115200/8)/bc->baud; bc->baud_uartdiv = (115200/8)/bc->baud;
if ((u = ser12_check_uart(dev->base_addr)) == c_uart_unknown) if ((u = ser12_check_uart(dev->base_addr)) == c_uart_unknown){
release_region(dev->base_addr, SER12_EXTENT);
return -EIO; return -EIO;
}
outb(0, FCR(dev->base_addr)); /* disable FIFOs */ outb(0, FCR(dev->base_addr)); /* disable FIFOs */
outb(0x0d, MCR(dev->base_addr)); outb(0x0d, MCR(dev->base_addr));
outb(0, IER(dev->base_addr)); outb(0, IER(dev->base_addr));
if (request_irq(dev->irq, ser12_interrupt, SA_INTERRUPT | SA_SHIRQ, if (request_irq(dev->irq, ser12_interrupt, SA_INTERRUPT | SA_SHIRQ,
"baycom_ser_fdx", dev)) "baycom_ser_fdx", dev)) {
release_region(dev->base_addr, SER12_EXTENT);
return -EBUSY; return -EBUSY;
request_region(dev->base_addr, SER12_EXTENT, "baycom_ser_fdx"); }
/* /*
* set the SIO to 6 Bits/character; during receive, * set the SIO to 6 Bits/character; during receive,
* the baud rate is set to produce 100 ints/sec * the baud rate is set to produce 100 ints/sec
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment