[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200812161228.02429.jbarnes@virtuousgeek.org>
Date: Tue, 16 Dec 2008 12:28:01 -0800
From: Jesse Barnes <jbarnes@...tuousgeek.org>
To: Trent Piepho <xyzzy@...akeasy.org>
Cc: Matthew Wilcox <matthew@....cx>, Alex Chiang <achiang@...com>,
"Darrick J. Wong" <djwong@...ibm.com>,
"linux-kernel" <linux-kernel@...r.kernel.org>,
"linux-pci" <linux-pci@...r.kernel.org>
Subject: Re: fixup PCI device booleans in sysfs
On Sunday, November 30, 2008 5:10 pm Trent Piepho wrote:
> From d962157b2b36f2c54d147a296921553b4aefcf7b Mon Sep 17 00:00:00 2001
> From: Trent Piepho <xyzzy@...akeasy.org>
> Date: Sun, 30 Nov 2008 16:51:29 -0800
> Subject: [PATCH] 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@...akeasy.org>
Nice, I dug this out of the big fakephp flame thread. Looks like a good fix;
there are probably other sysfs interfaces in the kernel that need similar
treatment. This one is in my linux-next branch now. Hope there aren't many
scripts out there depending on the broken behavior! :)
Thanks,
--
Jesse Barnes, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists