All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 1/4] bus: hisi_lpc: Don't dereference fwnode handle
Date: Tue, 5 Jul 2022 16:02:19 +0100	[thread overview]
Message-ID: <ee6b33f5-c5c0-658e-8cf9-61031cd27dca@huawei.com> (raw)
In-Reply-To: <20220705114312.86164-1-andriy.shevchenko@linux.intel.com>

On 05/07/2022 12:43, Andy Shevchenko wrote:
> Use dev_fwnode() and acpi_fwnode_handle() instead of dereferencing
> an fwnode handle directly.

...which is a better coding practice, right? If so, it would be nice to 
mention it - well at least I think so.

> 
> While at it, reuse fwnode instead of ACPI_COMPANION().

Apart from above and nit, below:
Acked-by: John Garry <john.garry@huawei.com>

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/bus/hisi_lpc.c | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c
> index 2e564803e786..6d432a07cbba 100644
> --- a/drivers/bus/hisi_lpc.c
> +++ b/drivers/bus/hisi_lpc.c
> @@ -347,7 +347,7 @@ static int hisi_lpc_acpi_xlat_io_res(struct acpi_device *adev,
>   	unsigned long sys_port;
>   	resource_size_t len = resource_size(res);
>   
> -	sys_port = logic_pio_trans_hwaddr(&host->fwnode, res->start, len);
> +	sys_port = logic_pio_trans_hwaddr(acpi_fwnode_handle(host), res->start, len);

nit: currently the driver keeps to the old 80 character line limit. 
While the rules may have been relaxed, I'd rather we still maintain it.

>   	if (sys_port == ~0UL)
>   		return -EFAULT;
>   
> @@ -615,7 +615,6 @@ static void hisi_lpc_acpi_remove(struct device *hostdev)
>   static int hisi_lpc_probe(struct platform_device *pdev)
>   {
>   	struct device *dev = &pdev->dev;
> -	struct acpi_device *acpi_device = ACPI_COMPANION(dev);
>   	struct logic_pio_hwaddr *range;
>   	struct hisi_lpc_dev *lpcdev;
>   	resource_size_t io_end;
> @@ -637,7 +636,7 @@ static int hisi_lpc_probe(struct platform_device *pdev)
>   	if (!range)
>   		return -ENOMEM;
>   
> -	range->fwnode = dev->fwnode;
> +	range->fwnode = dev_fwnode(dev);
>   	range->flags = LOGIC_PIO_INDIRECT;
>   	range->size = PIO_INDIRECT_SIZE;
>   	range->hostdata = lpcdev;
> @@ -651,7 +650,7 @@ static int hisi_lpc_probe(struct platform_device *pdev)
>   	}
>   
>   	/* register the LPC host PIO resources */
> -	if (acpi_device)
> +	if (is_acpi_device_node(range->fwnode))
>   		ret = hisi_lpc_acpi_probe(dev);
>   	else
>   		ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
> @@ -672,11 +671,10 @@ static int hisi_lpc_probe(struct platform_device *pdev)
>   static int hisi_lpc_remove(struct platform_device *pdev)
>   {
>   	struct device *dev = &pdev->dev;
> -	struct acpi_device *acpi_device = ACPI_COMPANION(dev);
>   	struct hisi_lpc_dev *lpcdev = dev_get_drvdata(dev);
>   	struct logic_pio_hwaddr *range = lpcdev->io_host;
>   
> -	if (acpi_device)
> +	if (is_acpi_device_node(range->fwnode))
>   		hisi_lpc_acpi_remove(dev);
>   	else
>   		of_platform_depopulate(dev);


  parent reply	other threads:[~2022-07-05 15:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05 11:43 [PATCH v1 1/4] bus: hisi_lpc: Don't dereference fwnode handle Andy Shevchenko
2022-07-05 11:43 ` [PATCH v1 2/4] bus: hisi_lpc: Use devm_platform_ioremap_resource Andy Shevchenko
2022-07-05 14:38   ` Rafael J. Wysocki
2022-07-05 14:41   ` John Garry
2022-07-05 11:43 ` [PATCH v1 3/4] bus: hisi_lpc: Correct error code for timeout Andy Shevchenko
2022-07-05 14:39   ` Rafael J. Wysocki
2022-07-05 14:53   ` John Garry
2022-07-05 11:43 ` [PATCH v1 4/4] bus: hisi_lpc: Don't guard ACPI IDs with ACPI_PTR() Andy Shevchenko
2022-07-05 14:22   ` Rafael J. Wysocki
2022-07-05 14:51   ` John Garry
2022-07-05 15:15     ` Andy Shevchenko
2022-07-05 15:27       ` John Garry
2022-07-05 15:33         ` Andy Shevchenko
2022-07-05 14:17 ` [PATCH v1 1/4] bus: hisi_lpc: Don't dereference fwnode handle Rafael J. Wysocki
2022-07-05 15:02 ` John Garry [this message]
2022-07-05 15:23   ` Andy Shevchenko
2022-07-05 15:38     ` John Garry

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=ee6b33f5-c5c0-658e-8cf9-61031cd27dca@huawei.com \
    --to=john.garry@huawei.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.