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]
Message-ID: <aDDn94q9gS8SfK9_@wunner.de>
Date: Fri, 23 May 2025 23:26:15 +0200
From: Lukas Wunner <lukas@...ner.de>
To: Bjorn Helgaas <helgaas@...nel.org>
Cc: linux-pci@...r.kernel.org,
	Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
	Cyril Brulebois <kibi@...ian.org>,
	Nicolas Saenz Julienne <nsaenz@...nel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
	Krzysztof Wilczy??ski <kwilczynski@...nel.org>,
	Bartosz Golaszewski <brgl@...ev.pl>,
	Jim Quinlan <james.quinlan@...adcom.com>,
	bcm-kernel-feedback-list@...adcom.com, linux-kernel@...r.kernel.org,
	Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH] PCI/pwrctrl: Skip creating platform device unless
 CONFIG_PCI_PWRCTL enabled

On Fri, May 23, 2025 at 03:17:59PM -0500, Bjorn Helgaas wrote:
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -2510,6 +2510,7 @@ EXPORT_SYMBOL(pci_bus_read_dev_vendor_id);
>  
>  static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *bus, int devfn)
>  {
> +#if defined(CONFIG_PCI_PWRCTL) || defined(CONFIG_PCI_PWRCTL_MODULE)
>  	struct pci_host_bridge *host = pci_find_host_bridge(bus);
>  	struct platform_device *pdev;
>  	struct device_node *np;
> @@ -2536,6 +2537,9 @@ static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *bus, in
>  	}
>  
>  	return pdev;
> +#else
> +	return NULL;
> +#endif
>  }
[...]
> This an alternate to
> https://lore.kernel.org/r/20250522140326.93869-1-manivannan.sadhasivam@linaro.org
> 
> It should accomplish the same thing but I think using #ifdef makes it a
> little more visible and easier to see that pci_pwrctrl_create_device() is
> only relevant when CONFIG_PCI_PWRCTL is enabled.

Just noting though that section 21 of Documentation/process/coding-style.rst
discourages use of #ifdef and recommends IS_ENABLED() and inline stubs
instead.

Thanks,

Lukas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ