]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: Make settable sysfs attributes more consistent
authorTrent Piepho <xyzzy@speakeasy.org>
Mon, 1 Dec 2008 01:10:12 +0000 (17:10 -0800)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 7 Jan 2009 19:12:58 +0000 (11:12 -0800)
commitb0614379d645f967b0b635021a133da1a55adc32
tree0cf7d494d8a743350f29a827a272287a7d99b5d1
parent49ce55e6759a4797b7745420c13c8e40e3bcacab
PCI: Make settable sysfs attributes more consistent

PCI devices have three settable boolean attributes, enable,
broken_parity_status, and msi_bus.

The store functions for these would silently interpret "0x01" as false,
"1llogical" as true, and "true" would be (silently!) ignored and do
nothing.

This is inconsistent with typical sysfs handling of settable attributes,
and just plain doesn't make much sense.

So, use strict_strtoul(), which was created for this purpose.  The store
functions will treat a value of 0 as false, non-zero as true, and return
-EINVAL for a parse failure.

Additionally, is_enabled_store() and msi_bus_store() return -EPERM if
CAP_SYS_ADMIN is lacking, rather than silently doing nothing.  This is more
typical behavior for sysfs attributes that need a capability.

And msi_bus_store() will only print the "forced subordinate bus ..."
warning if the MSI flag was actually forced to a different value.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/pci-sysfs.c