aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/ozwpan (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-10-30staging: ozwpan: prevent overflow in oz_cdev_write()Dan Carpenter1-0/+3
We need to check "count" so we don't overflow the ei->data buffer. Reported-by: Nico Golde <nico@ngolde.de> Reported-by: Fabian Yamaguchi <fabs@goesec.de> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: stable@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-08-28staging: ozwpan: Return error, if PD is not connected.Rupesh Gujare1-0/+2
Return error if we receive write(), while PD is not connected. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-28staging: ozwpan: Change error number.Rupesh Gujare1-1/+1
Incorrect error number was returned here (EPERM), ENXIO is more appropriate. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-28staging: ozwpan: Increase ISOC IN buffer depthRupesh Gujare1-1/+1
Buffer depth of 50 units is not sufficient when there is considerable delay occuring on air due to interference, increase ISOC IN buffer depth to 100 units. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-27staging: ozwpan: oz_pd_free() can be staticFengguang Wu1-1/+1
Cc: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-27staging: ozwpan: Reset PORT_ENABLE bit.Rupesh Gujare1-1/+1
Reset PORT_ENABLE bit of port status on loosing PD. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-27staging: ozwpan: Add debounce time before unregistering.Rupesh Gujare1-0/+5
Fixes following error caused during unloading driver. [ 1127.542888] usb 5-1: USB disconnect, device number 2 [ 1127.542909] ozwpan ozwpan: remove, state 1 [ 1127.542933] usb usb5: USB disconnect, device number 1 [ 1127.618634] hub 5-0:1.0: hub_port_status failed (err = -19) [ 1127.618647] hub_port_connect_change: 45 callbacks suppressed [ 1127.618657] hub 5-0:1.0: connect-debounce failed, port 1 disabled [ 1127.618668] hub 5-0:1.0: cannot disable port 1 (err = -19) Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: ozwpan: change max. TX frame size supported.Rupesh Gujare1-1/+1
Max. TX frame size supported is changed to 760 bytes. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: ozwpan: Fix error checking while transmitting frame.Rupesh Gujare1-4/+4
Make sure that we return negative value if oz_build_frame() returns NULL. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: ozwpan: change variable type.Rupesh Gujare1-2/+2
We have icreased interrupt end point buffer size to 512 bytes, Change variable data type to accomodate it. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: ozwpan: Increase interrupt end point buffer sizeRupesh Gujare1-1/+2
Increase interrupt end point buffer size & convert hard coded value to macro for better readability. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: ozwpan: Convert hard coded value to MacroRupesh Gujare1-1/+2
Use macro instead of hard coded value for readability. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: ozwpan: Check for correct config number.Rupesh Gujare1-1/+1
Check for valid config number before completing set interface. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-23staging: ozwpan: Fix Documentation style.Rupesh Gujare9-218/+179
This patch fixes Kernel Documentation style. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-23staging: ozwpan: Fix wrong error check.Rupesh Gujare1-5/+1
schedule_work() returns true if succeeded & false on failure, error check was doing exactly reverse. Also removes extra variable. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-23staging: ozwpan: Remove memsetRupesh Gujare1-1/+0
As we are initialising structure, we do not require memset(). Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-22staging: ozwpan: Create deferred work to destroy PD object.Rupesh Gujare2-5/+24
Currently we call oz_pd_destroy() from softirq context, where we try to destroy relevant data structures, as well we kill a tasklet which always result in following kernel warning. [12279.262194] Attempt to kill tasklet from interrupt [12279.262202] Attempt to kill tasklet from interrupt This patch defers deallocation of data structures to work queue. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-22staging: ozwpan: Increment reference counter.Rupesh Gujare1-1/+4
Increment PD reference counter, on every timer event so that we do not loose PD object by mistake. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-22staging: ozwpan: Check error condition before creating endpoint.Rupesh Gujare1-0/+2
Check if interface number is correct before creating an end point. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-22staging: ozwpan: Fix crash for race condition.Rupesh Gujare1-2/+3
Do not allocate a port to new device or process URB when its status is yet to be read. This avoids race condition when USB core read hub status a bit late, while new device tries to acquire port. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-15staging: ozwpan: Remove extra variable.Rupesh Gujare1-2/+1
We should not use extra variable just to copy pointer value, renaming parameter name serves pupose & removes extra variable. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-15staging: ozwpan: Remove unneeded variable initializerRupesh Gujare1-1/+1
We are assigning value to hport before returning, there is no need to initialize it. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14staging: ozwpan: Separate success & failure case for oz_hcd_pd_arrived()Dan Carpenter1-27/+27
This patch separates success & failure block along with fixing following issues:- 1. The way oz_hcd_pd_arrived() looks now it's easy to think we free "ep" but actually we do this spaghetti thing of setting it to NULL on success. 2. It is hard to read it because there are unlocks scattered throughout. 3. Currently we set "ep" to NULL on the success path and then test it and or free it. In current code you have to scroll to the start of the function to read code. Original patch was submitted by Dan here :- http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2013-August/040113.html Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14staging: ozwpan: Swap arguments of oz_ep_alloc() to match kmalloc()Rupesh Gujare1-3/+3
Swap arguments of oz_ep_alloc() to match kmalloc() for better readability. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14staging: ozwpan: Remove unneeded initializersRupesh Gujare3-12/+12
Remove variable initialization wherever it is not required. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14staging: ozwpan: Make oz_hcd_pd_departed() take a struct pointer.Rupesh Gujare2-3/+3
oz_hcd_pd_departed() takes struct oz_port pointer instead of void *, change function declaration to avoid ambiguity. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14staging: ozwpan: Make oz_hcd_pd_arrived() return a struct pointerRupesh Gujare2-3/+3
oz_hcd_pd_arrived returns struct oz_port *, change function declaration to avoid ambiguity. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14staging: ozwpan: Remove unnecessary pointer check.Rupesh Gujare1-1/+1
We are already checking "ep" earlier in function. Do not need to check again. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14staging: ozwpan: Fix coding style.Rupesh Gujare1-2/+2
Put spaces around math operations. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14staging: ozwpan: Simply if conditionRupesh Gujare1-4/+5
Making code simpler for readability. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14staging: ozwpan: Add a blank line between functions & declarations.Rupesh Gujare9-0/+189
This patch adds a blank line between global declarations & functions for readability. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14staging: ozwpan: Add a blank line between declaraction and code.Rupesh Gujare8-0/+89
This patch adds blank line between declaration & code for readability. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12staging: ozwpan: Return correct hub status.Rupesh Gujare1-2/+9
Fix a bug where we were not returning correct hub status for 8th port. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12staging: ozwpan: Reset port configuration number.Rupesh Gujare1-0/+1
Make sure that we reset port configuration no. when PD departs. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12staging: ozwpan: Fixes crash due to invalid port aceess.Rupesh Gujare1-2/+7
This patch fixes kernel crash issue, when we receive URB request after de-enumerating device. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12staging: ozwpan: Fix farewell report.Rupesh Gujare2-2/+2
This patch fix following issues reported by Dan:- 1) There is no check limiting the size to 32 and it could be up to 253 bytes. 2) Use defines instead of magic numbers. 3) The oz_farewell struct is supposed to be a variable length struct but the variable part is put in the middle. It doesn't make any sense to put the length of the variable size array after then end of the array because we can never find it again! Put the variable size array at the end. Make it a zero length array. u8 len; u8 report[0]; 4) In oz_add_farewell() we do this: f = kmalloc(sizeof(struct oz_farewell) + len - 1, GFP_ATOMIC); The "- 1" refers to sizeof(f->report) but because it was a magic number then it was missed when the sizeof(f->report) changed. 5) In [patch 6/6] we set the ->len member. But because it is at the end of a variable length array with no limit check the remote attacker can just rewrite it using the memcpy() on the next line. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12staging: ozwpan: Fix build warning.Rupesh Gujare1-2/+2
This patch fixes following build warning. drivers/built-in.o: In function `oz_hcd_heartbeat': >> (.text+0x30aadd): undefined reference to `__divdi3' drivers/built-in.o: In function `oz_hcd_heartbeat': >> (.text+0x30ac85): undefined reference to `__divdi3' Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-02staging: ozwpan: Set farewell report length.Rupesh Gujare1-0/+1
Fixes a bug where we were not setting length field causing wrong report size to be copied. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-02staging: ozwpan: Increase farewell report size.Rupesh Gujare1-1/+1
Farewell report size can be bigger than one byte, increase array size to accomodate maximum 32 bytes of farewell report. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-02staging: ozwpan: Drop oldest ISOC frame instead of dropping latest.Rupesh Gujare1-1/+12
In case of ISOC transfer, if TX queue is full then we start dropping latest frame, instead we should drop oldest frame & add latest frame to TX queue. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-02staging: ozwpan: Use kernel strncmp function.Rupesh Gujare1-16/+1
Use kernel's strncmp() function instead of defining same within driver. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-02staging: ozwpan: Mark string as constRupesh Gujare2-5/+5
Make sure that we mark const string so that it does not get modified. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-02staging: ozwpan: Use kernel list function for managing interface list.Rupesh Gujare1-16/+13
Managing interface list, is easier if we use kernel list_* API than managing it on our own. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-31staging: ozwpan: High resolution timersRupesh Gujare7-324/+188
Current implementation assumes HZ = 1000 for calculating all internal timer intervals, which creates problem on platforms where HZ != 1000. As well we need resolution of less than 10 mSec for heartbeat calculation, this creates problem on some platforms where HZ is configured as HZ = 100, or around, which restricts us to timer interval of 10 mSec. This is particularly found on embedded devices. This patch moves on to use high resolution timers to calculate all timer intervals as it allows us to have very small resolution of timer interval, removing dependency on HZ. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-25staging: ozwpan: Fix coding style.Rupesh Gujare1-7/+8
This patch fixes coding style issues reported by Dan here:- http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2012-June/027767.html Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: ozwpan: Rename Kbuild to MakefileJoe Perches1-0/+0
Rename Kbuild to usual Makefile, consistent with Kernel build structure. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: ozwpan: Convert macro to function.Joe Perches1-2/+2
Replace macro with inline function. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: ozwpan: Remove old debug macro.Joe Perches13-125/+17
Remove old oz_trace & oz_trace2 macro & related header files. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: ozwpan: Replace oz_trace with oz_dbgJoe Perches10-252/+307
Introduce new debug macros: oz_dbg, oz_cdev_dbg, oz_pd_dbg and then replace old oz_trace & oz_trace2 with new macro. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: ozwpan: Remove extra debug logs.Joe Perches2-22/+8
Remove unnecessary debug logs. Most of these logs print function name at the start of function, which are not really required. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>