From: Jiri Slaby Date: Fri, 18 Jun 2021 06:14:52 +0000 (+0200) Subject: mxser: move request irq to probe and switch to managed X-Git-Tag: v5.15~789^2~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f0e79dc09692357ecd9bb7b9674352b74e0ffad;p=platform%2Fkernel%2Flinux-starfive.git 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 Link: https://lore.kernel.org/r/20210618061516.662-47-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index be58ee0..83c795a 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; }