[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZSQREEr0WBk15fFJ@x1-carbon>
Date: Mon, 9 Oct 2023 14:41:25 +0000
From: Niklas Cassel <Niklas.Cassel@....com>
To: Rob Herring <robh@...nel.org>
CC: Damien Le Moal <dlemoal@...nel.org>,
"linux-ide@...r.kernel.org" <linux-ide@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ata: xgene: Use of_device_get_match_data()
On Fri, Oct 06, 2023 at 04:44:33PM -0500, Rob Herring wrote:
> Use preferred of_device_get_match_data() instead of of_match_device() to
> get the driver match data. With this, adjust the includes to explicitly
> include the correct headers.
>
> Signed-off-by: Rob Herring <robh@...nel.org>
> ---
> Perhaps device_get_match_data() could be used here and all the ACPI
> specific code dropped, but not sure if all the ACPI code is really
> necessary.
> ---
> drivers/ata/ahci_xgene.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
> index ccef5e63bdf9..81a1d838c0fc 100644
> --- a/drivers/ata/ahci_xgene.c
> +++ b/drivers/ata/ahci_xgene.c
> @@ -13,9 +13,7 @@
> #include <linux/module.h>
> #include <linux/platform_device.h>
> #include <linux/ahci_platform.h>
> -#include <linux/of_address.h>
> -#include <linux/of_device.h>
> -#include <linux/of_irq.h>
> +#include <linux/of.h>
> #include <linux/phy/phy.h>
> #include "ahci.h"
>
> @@ -735,7 +733,6 @@ static int xgene_ahci_probe(struct platform_device *pdev)
> struct ahci_host_priv *hpriv;
> struct xgene_ahci_context *ctx;
> struct resource *res;
> - const struct of_device_id *of_devid;
> enum xgene_ahci_version version = XGENE_AHCI_V1;
> const struct ata_port_info *ppi[] = { &xgene_ahci_v1_port_info,
> &xgene_ahci_v2_port_info };
> @@ -778,10 +775,8 @@ static int xgene_ahci_probe(struct platform_device *pdev)
> ctx->csr_mux = csr;
> }
>
> - of_devid = of_match_device(xgene_ahci_of_match, dev);
> - if (of_devid) {
> - if (of_devid->data)
> - version = (unsigned long) of_devid->data;
> + if (dev->of_node) {
> + version = (enum xgene_ahci_version)of_device_get_match_data(dev);
> }
Nit: braces can be removed.
> #ifdef CONFIG_ACPI
> else {
> --
> 2.40.1
>
With or without nit fixed:
Reviewed-by: Niklas Cassel <niklas.cassel@....com>
Powered by blists - more mailing lists