Patchwork [GIT,PULL] Fixes/cleanup for vt8500 serial driver

login
register
mail settings
Submitter Tony Prisk
Date Jan. 14, 2013, 2:04 a.m.
Message ID <1358129060-9399-1-git-send-email-linux@prisktech.co.nz>
Download mbox
Permalink /patch/211697/
State New
Headers show

Pull-request

git://server.prisktech.co.nz/git/linuxwmt.git tags/vt8500-serial-fixes

Comments

Tony Prisk - Jan. 14, 2013, 2:04 a.m.
Hi Greg,

This is a series of fixes/cleanup for the vt8500 serial/uart driver.

I'm not sure how you want to handle these.

Arguably #1, #2 and #3 are bug fixes which could go into 3.8. None of
them cause immediate problems, but potentially could.

#4 is definately a cleanup for 3.9.

Let me know if you would rather I split them up and how.

Regards
Tony P


The following changes since commit 9931faca02c604c22335f5a935a501bb2ace6e20:

  Linux 3.8-rc3 (2013-01-09 18:59:55 -0800)

are available in the git repository at:

  git://server.prisktech.co.nz/git/linuxwmt.git tags/vt8500-serial-fixes

for you to fetch changes up to 55df4e19676ca7674bcdc5831036ed3f708050e8:

  serial: tty: Cleanup code using devm_ function (2013-01-14 05:39:17 +1300)

----------------------------------------------------------------
Series of fixes/cleanups for vt8500 serial/UART driver.

----------------------------------------------------------------
Tony Prisk (4):
      serial: vt8500: Fix range-checking on vt8500_uart_ports
      serial: vt8500: ioremap'd resource is never freed
      serial: vt8500: UART uses gated clock rather than 24Mhz reference
      serial: tty: Cleanup code using devm_ function

 arch/arm/boot/dts/vt8500.dtsi      |   40 +++++++++++++++++++++---
 arch/arm/boot/dts/wm8505.dtsi      |   60 ++++++++++++++++++++++++++++++++----
 arch/arm/boot/dts/wm8650.dtsi      |   20 ++++++++++--
 drivers/tty/serial/vt8500_serial.c |   38 +++++++++++------------
 4 files changed, 126 insertions(+), 32 deletions(-)
Russell King - ARM Linux - Jan. 14, 2013, 9:20 a.m.
On Mon, Jan 14, 2013 at 03:04:18PM +1300, Tony Prisk wrote:
> -	if (vt8500_port->clk) {
> -		vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk);
> -	} else {
> -		/* use the default of 24Mhz if not specified and warn */
> -		pr_warn("%s: serial clock source not specified\n", __func__);
> -		vt8500_port->uart.uartclk = 24000000;
> +	if (IS_ERR(vt8500_port->clk)) {
> +		dev_err(&pdev->dev, "failed to get clock\n");
> +		ret = -EINVAL;
> +		goto err;
> +	}
> +
> +	ret = clk_prepare_enable(vt8500_port->clk);
> +	if (ret) {
> +		dev_err(&pdev->dev, "failed to enable clock\n");
> +		goto err;

Looks like you get rid of the initialization of vt8500_port->uart.uartclk
here.  Was that intentional?
Sergei Shtylyov - Jan. 14, 2013, 1:37 p.m.
Hello.

On 14-01-2013 6:04, Tony Prisk wrote:

> Memory mapped via ioremap call is never released. Rather than add an
> iounmap call, change allocation function to devm_request_and_ioremap.

> Also, change the error on failure for this call to -EBUSY rather than
> -ENOMEM.

    Not really well justified. See below.

> Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
> ---
>   drivers/tty/serial/vt8500_serial.c |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

> diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
> index 4c4a58d..8865afd 100644
> --- a/drivers/tty/serial/vt8500_serial.c
> +++ b/drivers/tty/serial/vt8500_serial.c
> @@ -615,9 +615,9 @@ static int vt8500_serial_probe(struct platform_device *pdev)
>   	snprintf(vt8500_port->name, sizeof(vt8500_port->name),
>   		 "VT8500 UART%d", pdev->id);
>
> -	vt8500_port->uart.membase = ioremap(mmres->start, resource_size(mmres));
> +	vt8500_port->uart.membase = devm_request_and_ioremap(&pdev->dev, mmres);
>   	if (!vt8500_port->uart.membase) {
> -		ret = -ENOMEM;
> +		ret = -EBUSY;

    According to the comment to devm_request_and_ioremap(), the recommended 
return code on its failure -EADDRNOTAVAIL.

WBR, Sergei