Message ID | 20231006214433.339688-1-robh@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp610735vqo; Fri, 6 Oct 2023 14:45:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHeu7UbCuJ9HqnZIdLS9L75oQEtjiwvee1yQfO0QrE7oNl+rmN8r47ZVSOSmdK8vFLsLxp0 X-Received: by 2002:a17:90b:38d2:b0:26d:fcd:89b3 with SMTP id nn18-20020a17090b38d200b0026d0fcd89b3mr9580447pjb.8.1696628700394; Fri, 06 Oct 2023 14:45:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696628700; cv=none; d=google.com; s=arc-20160816; b=00H6ebBlucBlhZrT3Av9URXd+8laNQ+MSdms7Gi0y4zp8a19qq6vCW9MYSW1MxrVci rr595LuNPboLJYlvbYBraf11pPBk5cyDDiMCYlHAnF2WfazssFCsIyOJ4HhOq+3FU93f vSP7E05V5bYLnv5WJajGpP6MhsrjANshAAP0NMR9Ad4Ppz0e1vD+NcxaHvDgFTCOwVGl OKyfrFkiTeVZEKJd4mrVWsBvUtoQlPZoXzFKHE1/EfBBsVOeitOdWzFIqH7v45munb1v ByVeGM9B2wTcZ3AuINxOnkMVenQX+/PgEGCXHiwEAOJC5rR9J0izHO7C+p4YUkzTeJTl Yi/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=rpLbG19r89ySc34NjkPDn+0aPHODOeJ8J8sXL576zm0=; fh=lZbB9LbWWa2L4HpLy3kO7Jx22ojiilYKpUDAhK0OcoA=; b=0b+EBh2HIRrU5TsuGUPBXVBd+q847mqaFGmPQ+vnbQxzaefG8/t39/HDGdpgU9a8tQ LcgqUK0iq9p9yDL5k7tq1x5YM5D3PWzQYBmITO0gNAQxfD190aS7WU3dAdaZbx+HnPbi TQIG2nAuUePbUdQvErCXYxE0vR9wZxWLOL6i/TiowSiMTZbTPQn9BVxDZMlO0Gn2a30m jMrBPtk6YWuLcb95G9Ll4XO9TWd6BHUi2So3HdW4mRhP48cr1roPli2CH4gD9dCpILvS cHWwSDH5kIKnBQeaxHWfRE2EupngB+lMnJE0GbW/BeH9DSEaVWlX8T5Jk1KqBpRTgqbg cY7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jYq+VfS3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id m9-20020a17090a414900b0024e4ace1a41si4332960pjg.183.2023.10.06.14.44.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 14:45:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jYq+VfS3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id EF41681AFD97; Fri, 6 Oct 2023 14:44:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233752AbjJFVor (ORCPT <rfc822;ezelljr.billy@gmail.com> + 18 others); Fri, 6 Oct 2023 17:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233714AbjJFVop (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Oct 2023 17:44:45 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC922DB; Fri, 6 Oct 2023 14:44:44 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7580C433C7; Fri, 6 Oct 2023 21:44:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696628684; bh=j6jeoiDnXWM/5Q7Gi01zs2uZBy0XxUNcurOM7FdoVAM=; h=From:To:Cc:Subject:Date:From; b=jYq+VfS3/DMO5bC4IGgNvqt8KM6g4g4McZgm98bSioUxP8aXXud0ST4iisuQQtTea OjLjgylHOsST1R8uPPdtGWOA3MbZDnnyrUmANNDM7Kfyw7gylfsbBVBUeNEe12q+Yz Z/g7x7LBrIktqtN9WM6zZviJJQ/ZmgkTaR3VNgLX01rVrX/cjFxQ3dpuCg7hHNw2pf 1aEv05NZrCFdM00PGGS4pzTVhPeMJgs/kE16RZloU0Ee/YavGN1Vg/oB1+z6neovCc OgwE11i+jVm6PgittK3pbvaVW1XvzRfNTMA6yD7XFiRVTwBNpjHqrpIRl7/E72cUKG 5vpBHC1Y/TRBQ== Received: (nullmailer pid 339820 invoked by uid 1000); Fri, 06 Oct 2023 21:44:37 -0000 From: Rob Herring <robh@kernel.org> To: Damien Le Moal <dlemoal@kernel.org> Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ata: xgene: Use of_device_get_match_data() Date: Fri, 6 Oct 2023 16:44:33 -0500 Message-Id: <20231006214433.339688-1-robh@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 06 Oct 2023 14:44:58 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779044136282357032 X-GMAIL-MSGID: 1779044136282357032 |
Series |
ata: xgene: Use of_device_get_match_data()
|
|
Commit Message
Rob Herring
Oct. 6, 2023, 9:44 p.m. UTC
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@kernel.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(-)
Comments
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@kernel.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@wdc.com>
On Mon, Oct 9, 2023 at 9:41 AM Niklas Cassel <Niklas.Cassel@wdc.com> wrote: > > 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@kernel.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 { Coding style says otherwise when the 'else' has braces. Rob
On Mon, Oct 09, 2023 at 10:19:54AM -0500, Rob Herring wrote: > On Mon, Oct 9, 2023 at 9:41 AM Niklas Cassel <Niklas.Cassel@wdc.com> wrote: > > > > 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@kernel.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 { > > Coding style says otherwise when the 'else' has braces. Hello Rob, I know what the coding style says when the 'else' has braces. I simply missed that there was an else with braces, since there was a closing brace on a line by itself. The coding style says that the closing brace should be on the same line as the 'else': https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces But I guess that isn't followed because of the #ifdef CONFIG_ACPI. I guess a better option would be to use if (IS_ENABLED(CONFIG_ACPI)) instead of #ifdef CONFIG_ACPI, but that is orthogonal to your change, so let's ignore my nit. I've given my R-b tag on the patch already. Kind regards, Niklas
On 10/7/23 06:44, 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@kernel.org> Applied to for-6.7. Thanks ! > --- > 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. Will have a look at that.
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); } #ifdef CONFIG_ACPI else {