Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213497
b: refs/heads/master
c: df48051
h: refs/heads/master
i:
  213495: 78ea619
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Oct 22, 2010
1 parent aa9819a commit 0ba8d76
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 24b4b67d17c308aaa956b73ab1e88190f6642bbe
refs/heads/master: df480518a688f0d28f7e7de69abe6a441d1c2c64
47 changes: 22 additions & 25 deletions trunk/drivers/char/mxser.c
Original file line number Diff line number Diff line change
Expand Up @@ -2339,20 +2339,11 @@ struct tty_port_operations mxser_port_ops = {
* The MOXA Smartio/Industio serial driver boot-time initialization code!
*/

static void mxser_release_res(struct mxser_board *brd, struct pci_dev *pdev,
unsigned int irq)
static void mxser_release_ISA_res(struct mxser_board *brd)
{
if (irq)
free_irq(brd->irq, brd);
if (pdev != NULL) { /* PCI */
#ifdef CONFIG_PCI
pci_release_region(pdev, 2);
pci_release_region(pdev, 3);
#endif
} else {
release_region(brd->ports[0].ioaddr, 8 * brd->info->nports);
release_region(brd->vector, 1);
}
free_irq(brd->irq, brd);
release_region(brd->ports[0].ioaddr, 8 * brd->info->nports);
release_region(brd->vector, 1);
}

static int __devinit mxser_initbrd(struct mxser_board *brd,
Expand Down Expand Up @@ -2397,13 +2388,11 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,

retval = request_irq(brd->irq, mxser_interrupt, IRQF_SHARED, "mxser",
brd);
if (retval) {
if (retval)
printk(KERN_ERR "Board %s: Request irq failed, IRQ (%d) may "
"conflict with another device.\n",
brd->info->name, brd->irq);
/* We hold resources, we need to release them. */
mxser_release_res(brd, pdev, 0);
}

return retval;
}

Expand Down Expand Up @@ -2555,7 +2544,7 @@ static int __devinit mxser_probe(struct pci_dev *pdev,
ioaddress = pci_resource_start(pdev, 2);
retval = pci_request_region(pdev, 2, "mxser(IO)");
if (retval)
goto err;
goto err_dis;

brd->info = &mxser_cards[ent->driver_data];
for (i = 0; i < brd->info->nports; i++)
Expand All @@ -2565,7 +2554,7 @@ static int __devinit mxser_probe(struct pci_dev *pdev,
ioaddress = pci_resource_start(pdev, 3);
retval = pci_request_region(pdev, 3, "mxser(vector)");
if (retval)
goto err_relio;
goto err_zero;
brd->vector = ioaddress;

/* irq */
Expand Down Expand Up @@ -2608,18 +2597,21 @@ static int __devinit mxser_probe(struct pci_dev *pdev,
/* mxser_initbrd will hook ISR. */
retval = mxser_initbrd(brd, pdev);
if (retval)
goto err_null;
goto err_rel3;

for (i = 0; i < brd->info->nports; i++)
tty_register_device(mxvar_sdriver, brd->idx + i, &pdev->dev);

pci_set_drvdata(pdev, brd);

return 0;
err_relio:
pci_release_region(pdev, 2);
err_null:
err_rel3:
pci_release_region(pdev, 3);
err_zero:
brd->info = NULL;
pci_release_region(pdev, 2);
err_dis:
pci_disable_device(pdev);
err:
return retval;
#else
Expand All @@ -2629,14 +2621,19 @@ static int __devinit mxser_probe(struct pci_dev *pdev,

static void __devexit mxser_remove(struct pci_dev *pdev)
{
#ifdef CONFIG_PCI
struct mxser_board *brd = pci_get_drvdata(pdev);
unsigned int i;

for (i = 0; i < brd->info->nports; i++)
tty_unregister_device(mxvar_sdriver, brd->idx + i);

mxser_release_res(brd, pdev, 1);
free_irq(pdev->irq, brd);
pci_release_region(pdev, 2);
pci_release_region(pdev, 3);
pci_disable_device(pdev);
brd->info = NULL;
#endif
}

static struct pci_driver mxser_driver = {
Expand Down Expand Up @@ -2741,7 +2738,7 @@ static void __exit mxser_module_exit(void)

for (i = 0; i < MXSER_BOARDS; i++)
if (mxser_boards[i].info != NULL)
mxser_release_res(&mxser_boards[i], NULL, 1);
mxser_release_ISA_res(&mxser_boards[i]);
}

module_init(mxser_module_init);
Expand Down

0 comments on commit 0ba8d76

Please sign in to comment.