From: Will Deacon <will.deacon@arm.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
Marc Zyngier <marc.zyngier@arm.com>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
David Daney <david.daney@cavium.com>
Subject: Re: [PATCH 1/2] PCI: generic: Refactor code to enable reuse by other drivers.
Date: Tue, 22 Dec 2015 10:07:33 +0000 [thread overview]
Message-ID: <20151222100732.GD32623@arm.com> (raw)
In-Reply-To: <1450749222-15966-2-git-send-email-ddaney.cavm@gmail.com>
On Mon, Dec 21, 2015 at 05:53:41PM -0800, David Daney wrote:
> From: David Daney <david.daney@cavium.com>
>
> No change in functionality.
>
> Move structure definitions into a separate header file. Split probe
> function in to two parts:
>
> - a small driver specific probe function (gen_pci_probe)
>
> - a common probe that can be used by other drivers
> (gen_pci_common_probe)
>
> Signed-off-by: David Daney <david.daney@cavium.com>
> ---
> drivers/pci/host/pci-host-generic.c | 53 ++++++++++++-----------------------
> drivers/pci/host/pci-host-generic.h | 56 +++++++++++++++++++++++++++++++++++++
> 2 files changed, 74 insertions(+), 35 deletions(-)
> create mode 100644 drivers/pci/host/pci-host-generic.h
>
> diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c
> index 5434c90..e83cec7 100644
> --- a/drivers/pci/host/pci-host-generic.c
> +++ b/drivers/pci/host/pci-host-generic.c
> @@ -25,33 +25,7 @@
> #include <linux/of_pci.h>
> #include <linux/platform_device.h>
>
> -struct gen_pci_cfg_bus_ops {
> - u32 bus_shift;
> - struct pci_ops ops;
> -};
> -
> -struct gen_pci_cfg_windows {
> - struct resource res;
> - struct resource *bus_range;
> - void __iomem **win;
> -
> - struct gen_pci_cfg_bus_ops *ops;
> -};
> -
> -/*
> - * ARM pcibios functions expect the ARM struct pci_sys_data as the PCI
> - * sysdata. Add pci_sys_data as the first element in struct gen_pci so
> - * that when we use a gen_pci pointer as sysdata, it is also a pointer to
> - * a struct pci_sys_data.
> - */
> -struct gen_pci {
> -#ifdef CONFIG_ARM
> - struct pci_sys_data sys;
> -#endif
> - struct pci_host_bridge host;
> - struct gen_pci_cfg_windows cfg;
> - struct list_head resources;
> -};
> +#include "pci-host-generic.h"
>
> static void __iomem *gen_pci_map_cfg_bus_cam(struct pci_bus *bus,
> unsigned int devfn,
> @@ -208,19 +182,15 @@ static int gen_pci_parse_map_cfg_windows(struct gen_pci *pci)
> return 0;
> }
>
> -static int gen_pci_probe(struct platform_device *pdev)
> +int gen_pci_common_probe(struct platform_device *pdev,
> + struct gen_pci *pci)
Whilst I'm fine with this patch, I don't know how Bjorn will feel about
exposing this function outside of the generic host driver. We could avoid
it by turning things upside-down and having the generic driver probe
the other drivers by matching a compatible string with a probe function
pointer, but I'd be interested to see what others think.
Will
next prev parent reply other threads:[~2015-12-22 10:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-22 1:53 [PATCH 0/2] pci: Add host controller driver for Cavium ThunderX PCIe David Daney
2015-12-22 1:53 ` [PATCH 1/2] PCI: generic: Refactor code to enable reuse by other drivers David Daney
2015-12-22 10:07 ` Will Deacon [this message]
2015-12-22 18:29 ` David Daney
2015-12-22 21:13 ` Arnd Bergmann
2015-12-22 1:53 ` [PATCH 2/2] pci, pcie-thunder-pem: Add PCIe host driver for ThunderX processors David Daney
2015-12-22 10:03 ` Will Deacon
2015-12-22 19:18 ` David Daney
2015-12-22 23:28 ` David Daney
2015-12-23 0:43 ` Rob Herring
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=20151222100732.GD32623@arm.com \
--to=will.deacon@arm.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=david.daney@cavium.com \
--cc=ddaney.cavm@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.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;
as well as URLs for NNTP newsgroup(s).