[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vf1F_WQxNRiya=aTqFTEGWDVrD9JTr1VB4pOW0RayDmoA@mail.gmail.com>
Date: Fri, 15 Mar 2019 11:08:01 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: "Enrico Weigelt, metux IT consult" <info@...ux.net>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Eric Anholt <eric@...olt.net>,
Stefan Wahren <stefan.wahren@...e.com>,
Florian Fainelli <f.fainelli@...il.com>,
Ray Jui <rjui@...adcom.com>,
Scott Branden <sbranden@...adcom.com>,
bcm-kernel-feedback-list <bcm-kernel-feedback-list@...adcom.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Vladimir Zapolskiy <vz@...ia.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Tobias Klauser <tklauser@...tanz.ch>,
Richard Genoud <richard.genoud@...il.com>,
macro@...ux-mips.org,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Sascha Hauer <kernel@...gutronix.de>, slemieux.tyco@...il.com,
Andy Gross <andy.gross@...aro.org>,
David Brown <david.brown@...aro.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
dl-linux-imx <linux-imx@....com>, baohua@...nel.org,
Peter Korsgaard <jacmet@...site.dk>,
"open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
linux-arm-msm@...r.kernel.org,
"open list:LINUX FOR POWERPC PA SEMI PWRFICIENT"
<linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH v2 45/45] drivers: tty: serial: mux: use devm_* functions
On Fri, Mar 15, 2019 at 12:37 AM Enrico Weigelt, metux IT consult
<info@...ux.net> wrote:
>
> Use the safer devm versions of memory mapping functions.
If you are going to use devm_*_free(), what's the point to have this
change from the beginning?
P.S. Disregard that this is untested series...
> --- a/drivers/tty/serial/mux.c
> +++ b/drivers/tty/serial/mux.c
> @@ -456,8 +456,9 @@ static int __init mux_probe(struct parisc_device *dev)
> printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.6\n", port_count);
>
> dev_set_drvdata(&dev->dev, (void *)(long)port_count);
> - request_mem_region(dev->hpa.start + MUX_OFFSET,
> - port_count * MUX_LINE_OFFSET, "Mux");
> + devm_request_mem_region(&dev->dev,
> + dev->hpa.start + MUX_OFFSET,
> + port_count * MUX_LINE_OFFSET, "Mux");
...and on top of this where is error checking?
>
> if(!port_cnt) {
> mux_driver.cons = MUX_CONSOLE;
> @@ -474,7 +475,9 @@ static int __init mux_probe(struct parisc_device *dev)
> port->iobase = 0;
> port->mapbase = dev->hpa.start + MUX_OFFSET +
> (i * MUX_LINE_OFFSET);
> - port->membase = ioremap_nocache(port->mapbase, MUX_LINE_OFFSET);
> + port->membase = devm_ioremap_nocache(port->dev,
> + port->mapbase,
> + MUX_LINE_OFFSET);
> port->iotype = UPIO_MEM;
> port->type = PORT_MUX;
> port->irq = 0;
> @@ -517,10 +520,12 @@ static int __exit mux_remove(struct parisc_device *dev)
>
> uart_remove_one_port(&mux_driver, port);
> if(port->membase)
> - iounmap(port->membase);
> + devm_iounmap(port->dev, port->membase);
> }
>
> - release_mem_region(dev->hpa.start + MUX_OFFSET, port_count * MUX_LINE_OFFSET);
> + devm_release_mem_region(&dev->dev,
> + dev->hpa.start + MUX_OFFSET,
> + port_count * MUX_LINE_OFFSET);
> return 0;
> }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists