mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Graeme Gregory <graeme.gregory@linaro.org>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org, shannon.zhao@linaro.org,
	Len Brown <lenb@kernel.org>,
	Russell King <linux@arm.linux.org.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 3/3] serial: amba-pl011: add ACPI support to AMBA probe
Date: Tue, 01 Dec 2015 03:21:47 +0100	[thread overview]
Message-ID: <14968240.IklpWf8GZo@vostro.rjw.lan> (raw)
In-Reply-To: <1443609530-21524-4-git-send-email-graeme.gregory@linaro.org>

On Wednesday, September 30, 2015 11:38:50 AM Graeme Gregory wrote:
> In ACPI this device is only defined in SBSA mode so
> if we are probing from ACPI use this mode.
> 
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Len Brown <lenb@kernel.org>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> ---
>  drivers/tty/serial/amba-pl011.c | 32 +++++++++++++++++++++-----------
>  1 file changed, 21 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index fd27e98..55209aa 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -2368,18 +2368,28 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
>  	if (!uap)
>  		return -ENOMEM;
>  
> -	uap->clk = devm_clk_get(&dev->dev, NULL);
> -	if (IS_ERR(uap->clk))
> -		return PTR_ERR(uap->clk);
> -
> -	uap->vendor = vendor;
> -	uap->lcrh_rx = vendor->lcrh_rx;
> -	uap->lcrh_tx = vendor->lcrh_tx;
> -	uap->fifosize = vendor->get_fifosize(dev);
> +	/* ACPI only defines SBSA variant */
> +	if (!ACPI_COMPANION(&dev->dev)) {

It would read more straightforward if you did

	if (ACPI_COMPANION(&dev->dev)) {
		<handle the ACPI case>
	} else {
		<handle the non-ACPI case>
	}

> +		uap->clk = devm_clk_get(&dev->dev, NULL);
> +		if (IS_ERR(uap->clk))
> +			return PTR_ERR(uap->clk);
> +
> +		uap->vendor = vendor;
> +		uap->lcrh_rx = vendor->lcrh_rx;
> +		uap->lcrh_tx = vendor->lcrh_tx;
> +		uap->fifosize = vendor->get_fifosize(dev);
> +		uap->port.ops = &amba_pl011_pops;
> +		snprintf(uap->type, sizeof(uap->type), "PL011 rev%u",
> +				amba_rev(dev));
> +	 } else {
> +		uap->vendor	= &vendor_sbsa;
> +		uap->fifosize	= 32;
> +		uap->port.ops	= &sbsa_uart_pops;
> +		uap->fixed_baud = 115200;
> +
> +		snprintf(uap->type, sizeof(uap->type), "SBSA");

This looks sort of heavy-handed.

Is this the only possible configuration of the device in the ACPI case?

> +	}
>  	uap->port.irq = dev->irq[0];
> -	uap->port.ops = &amba_pl011_pops;
> -
> -	snprintf(uap->type, sizeof(uap->type), "PL011 rev%u", amba_rev(dev));
>  
>  	ret = pl011_setup_port(&dev->dev, uap, &dev->res, portnr);
>  	if (ret)

Thanks,
Rafael


  reply	other threads:[~2015-12-01  1:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 10:38 [PATCH 0/3] Add AMBA bus probing support to ACPI Graeme Gregory
2015-09-30 10:38 ` [PATCH 1/3] ACPI: amba bus probing support Graeme Gregory
2015-09-30 10:38 ` [PATCH 2/3] ACPI: scan add call to probe amba devices Graeme Gregory
2015-12-01  2:16   ` Rafael J. Wysocki
2015-12-01 12:16     ` Graeme Gregory
2015-09-30 10:38 ` [PATCH 3/3] serial: amba-pl011: add ACPI support to AMBA probe Graeme Gregory
2015-12-01  2:21   ` Rafael J. Wysocki [this message]
2015-12-01 12:21     ` Graeme Gregory
2015-12-02  1:25       ` Rafael J. Wysocki
2015-12-03 20:06   ` Timur Tabi
2015-10-21 16:41 ` [PATCH 0/3] Add AMBA bus probing support to ACPI Al Stone
2015-10-21 22:29   ` Rafael J. Wysocki
2015-10-22 17:04     ` Al Stone
2015-10-29 14:47 ` Shannon Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14968240.IklpWf8GZo@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=graeme.gregory@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=shannon.zhao@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®