Re: [PATCH] PCI/pwrctrl: Skip creating platform device unless CONFIG_PCI_PWRCTL enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
> 
> 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




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux