android_kernel_xiaomi_sm8350/drivers/pci
Trent Piepho ca99eb8c2d PCI: Hotplug: fakephp: Return success, not ENODEV, when bus rescan is triggered
The 'power' attribute of the fakephp driver originally only let one turn a
slot off.  If one tried to turn a slot on (echo 1 > .../power), it would
return ENODEV, as fakephp did not support this function.

An old (pre-git) patch changed this:
2004/11/11 16:33:31-08:00 jdittmer
[PATCH] fakephp: add pci bus rescan ability
http://article.gmane.org/gmane.linux.kernel/251183

Now writing "1" to the power attribute has the effect of triggering a bus
rescan, but it still returns ENODEV, probably an oversight in the above
patch.

Using the BusyBox echo will not produce an error message, but will
trigger *two* bus rescans (and return an exit code of 1):
~ # strace echo -n 1 > /sys/bus/pci/slots/0000:00:00.0/power
...
write(1, "1", 1)                        = -1 ENODEV (No such device)
write(1, "1", 1)                        = -1 ENODEV (No such device)
exit(1)                                 = ?

Using cp gives a write error, even though the write did happen and a rescan
was triggered:
~ # echo -n 1 > tmp ; cp tmp /sys/bus/pci/slots/0000:00:00.0/power
cp: Write Error: No such device

It seems much better to return success instead of failure.  The actual
status of the bus rescan is hard to return.  It happens asynchronously in a
work thread, so the sysfs store functions returns before any status is
ready (the whole point of the work queue).  And even if it didn't do this,
the rescan doesn't have any clear status to return.

Signed-off-by: Trent Piepho <tpiepho@freescale.com>
CC: Jan Dittmer <jdittmer@ppp0.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-04-20 21:47:09 -07:00
..
hotplug PCI: Hotplug: fakephp: Return success, not ENODEV, when bus rescan is triggered 2008-04-20 21:47:09 -07:00
pcie PCI: aerdrv_acpi.c: remove unneeded NULL check 2008-04-20 21:47:08 -07:00
.gitignore
access.c PCI: Expose PCI VPD through sysfs 2008-04-20 21:47:07 -07:00
bus.c PCI: remove global list of PCI devices 2008-04-20 21:47:02 -07:00
dmar.c copyright owner and author clean up for intel iommu and related files 2008-02-23 17:12:14 -08:00
hotplug-pci.c PCI: fix section mismatch warning in pci_scan_child_bus 2008-03-04 15:07:03 -08:00
hotplug.c
htirq.c
intel-iommu.c PCI: iommu: iotlb flushing 2008-04-20 21:47:07 -07:00
intel-iommu.h copyright owner and author clean up for intel iommu and related files 2008-02-23 17:12:14 -08:00
iova.c PCI: iova RB tree setup tweak 2008-04-20 21:47:06 -07:00
iova.h PCI: iommu: iotlb flushing 2008-04-20 21:47:07 -07:00
Kconfig
Makefile mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
msi.c
msi.h
pci-acpi.c ACPI: acpi_pci_set_power_state() cleanups 2008-02-23 01:29:34 -05:00
pci-driver.c
pci-sysfs.c PCI: Expose PCI VPD through sysfs 2008-04-20 21:47:07 -07:00
pci.c PCI: add PCI Express ASPM support 2008-04-20 21:47:03 -07:00
pci.h PCI: Expose PCI VPD through sysfs 2008-04-20 21:47:07 -07:00
probe.c PCI: clean up resource alignment management 2008-04-20 21:47:08 -07:00
proc.c PCI: Fix wrong reference counter check for proc_dir_entry 2008-02-21 15:34:39 -08:00
quirks.c PCI: Update VIA CX700 quirk 2008-04-20 21:47:07 -07:00
remove.c PCI: add PCI Express ASPM support 2008-04-20 21:47:03 -07:00
rom.c docbook: fix kernel-api source files 2008-03-03 10:47:14 -08:00
search.c PCI: clean up search.c a lot 2008-04-20 21:46:54 -07:00
setup-bus.c PCI: clean up resource alignment management 2008-04-20 21:47:08 -07:00
setup-irq.c
setup-res.c PCI: clean up resource alignment management 2008-04-20 21:47:08 -07:00
syscall.c