replace uint and family by a much more proper u8/u16 types.
This is required specifically for data members of structures coming
in from the chip and data members parsed from the binary firmware file.
staging: ath6kl: Fixing a race condition during initialization
The commit fixes a race condition in the initialization portion of the
driver. The problem was observed while testing with the kernel in the
staging-next tree. The wait on the ready event is signalled prematurely
before setting the arVersion.wlan_ver and arVersion.abi_ver. The code
waiting on this semaphore checks for the validity of these values and
hence may proceed with an un-updated values of these fields. The wakeup
signal is now sent after these values are set.
The commit fixes a compilation error that was encountered while using
a specific kernel configuration file. The problem was the use of some
functions defined in <linux/semaphore.h> without including the header
file explicitly. It was probably working before because of the
dependency getting implicitly satisfied via some other header file.
Marek Lindner [Sat, 18 Sep 2010 19:01:22 +0000 (21:01 +0200)]
Staging: batman-adv: Introduce update_primary_addr to update mac address
set_primary_if is currently misused to update the mac address in vis
packets. This unneeded and introduces overhead due to other operations
which must be done when updating the primary interface.
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sven Eckelmann [Sat, 18 Sep 2010 19:01:21 +0000 (21:01 +0200)]
Staging: batman-adv: Track references of batman_if in set_primary_if
set_primary_if exchanges the current primary interfaces with a new one.
This is a new reference and thus we have to count it and decrease the
count of the old primary interface.
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sven Eckelmann [Sat, 18 Sep 2010 19:01:20 +0000 (21:01 +0200)]
Staging: batman-adv: count batman_if list queries as reference
The return of get_batman_if_by_netdev and get_active_batman_if leaks a
pointer from the rcu protected list of interfaces. We must protect it to
prevent a too early release of the memory. Those functions must increase
the reference counter before rcu_read_unlock or it may be to late to
prevent a free.
hardif_add_interface must also increase the reference count for the
returned batman_if to make the behaviour consistent.
Reported-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sven Eckelmann [Sat, 18 Sep 2010 19:01:19 +0000 (21:01 +0200)]
Staging: batman-adv: Use refcnt to track usage count of batman_if
get_batman_if_by_netdev and get_active_batman_if may leak data from the
rcu protected list of interfaces. The rcu protected list of all gateway
nodes leaks the actual data outside the read-side critical area. This is
not valid as we may free the data using a call_rcu created callback
after we unlock using rcu_read_unlock. A workaround is to provide a
reference count to be sure that the memory isn't freed to early.
It is currently only to implement the already existing functionality and
doesn't provide the full tracking of all usage cases.
Additionally, we must hardif_hold inside the
rcu_read_lock()..rcu_read_unlock() before we attach to the structure
which "leaks" it. When another function now removed it from its usage
context (primary_if, usage on stack, ...) then we must hardif_put it. If
it is decremented to zero then we can issue the call_rcu to the freeing
function. So "put" is not allowed inside an rcu_read_lock.
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sven Eckelmann [Sat, 18 Sep 2010 19:01:18 +0000 (21:01 +0200)]
Staging: batman-adv: Use synchronize_rcu instead of call_rcu
It is recommended [1] to use synchronize_rcu to simplify the code -
especially when otherwise extra locking is needed to protect other code
from picking stale elements. It also protects us for emitting to many
callbacks which may results in OOM conditions.
The only reason not to use it, would be in performance critical sections
or when we are not allowed to block.
[1] Documentation/RCU/checklist.txt
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Regions which do not use rcu functions don't need to protected by
rcu_read_lock. If we want to protect data from being freed than it must
be covered by the same read-side critical section or otherwise the grace
period may already ended and freed the memory before we called
rcu_read_lock again.
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sven Eckelmann [Sat, 18 Sep 2010 19:01:15 +0000 (21:01 +0200)]
Staging: batman-adv: Introduce if_list_lock to protect if_list
The update critical sections of if_list must be protected by a locking
primitive other than RCU. The iterator must also be protected by the
chosen locking mechanism.
The rtnl_lock in hardif_remove_interfaces must also be moved outside the
iterator primitive to ensure that we don't deadlock the kernel due to
differently nested locks in hardif_remove_interfaces and hard_if_event.
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sven Eckelmann [Sat, 18 Sep 2010 19:01:14 +0000 (21:01 +0200)]
Staging: batman-adv: wait for call_rcu before unloading module
synchronize_rcu respective synchronize_net only waits for the rcu grace
period to elapse and we may fail to finish the calls which were made to
call_rcu in that time. In result the module could be unloaded during the
execution of the RCU callbacks.
rcu_barrier[1] will now wait for all outstanding RCU callbacks to finish
before continuing.
[1] Documentation/RCU/rcubarrier.txt
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sven Eckelmann [Sat, 18 Sep 2010 19:01:12 +0000 (21:01 +0200)]
Staging: batman-adv: Move mailing list address to .org
The official mailing list is run on lists.open-mesh.org and it should be
avoided to sent them to lists.open-mesh.net to reduce the number of
receipents and double posts.
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sven Eckelmann [Sat, 18 Sep 2010 19:01:11 +0000 (21:01 +0200)]
Staging: batman-adv: checkpatch cleanup of comments
checkpatch now detects the start of a comment and warns about usage of
multiple spaces at the beginning of a line. We have to replace the ' '
in multiple lines comments by ' * ' to fix it.
Checkpatch also wants a comment after a definition of a spinlock_t which
describes what it protects. It is currently not possible to add it
before the actual struct which includes the spinlock.
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Platform devices tend to have id as -1 when only 1 device exist and
a value >=0 when multiple devices exist, since we plan to store all
these platform devices if multiple exist, there was a requirement to
have id to be >=0.
The patch fixes this problem.
Randy Dunlap [Tue, 14 Sep 2010 22:39:58 +0000 (15:39 -0700)]
staging/bcm: fix printk format warnings
Fix lots of printk format warnings in bcm. Here is a sample of them:
drivers/staging/bcm/CmHost.c:1955: warning: format '%x' expects type 'unsigned int', but argument 3 has type 'long unsigned int'
drivers/staging/bcm/CmHost.c:1955: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long unsigned int'
drivers/staging/bcm/CmHost.c:1955: warning: format '%x' expects type 'unsigned int', but argument 3 has type 'long unsigned int'
drivers/staging/bcm/LeakyBucket.c:85: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
drivers/staging/bcm/LeakyBucket.c:85: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
drivers/staging/bcm/LeakyBucket.c:85: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Randy Dunlap [Tue, 14 Sep 2010 22:41:41 +0000 (15:41 -0700)]
staging/keucr: fix build when CONFIG_PM is not enabled
keucr driver has a build error when CONFIG_PM is not enabled, so fix that.
drivers/staging/keucr/usb.c:42: error: 'struct us_data' has no member named 'suspend_resume_hook'
drivers/staging/keucr/usb.c:43: error: 'struct us_data' has no member named 'suspend_resume_hook'
drivers/staging/keucr/usb.c:64: error: 'struct us_data' has no member named 'suspend_resume_hook'
drivers/staging/keucr/usb.c:65: error: 'struct us_data' has no member named 'suspend_resume_hook'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Cc: Al Cho <acho@novell.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Andy Shevchenko [Sat, 11 Sep 2010 14:17:04 +0000 (17:17 +0300)]
staging: rt2860: change plain format of mac address to %pM in *printf()
There are many locations where MAC or BSSID is printed. The plain format
is used in such places. *printf() in kernel recognizes
%pM, %pMF and %pm format parameters to print out 6-byte array as MAC
address. This patch changes plain format to custom %pM which is widely
used in kernel.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
David Cross [Fri, 10 Sep 2010 23:55:53 +0000 (16:55 -0700)]
staging: west bridge: cyasgadget, remove file system / vfs calls
This patch remove file system specific (fat_get_block) and vfs calls
from the cyasgadget driver. The current implementation expects user
space to write the file (open, seek to end, 1 byte write), followed by a
call to clear the dirty pages from the the page cache.
Signed-off-by: David Cross <david.cross@cypress.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Maurice Dawson [Fri, 10 Sep 2010 19:20:42 +0000 (20:20 +0100)]
Staging: comedi: fix macro coding style issue in adl_pci9111.c
This is a patch that fixes up, macros with multiple statements should be enclosed in a do - while loop, coding style issue in the adl_pci9111.c file found by the checkpatch.pl tool
Signed-off-by: Maurice Dawson <mauricedawson2699@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Staging: batman-adv: Always synchronize rcu's on module shutdown
During the module shutdown procedure in batman_exit(), a rcu callback is
being scheduled (batman_exit -> hardif_remove_interfaces ->
hardif_remove_interfae -> call_rcu). However, when the kernel unloads
the module, the rcu callback might not have been executed yet, resulting
in a "unable to handle kernel paging request" in __rcu_process_callback
afterwards, causing the kernel to freeze.
The synchronize_net and synchronize_rcu in mesh_free are currently
called before the call_rcu in hardif_remove_interface and have no real
effect on it.
Therefore, we should always flush all rcu callback functions scheduled
during the shutdown procedure using synchronize_net. The call to
synchronize_rcu can be omitted because synchronize_net already calls it.
This is for the Asahi Kasei AK8975 3-axis magnetometer. It resides within
the magnetometer section of the IIO subsystem, and implements the raw
magn_x,y,z_raw attributes, as well as magn_x,y,z_scale attributes for
converting to Gauss.
Changed to use the magn_x,y,z_scale attributes, and made those attributes
give the scale factor to conert to Gauss. Also applied more fixes from
feedback.
Keeping mode as an unsigned long. I'm going to add proper power management
at some point anyway, which would deprecate this attribute.
Signed-off-by: Andrew Chew <achew@nvidia.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
staging: hv: Convert vmbus driver interface function pointer table to constant
Convert vmbus driver interface function pointer table to constant
The vmbus interface functions are assigned to a constant - vmbus_ops.
Because the vmbus interface function pointer table is converted to a
constant variable -- vmbus_ops, the function GetChannelInterface(),
VmbusGetChannelInterface() and pointer GetChannelInterface are no longer
in use. The deprecated function's work is done by the initialization of
the newly added constant variable vmbus_ops.
I created the new constant variable vmbus_ops and removed the deprecated
function pointer GetChannelInterface in one patch.