lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 2 Mar 2015 20:50:20 -0600
From:	Bjorn Helgaas <bhelgaas@...gle.com>
To:	Yijing Wang <wangyijing@...wei.com>
Cc:	Jiang Liu <jiang.liu@...ux.intel.com>, linux-pci@...r.kernel.org,
	Yinghai Lu <yinghai@...nel.org>, linux-kernel@...r.kernel.org,
	Marc Zyngier <marc.zyngier@....com>,
	linux-arm-kernel@...ts.infradead.org,
	Russell King <linux@....linux.org.uk>, x86@...nel.org,
	Thomas Gleixner <tglx@...utronix.de>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Tony Luck <tony.luck@...el.com>, linux-ia64@...r.kernel.org,
	"David S. Miller" <davem@...emloft.net>,
	Guan Xuetao <gxt@...c.pku.edu.cn>, linux-alpha@...r.kernel.org,
	linux-m68k@...ts.linux-m68k.org, Liviu Dudau <liviu@...au.co.uk>,
	Arnd Bergmann <arnd@...db.de>,
	Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: Re: [PATCH v4 12/30] PCI: Introduce pci_host_bridge_ops to support
 host specific operations

On Thu, Feb 26, 2015 at 04:12:06PM +0800, Yijing Wang wrote:
> Now we have weak functions like pcibios_root_bridge_prepare()
> to setup pci host bridge, We could introduce pci_host_bridge_ops
> which contain host bridge specific ops to setup pci_host_bridge.
> Then host bridge driver could add pci_host_bridge_ops hooks
> intead of weak function to setup pci_host_bridge.
> This patch add following pci_host_bridge_ops hooks:
> 
> pci_host_bridge_ops {
> 	/* set root bus speed, some platform need this like powerpc */
> 	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
> 	/* setup pci_host_bridge before pci_host_bridge be added to driver core */
> 	int (*phb_prepare)(struct pci_host_bridge *host);
> 	/* platform specific of scan hook to scan pci device */
> 	void (*phb_of_scan_bus)(struct pci_host_bridge *);
> }
> We could easily extend it to support different host bridge
> specific operations.
> 
> Signed-off-by: Yijing Wang <wangyijing@...wei.com>
> ---
>  drivers/pci/host-bridge.c |   12 ++++++++++--
>  drivers/pci/probe.c       |   17 +++++++++++------
>  include/linux/pci.h       |   12 ++++++++++--
>  3 files changed, 31 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
> index b42a4bb..4a2baa2 100644
> --- a/drivers/pci/host-bridge.c
> +++ b/drivers/pci/host-bridge.c
> @@ -23,8 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
>  }
>  
>  struct pci_host_bridge *pci_create_host_bridge(
> -		struct device *parent, u32 db, 
> -		struct list_head *resources, void *sysdata)
> +		struct device *parent, u32 db, struct list_head *resources, 
> +		void *sysdata, struct pci_host_bridge_ops *ops)
>  {
>  	int error;
>  	int bus = PCI_BUSNUM(db);
> @@ -56,6 +56,7 @@ struct pci_host_bridge *pci_create_host_bridge(
>  		}
>  	mutex_unlock(&phb_mutex);
>  
> +	host->ops = ops;
>  	host->dev.parent = parent;
>  	INIT_LIST_HEAD(&host->windows);
>  	host->dev.release = pci_release_host_bridge_dev;
> @@ -63,6 +64,13 @@ struct pci_host_bridge *pci_create_host_bridge(
>  	dev_set_name(&host->dev, "pci%04x:%02x", host->domain, 
>  			host->busnum);
>  
> +	if (host->ops && host->ops->phb_prepare) {
> +		error = host->ops->phb_prepare(host);
> +		if(error) {

Whitespace error.

> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -400,6 +400,13 @@ static inline int pci_channel_offline(struct pci_dev *pdev)
>  	return (pdev->error_state != pci_channel_io_normal);
>  }
>  
> +struct pci_host_bridge;
> +struct pci_host_bridge_ops {
> +	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
> +	int (*phb_prepare)(struct pci_host_bridge *host);
> +	void (*phb_of_scan_bus)(struct pci_host_bridge *);

These function pointers don't need a "phb_" prefix.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ