Well, first of all, I don't want to change so many files either.
What I do:
Adding a new parameter "struct bin_attribute *" in the
.read/.write methods for the sysfs binary attributes.
In fact, only the four lines change in fs/sysfs/bin.c and
include/linux/sysfs.h do the real work.
But I have to update all the files that use binary attributes
to make them compatible with the new .read and .write methods.
I'm not sure if I missed any. :(
Why I do this:
For a sysfs attribute, we can get a pointer pointing to the
struct attribute in the .show/.store method,
while we can't do this for the binary attributes.
I don't know why this is different, but this does make it not
so handy to use the binary attributes as the regular ones.
So I think this patch is reasonable. :)
Who benefits from it:
The patch that exposes ACPI tables in sysfs
requires such an improvement.
All the table binary attributes share the same .read method.
Parameter "struct bin_attribute *" is used to get
the table signature and instance number which are used to
distinguish different ACPI table binary attributes.
Without this parameter, we need to offer different .read methods
for different ACPI table binary attributes.
This is impossible as there are various ACPI tables on different
platforms, and we don't know what they are until they are loaded.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
sysfs is now completely out of driver/module lifetime game. After
deletion, a sysfs node doesn't access anything outside sysfs proper,
so there's no reason to hold onto the attribute owners. Note that
often the wrong modules were accounted for as owners leading to
accessing removed modules.
This patch kills now unnecessary attribute->owner. Note that with
this change, userland holding a sysfs node does not prevent the
backing module from being unloaded.
For more info regarding lifetime rule cleanup, please read the
following message.
http://article.gmane.org/gmane.linux.kernel/510293
(tweaked by Greg to not delete the field just yet, to make it easier to
merge things properly.)
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
platform_device_register_simple() returns error code as pointer when it
fails. The return value should be checked by IS_ERR().
Cc: Abhay Salunke <abhay_salunke@dell.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/firmware/dell_rbu.c: In function 'packetize_data':
drivers/firmware/dell_rbu.c:252: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'int'
Cc: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
dell_rbu: fix pr_debug argument warnings
Use size_t length modifier when outputting size_t and use %p instead of %lu for
'u8 *'.
Signed-off-by: Zach Brown <zach.brown@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This fixes http://bugzilla.kernel.org/show_bug.cgi?id=5854
Root cause:
The dell_rbu driver creates entries in /sys/class/firmware/dell_rbu/ by
calling request_firmware_nowait (without hotplug ) this function inturn
starts a kernel thread which creates the entries in
/sys/class/firmware/dell_rbu/loading , data and the thread waits on the
user action to return control back to the callback fucntion of dell_rbu.
The thread calls wait_on_completion which puts it in a D state until the
user action happens. If there is no user action happening the load average
goes up as the thread D state is taken in to account. Also after
downloading the BIOS image the enrties go away momentarily but they are
recreated from the callback function in dell_rbu. This causes the thread
to get recreated causing the load average to permenently stay around 1.
Fix:
The dell_rbu also creates the entry
/sys/devices/platform/dell_rbu/image_type at driver load time. The image
type by default is mono if required the user can echo packet to image_type
to make the BIOS update mechanism using packets. Also by echoing init in
to image_type the /sys/class/firmware/dell_rbu entries can be created.
The driver code was changed to not create /sys/class/firmware/dell_rbu
entries during load time, and also to not create the above entries from the
callback function. The entries are only created by echoing init to
/sys/devices/platform/dell_rbu/image_type The user now needs to create the
entries to download the image monolithic or packet. This fixes the issue
since the kernel thread only is created when ever the user is ready to
download the BIOS image; this minimizes the life span of the kernel thread
and the load average goes back to normal.
Signed off by Abhay Salunke <abhay_salunke@dell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This patch removes almost all inclusions of linux/version.h. The 3
#defines are unused in most of the touched files.
A few drivers use the simple KERNEL_VERSION(a,b,c) macro, which is
unfortunatly in linux/version.h.
There are also lots of #ifdef for long obsolete kernels, this was not
touched. In a few places, the linux/version.h include was move to where
the LINUX_VERSION_CODE was used.
quilt vi `find * -type f -name "*.[ch]"|xargs grep -El '(UTS_RELEASE|LINUX_VERSION_CODE|KERNEL_VERSION|linux/version.h)'|grep -Ev '(/(boot|coda|drm)/|~$)'`
search pattern:
/UTS_RELEASE\|LINUX_VERSION_CODE\|KERNEL_VERSION\|linux\/\(utsname\|version\).h
Signed-off-by: Olaf Hering <olh@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This patch has the changes to support the memory floor fix done in Dell
BIOS. The BIOS incase of packet update mechanism would not accept packet
placed in memory below a cretain address. This address is by default 128K
but can change. The driver now can accept the memory floor if the user
chooses to make it will try to allocate contiguous physical memory above
the memory floor by allocating a set of packets till a valid memory
allocation is made. All the allocates then are freed. This repeats for
everty packet.
This patch was created by Michael E Brown and has been tested on 2.6.14-rc5
Signed-of-by: Michael E Brown <Michael_E_Brown@Dell.com>
Signed-off-by: Abhay Salunke <abhay_salunke@dell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Convert everyone who uses platform_bus_type to include
linux/platform_device.h.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
In the current dell_rbu code ver 2.0 the packet update mechanism makes the
user app dump every individual packet in to the driver.
This adds in efficiency as every packet update makes the
/sys/class/firmware/dell_rbu/loading and data files to disappear and reappear
again. Thus the user app needs to wait for the files to reappear to dump
another packet. This slows down the packet update tremendously in case of
large number of packets. I am submitting a new patch for dell_rbu which will
change the way we do packet updates;
In the new method the user app will create a new single file which has already
packetized the rbu image and all the packets are now staged in this file.
This driver also creates a new entry in
/sys/devices/platform/dell_rbu/packet_size ; the user needs to echo the packet
size here before downloading the packet file.
The user should do the following:
create one single file which has all the packets stacked together.
echo the packet size in to /sys/devices/platform/dell_rbu/packet_size.
echo 1 > /sys/class/firmware/dell_rbu/loading
cat the packetfile > /sys/class/firmware/dell_rbu/data
echo 0 > /sys/class/firmware/dell_rbu/loading
The driver takes the file which came through /sys/class/firmware/dell_rbu/data
and takes chunks of paket_size data from it and place in contiguous memory.
This makes packet update process very efficient and fast. As all the packet
update happens in one single operation. The user can still read back the
downloaded file from /sys/devices/platform/dell_rbu/data.
Signed-off-by: Abhay Salunke <abhay_salunke@dell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
BUG fixes:
The driver used to allocate memory with spinlock held which has been
fixed in this patch.
The driver was printing the entire buffer when it received a invalid
entry in image_type. The fix is to only print a warning message and not
the buffer.
Usability enhancements:
It is possible that due to user error the /sys/class/firmware/dell_rbu
entries might be missing, this can happen if the user does the following
echo 1 > /sys/class/firmware/dell_rbu/loading
echo 0 > /sys/class/firmware/dell_rbu/loading
This will make the entries in /sys/class/firmware/ to disappear and the
only way get them back was bby unloading and loading the driver.
This patch makes the user recreate these entries by echoing init in to
image_type.
This patch has been tested with Libsmbios and Dell OpenManage.
Signed-off-by: Abhay Salunke <Abhay_Salunke@dell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>