Subject: Re: linux-next: Tree for June 17 (pci/slot)

From: Randy Dunlap <[email-masked]>
Date: Thu, 18 Jun 2009 08:14:37 -0700

Alex Chiang wrote:
> * Alex Chiang <[email-masked]>:
>> diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
>> index ba6af16..0be4efd 100644
>> --- a/drivers/pci/Makefile
>> +++ b/drivers/pci/Makefile
>> @@ -2,10 +2,11 @@
>>  # Makefile for the PCI bus specific drivers.
>>  #
>>  
>> -obj-y		+= access.o bus.o probe.o remove.o pci.o quirks.o slot.o \
>> -			pci-driver.o search.o pci-sysfs.o rom.o setup-res.o \
>> +obj-y		+= access.o bus.o probe.o remove.o pci.o quirks.o \
>> +			pci-driver.o search.o rom.o setup-res.o \
>>  			irq.o
>>  obj-$(CONFIG_PROC_FS) += proc.o
>> +obj-$(CONFIG_SYSFS) += slot.o pci-sysfs.o
> 
> Sigh, this won't work because the PCI core blithely assumes we have
> sysfs:
> 
> drivers/built-in.o: In function `pci_bus_add_device':
> /kio/work/achiang/kernels/linux-2.6/drivers/pci/bus.c:89: undefined reference to `pci_create_sysfs_dev_files'
> drivers/built-in.o: In function `pci_stop_dev':
> /kio/work/achiang/kernels/linux-2.6/drivers/pci/remove.c:24: undefined reference to `pci_remove_sysfs_dev_files'
> 
> So, here is v3 that actually does build with !CONFIG_SYSFS. It
> touches a bit more now, but I believe it is still appropriate
> because neither pci_slot.ko nor any of the drivers in
> drivers/pci/hotplug/ are useful without sysfs.
> 
> From: Alex Chiang <[email-masked]>
> 
> PCI: drivers/pci/slot.c should depend on CONFIG_SYSFS
> 
> There is no way to interact with a physical PCI slot without
> sysfs, so encode the dependency and prevent this build error:
> 
> 	drivers/pci/slot.c: In function 'pci_hp_create_module_link':
> 	drivers/pci/slot.c:327: error: 'module_kset' undeclared
> 
> This patch _should_ make pci-sysfs.o depend on CONFIG_SYSFS too,
> but we cannot (yet) because the PCI core merrily assumes the
> existence of sysfs:
> 
> 	drivers/built-in.o: In function `pci_bus_add_device':
> 	drivers/pci/bus.c:89: undefined reference to `pci_create_sysfs_dev_files'
> 	drivers/built-in.o: In function `pci_stop_dev':
> 	drivers/pci/remove.c:24: undefined reference to `pci_remove_sysfs_dev_files'
> 
> So do the minimal bit for now and figure out how to untangle it
> later.
> 
> Cc: Len Brown <[email-masked]>
> Reported-by: Stephen Rothwell <[email-masked]>

Reported-by: Randy Dunlap <[email-masked]>
Acked-by: Randy Dunlap <[email-masked]>

> Fix-suggested-by: Matthew Wilcox <[email-masked]>
> Signed-off-by: Alex Chiang <[email-masked]>
> ---
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index 431f8b4..7ec7d88 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -266,6 +266,7 @@ config ACPI_DEBUG_FUNC_TRACE
>  
>  config ACPI_PCI_SLOT
>  	tristate "PCI slot detection driver"
> +	depends on SYSFS
>  	default n
>  	help
>  	  This driver creates entries in /sys/bus/pci/slots/ for all PCI
> diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
> index ba6af16..ed32f67 100644
> --- a/drivers/pci/Makefile
> +++ b/drivers/pci/Makefile
> @@ -2,10 +2,11 @@
>  # Makefile for the PCI bus specific drivers.
>  #
>  
> -obj-y		+= access.o bus.o probe.o remove.o pci.o quirks.o slot.o \
> +obj-y		+= access.o bus.o probe.o remove.o pci.o quirks.o \
>  			pci-driver.o search.o pci-sysfs.o rom.o setup-res.o \
>  			irq.o
>  obj-$(CONFIG_PROC_FS) += proc.o
> +obj-$(CONFIG_SYSFS) += slot.o
>  
>  # Build PCI Express stuff if needed
>  obj-$(CONFIG_PCIEPORTBUS) += pcie/
> diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
> index 9aa4fe1..522c360 100644
> --- a/drivers/pci/hotplug/Kconfig
> +++ b/drivers/pci/hotplug/Kconfig
> @@ -4,7 +4,7 @@
>  
>  menuconfig HOTPLUG_PCI
>  	tristate "Support for PCI Hotplug"
> -	depends on PCI && HOTPLUG
> +	depends on PCI && HOTPLUG && SYSFS
>  	---help---
>  	  Say Y here if you have a motherboard with a PCI Hotplug controller.
>  	  This allows you to add and remove PCI cards while the machine is

-- 
~Randy
LPC 2009, Sept. 23-25, Portland, Oregon
http://linuxplumbersconf.org/2009/