diff options
author | Jiri Slaby | 2021-06-18 08:14:52 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2021-06-18 13:10:01 +0200 |
commit | 7f0e79dc09692357ecd9bb7b9674352b74e0ffad (patch) | |
tree | 2af6f8a487b99735962fe3a3ea91f8538c4898bc /drivers/tty | |
parent | dcb04e21bba349875c97467062a0d5cb06f7524d (diff) |
mxser: move request irq to probe and switch to managed
Move request_irq from mxser_initbrd to mxser_probe so that we can switch
it to managed request. It simplifies the cleanup code.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210618061516.662-47-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/mxser.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index be58ee025180..83c795acdb19 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1883,11 +1883,10 @@ static const struct tty_port_operations mxser_port_ops = { * The MOXA Smartio/Industio serial driver boot-time initialization code! */ -static int mxser_initbrd(struct mxser_board *brd) +static void mxser_initbrd(struct mxser_board *brd) { struct mxser_port *info; unsigned int i; - int retval; bool is_mu860; brd->must_hwid = mxser_must_get_hwid(brd->ports[0].ioaddr); @@ -1939,18 +1938,6 @@ static int mxser_initbrd(struct mxser_board *brd) outb(inb(info->ioaddr + UART_IER) & 0xf0, info->ioaddr + UART_IER); } - - retval = request_irq(brd->irq, mxser_interrupt, IRQF_SHARED, "mxser", - brd); - if (retval) { - for (i = 0; i < brd->info->nports; i++) - tty_port_destroy(&brd->ports[i].port); - printk(KERN_ERR "Board %s: Request irq failed, IRQ (%d) may " - "conflict with another device.\n", - brd->info->name, brd->irq); - } - - return retval; } static int mxser_probe(struct pci_dev *pdev, @@ -2004,10 +1991,14 @@ static int mxser_probe(struct pci_dev *pdev, /* irq */ brd->irq = pdev->irq; - /* mxser_initbrd will hook ISR. */ - retval = mxser_initbrd(brd); - if (retval) - goto err_zero; + mxser_initbrd(brd); + + retval = devm_request_irq(&pdev->dev, brd->irq, mxser_interrupt, + IRQF_SHARED, "mxser", brd); + if (retval) { + dev_err(&pdev->dev, "request irq failed"); + goto err_relbrd; + } for (i = 0; i < brd->info->nports; i++) { tty_dev = tty_port_register_device(&brd->ports[i].port, @@ -2027,7 +2018,6 @@ static int mxser_probe(struct pci_dev *pdev, err_relbrd: for (i = 0; i < brd->info->nports; i++) tty_port_destroy(&brd->ports[i].port); - free_irq(brd->irq, brd); err_zero: brd->info = NULL; err: @@ -2044,8 +2034,6 @@ static void mxser_remove(struct pci_dev *pdev) tty_port_destroy(&brd->ports[i].port); } - free_irq(brd->irq, brd); - brd->info = NULL; } |