Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1296674

Re: [PATCH 1/2] PCI: generic: Refactor code to enable reuse by other drivers.

From Will Deacon <will.deacon@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] PCI: generic: Refactor code to enable reuse by other drivers.
Date 2015-12-22 11:10 +0100
Message-ID <qIs3h-2zy-11@gated-at.bofh.it> (permalink)
References <qIkp4-5Ra-5@gated-at.bofh.it> <qIkp4-5Ra-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] pci: Add host controller driver for Cavium ThunderX PCIe David Daney <ddaney.cavm@gmail.com> - 2015-12-22 03:00 +0100
  [PATCH 1/2] PCI: generic: Refactor code to enable reuse by other drivers. David Daney <ddaney.cavm@gmail.com> - 2015-12-22 03:00 +0100
    Re: [PATCH 1/2] PCI: generic: Refactor code to enable reuse by other  drivers. Will Deacon <will.deacon@arm.com> - 2015-12-22 11:10 +0100
      Re: [PATCH 1/2] PCI: generic: Refactor code to enable reuse by other drivers. Arnd Bergmann <arnd@arndb.de> - 2015-12-22 22:20 +0100
  [PATCH 2/2] pci, pcie-thunder-pem: Add PCIe host driver for ThunderX processors. David Daney <ddaney.cavm@gmail.com> - 2015-12-22 03:00 +0100
    Re: [PATCH 2/2] pci, pcie-thunder-pem: Add PCIe host driver for  ThunderX processors. Will Deacon <will.deacon@arm.com> - 2015-12-22 11:10 +0100
      Re: [PATCH 2/2] pci, pcie-thunder-pem: Add PCIe host driver for ThunderX  processors. David Daney <ddaney@caviumnetworks.com> - 2015-12-23 00:30 +0100
    Re: [PATCH 2/2] pci, pcie-thunder-pem: Add PCIe host driver for  ThunderX processors. Rob Herring <robh@kernel.org> - 2015-12-23 01:50 +0100

csiph-web