Commit graph

158 commits

Author SHA1 Message Date
Rupesh Gujare d236dc11a1 staging: ozwpan: Check error condition before creating endpoint.
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-22 10:15:55 -07:00
Rupesh Gujare 0a7bfbffbd staging: ozwpan: Fix crash for race condition.
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-22 10:15:55 -07:00
Rupesh Gujare 83db51fe72 staging: ozwpan: Remove extra variable.
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-15 17:19:27 -07:00
Rupesh Gujare 3bc0d88243 staging: ozwpan: Remove unneeded variable initializer
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-15 17:19:27 -07:00
Dan Carpenter 95b20b8b06 staging: ozwpan: Separate success & failure case for oz_hcd_pd_arrived()
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-14 14:15:40 -07:00
Rupesh Gujare 5f1f7b110f staging: ozwpan: Swap arguments of oz_ep_alloc() to match kmalloc()
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-14 14:15:40 -07:00
Rupesh Gujare a15e042e26 staging: ozwpan: Remove unneeded initializers
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-14 14:15:40 -07:00
Rupesh Gujare 2540381314 staging: ozwpan: Make oz_hcd_pd_departed() take a struct pointer.
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-14 14:15:40 -07:00
Rupesh Gujare 0503d202c6 staging: ozwpan: Make oz_hcd_pd_arrived() return a struct pointer
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-14 14:15:40 -07:00
Rupesh Gujare c45905a726 staging: ozwpan: Remove unnecessary pointer check.
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-14 14:15:40 -07:00
Rupesh Gujare 0535281e4b staging: ozwpan: Fix coding style.
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-14 14:13:43 -07:00
Rupesh Gujare 2c66335c0c staging: ozwpan: Simply if condition
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-14 14:13:43 -07:00
Rupesh Gujare 6e244a8319 staging: ozwpan: Add a blank line between functions & declarations.
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-14 14:13:43 -07:00
Rupesh Gujare 18f8191e1f staging: ozwpan: Add a blank line between declaraction and code.
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-14 14:13:43 -07:00
Rupesh Gujare a66698110b staging: ozwpan: Return correct hub status.
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-12 14:58:34 -07:00
Rupesh Gujare d772983d2a staging: ozwpan: Reset port configuration number.
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-12 14:58:34 -07:00
Rupesh Gujare bc9aece00a staging: ozwpan: Fixes crash due to invalid port aceess.
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-12 14:02:58 -07:00
Rupesh Gujare b2271b5bdf staging: ozwpan: Fix farewell report.
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-12 14:02:58 -07:00
Rupesh Gujare 5cf9d2577f staging: ozwpan: Fix build warning.
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-12 14:00:29 -07:00
Rupesh Gujare b50c460a6c staging: ozwpan: Set farewell report length.
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-02 11:57:54 +08:00
Rupesh Gujare baaaef1383 staging: ozwpan: Increase farewell report size.
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-02 11:57:54 +08:00
Rupesh Gujare 2dc2ee5ccd staging: ozwpan: Drop oldest ISOC frame instead of dropping latest.
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-02 11:56:56 +08:00
Rupesh Gujare 4d6c9e5702 staging: ozwpan: Use kernel strncmp function.
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-02 11:56:56 +08:00
Rupesh Gujare 83e4817fc3 staging: ozwpan: Mark string as const
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-02 11:56:55 +08:00
Rupesh Gujare 8a3cac62ef staging: ozwpan: Use kernel list function for managing interface list.
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-08-02 11:56:55 +08:00
Rupesh Gujare 8fd0700774 staging: ozwpan: High resolution timers
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-31 17:48:21 -07:00
Rupesh Gujare 8079154a1d staging: ozwpan: Fix coding style.
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-25 13:40:53 -07:00
Joe Perches ba628ad0ba staging: ozwpan: Rename Kbuild to Makefile
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-23 14:34:53 -07:00
Joe Perches 155c71435c staging: ozwpan: Convert macro to function.
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-23 14:34:53 -07:00
Joe Perches 05f608f237 staging: ozwpan: Remove old debug macro.
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-23 14:34:53 -07:00
Joe Perches f724b58434 staging: ozwpan: Replace oz_trace with oz_dbg
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-23 14:34:52 -07:00
Joe Perches 30f1e5a9ab staging: ozwpan: Remove extra debug logs.
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>
2013-07-23 14:34:52 -07:00
Rupesh Gujare 255ece7c4d staging: ozwpan: remove event tracing code.
Removes event tracing code as it can be replaced
by in-kernel tracing infrastructure.

Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-17 14:48:12 -07:00
Greg Kroah-Hartman ec0ee957f6 Revert "ozwpan: replace alloc_skb with dev_alloc_skb in ozpd.c"
This reverts commit 812eb995d4.

I shouldn't have applied it, my fault...

Cc: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-04 16:03:22 -07:00
Greg Kroah-Hartman 6b790d0fae Revert "ozwpan: replace alloc_skb with dev_alloc_skb in ozproto.c"
This reverts commit c314796538.

I shouldn't have applied it, my fault.

Cc: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-04 16:02:46 -07:00
Greg Kroah-Hartman dd3cef0f07 Revert "ozwpan: replace kfree_skb with dev_kfree_skb in ozpd.c"
This reverts commit 91c6c4bdb2.

It wasn't supposed to be applied, my fault.

Cc: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-04 16:02:03 -07:00
Greg Kroah-Hartman e79f864d59 Revert "ozwpan: replace kfree_skb with dev_kfree_skb in ozproto.c"
This reverts commit 5109c8a0c1.

I shouldn't have applied this, my fault...

Cc: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-04 16:01:33 -07:00
Xenia Ragiadakou 5109c8a0c1 ozwpan: replace kfree_skb with dev_kfree_skb in ozproto.c
This patch replaces the calls to kfree_skb with
calls to dev_kfree_skb.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-30 21:04:39 +09:00
Xenia Ragiadakou 91c6c4bdb2 ozwpan: replace kfree_skb with dev_kfree_skb in ozpd.c
This patch replaces the calls to kfree_skb with
calls to dev_kfree_skb.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-30 21:04:39 +09:00
Xenia Ragiadakou c314796538 ozwpan: replace alloc_skb with dev_alloc_skb in ozproto.c
This patch replaces the calls to alloc_skb with calls
to dev_alloc_skb.

dev_alloc_skb has GFP_ATOMIC priority so the
replacement does not change the code semantics.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-30 21:04:38 +09:00
Xenia Ragiadakou 812eb995d4 ozwpan: replace alloc_skb with dev_alloc_skb in ozpd.c
This patch replaces the calls to alloc_skb with calls
to dev_alloc_skb.

dev_alloc_skb has GFP_ATOMIC priority so the
replacement does not change the code semantics.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-30 21:04:37 +09:00
Xenia Ragiadakou 42b4212baa staging: ozwpan: Revert last changes
This patch reverts the changes made by the following patches:

commit id: edea341b04
[PATCH 1/4] ozwpan: replace alloc_skb with dev_alloc_skb in ozpd.c

commit id: b59983f525
[PATCH 2/4] ozwpan: replace alloc_skb with dev_alloc_skb in ozproto.c

commit id: 4422a6c14d
[PATCH 3/4] ozwpan: replace kfree_skb with dev_kfree_skb in ozpd.c

commit id: e241a8b616
[PATCH 4/4] ozwpan: replace kfree_skb with dev_kfree_skb in ozproto.c

The reason of this revert is that dev_alloc_skb() is not defined
to be used in the allocation of socket buffers on the transmit path
but on the receive path.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-24 15:25:53 -07:00
Xenia Ragiadakou 4422a6c14d ozwpan: replace kfree_skb with dev_kfree_skb in ozproto.c
This patch replaces the calls to kfree_skb with
calls to dev_kfree_skb.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-21 10:54:45 -07:00
Xenia Ragiadakou e241a8b616 ozwpan: replace kfree_skb with dev_kfree_skb in ozpd.c
This patch replaces the calls to kfree_skb with
calls to dev_kfree_skb.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-21 10:54:45 -07:00
Xenia Ragiadakou edea341b04 ozwpan: replace alloc_skb with dev_alloc_skb in ozproto.c
This patch replaces the calls to alloc_skb with calls
to dev_alloc_skb.

dev_alloc_skb has GFP_ATOMIC priority so the
replacement does not change the code semantics.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-21 10:54:45 -07:00
Xenia Ragiadakou b59983f525 ozwpan: replace alloc_skb with dev_alloc_skb in ozpd.c
This patch replaces the calls to alloc_skb with calls
to dev_alloc_skb.

dev_alloc_skb has GFP_ATOMIC priority so the
replacement does not change the code semantics.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-21 10:54:45 -07:00
Xenia Ragiadakou cb560c401b staging: ozwpan: fix access byteorder for wMaxPacketSize in ozhcd.c
This patch fixes the access byteorder of wMaxPacketSize
which is __le16, following the USB standard, and needs to
be converted into native cpu byteorder in order to be accessed.

Instead of using le16_to_cpu(hep->desc.wMaxPacketSize),
it was used the usb_endpoint_maxp() function, defined in
<uapi/linux/usb/ch9.h>

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-17 11:51:17 -07:00
Wei Yongjun b491564eb2 staging: ozwpan: fix error return code in oz_cdev_register()
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-13 18:02:29 -04:00
Dan Carpenter 2516ffac94 staging/ozwpan: info leak in oz_cdev_ioctl()
If we're not maxed out then oz_get_pd_list() leaves part of the "list"
struct uninitialized.  We should clear this so that no stack information
is leaked to userspace.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-22 10:25:46 -07:00
Peter Huewe dc7f5b3594 staging/ozwpan: Mark read only parameters and structs as const
This patch marks function parameters that are used read only
as well as readonly structs (and corresponding pointers) as const.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15 15:14:30 -08:00
Peter Huewe 89fe22b6ac staging/ozwpan: Remove empty and unused function oz_cdev_heartbeat
oz_cdev_heartbeat is empty and unused -> safe to remove.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15 15:14:30 -08:00
Peter Huewe a7f74c3005 staging/ozwpan: Mark local functions as static (fix sparse warnings)
sparse complains about the following functions

ozhcd.c:330:20: warning: symbol 'oz_uncancel_urb' was not declared.  Should it be static?
ozhcd.c:420:6: warning: symbol 'oz_complete_buffered_urb' was not declared. Should it be static?
ozmain.c:25:6: warning: symbol 'g_net_dev' was not declared. Should it be static?
ozevent.c:95:5: warning: symbol 'oz_events_open' was not declared.  Should it be static?
ozevent.c:110:5: warning: symbol 'oz_events_release' was not declared.  Should it be static?
ozevent.c:121:9: warning: symbol 'oz_events_read' was not declared.  Should it be static?
ozevent.c:160:30: warning: symbol 'oz_events_fops' was not declared.  Should it be static?
ozcdev.c:47:14: warning: symbol 'g_oz_class' was not declared. Should it be static?
ozcdev.c:74:5: warning: symbol 'oz_cdev_open' was not declared. Should it be static?
ozcdev.c:86:5: warning: symbol 'oz_cdev_release' was not declared.  Should it be static?
ozcdev.c:94:9: warning: symbol 'oz_cdev_read' was not declared. Should it be static?
ozcdev.c:146:9: warning: symbol 'oz_cdev_write' was not declared. Should it be static?
ozcdev.c:236:6: warning: symbol 'oz_cdev_ioctl' was not declared. Should it be static?
ozcdev.c:300:14: warning: symbol 'oz_cdev_poll' was not declared. Should it be static?
ozcdev.c:321:30: warning: symbol 'oz_fops' was not declared. Should it be static?
ozproto.c:958:6: warning: context imbalance in 'oz_polling_lock_bh' - wrong count at exit
ozproto.c:964:6: warning: context imbalance in 'oz_polling_unlock_bh' - unexpected unlock
ozusbsvc1.c:308:6: warning: symbol 'oz_usb_handle_ep_data' was not declared. Should it be static?
ozpd.c:410:6: warning: symbol 'oz_set_more_bit' was not declared. Should it be static?
ozpd.c:418:6: warning: symbol 'oz_set_last_pkt_nb' was not declared.  Should it be static?

-> add static keyword to silence the warning and make sparse happy.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15 15:14:30 -08:00
Peter Huewe 4f9d5b2f9a staging/ozwpan: Add missing header includes
ozcdev.c and ozhcd.c should include their own header file, so sparse
knows which functions are declared and which not.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15 15:14:30 -08:00
Peter Huewe 7be7d6def3 staging/ozwpan: Fix NULL vs zero in ozhcd.c (sparse warning)
This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

If the initialization with NULL was unnecessary (due to unconditional
assignment before first use) it was removed.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15 10:25:11 -08:00
Peter Huewe ba346a4367 staging/ozwpan: Fix NULL vs zero in ozusbsvc.c (sparse warning)
This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

If the initialization with NULL was unnecessary (due to unconditional
assignment before first use) it was removed.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15 10:25:11 -08:00
Peter Huewe bc501c551c staging/ozwpan: Fix NULL vs zero in ozcdev.c (sparse warning)
This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

If the initialization with NULL was unnecessary (due to unconditional
assignment before first use) it was removed.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15 10:25:11 -08:00
Peter Huewe 41ebb8a1c5 staging/ozwpan: Fix NULL vs zero in ozproto.c (sparse warning)
This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

If the initialization with NULL was unnecessary (due to unconditional
assignment before first use) it was removed.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15 10:25:11 -08:00
Peter Huewe 953b19013a staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse warning)
This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

If the initialization with NULL was unnecessary (due to unconditional
assignment before first use) it was removed.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15 10:23:50 -08:00
Peter Huewe 4d1b2fbbaf staging/ozwpan: Fix NULL vs zero in ozusbsvc1.c (sparse warning)
This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

If the initialization with NULL was unnecessary (due to unconditional
assignment before first use) it was removed.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15 10:23:50 -08:00
Peter Huewe 86b02be043 staging/ozwpan: Fix NULL vs zero in ozpd.c (sparse warning)
This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

If the initialization with NULL was unnecessary (due to unconditional
assignment before first use) it was removed.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15 10:23:49 -08:00
Rupesh Gujare b360cb9726 staging:ozwpan: Fix following warning.
The patch ae926051d7: "staging: ozwpan: Added USB HCD
implementation" from Feb 20, 2012, leads to the following warning:
drivers/staging/ozwpan/ozhcd.c:1094 oz_hcd_heartbeat()
	 warn: what is this condition about? 'ep->buffered_units * 50'

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-01-29 23:25:10 -05:00
Rupesh Gujare c4048c641a staging:ozwpan: Change email address.
As part of transition caused due to acquisition of Ozmo Devices by Atmel,
my email address is changed.

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-25 11:23:07 -08:00
Chris Kelly 8edca3fe9e staging:ozwpan: Removed myself (Chris Kelly) as maintainer.
Removed myself (ckelly@ozmodevices.com) as maintainer of ozwpan.
Removed my email address from the TODO file.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-25 11:23:05 -08:00
Sachin Kamat 7010157b08 staging: ozwpan: Remove redundant null check before kfree in ozhcd.c
kfree on NULL pointer is a no-op.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 13:50:12 -08:00
Sachin Kamat ba34efba7a staging: ozwpan: Remove redundant null check before kfree in ozproto.c
kfree on NULL pointer is a no-op.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 13:50:12 -08:00
Sachin Kamat b150718ecb staging: ozwpan: Remove redundant null check before kfree in ozpd.c
kfree on NULL pointer is a no-op.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 13:50:12 -08:00
Sachin Kamat 43f971ebca staging: ozwpan: Include oz_events_clear() conditionally
oz_events_clear() is referenced only when CONFIG_DEBUG_FS is defined.
Move the definition too under this flag.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 13:50:11 -08:00
Xiaotian Feng 984a4a0378 staging: ozwpan: use tasklet_kill in device remove/release process
Some driver uses tasklet_disable in device remove/release process,
tasklet_disable will inc tasklet->count and return. If the tasklet
is not handled yet under some softirq pressure, the tasklet will be
placed on the tasklet_vec, never have a chance to be excuted. This might
lead to a heavy loaded ksoftirqd, wakeup with pending_softirq, but
tasklet is disabled. tasklet_kill should be used in this case.

Signed-off-by: Xiaotian Feng <dannyfeng@tencent.com>
Cc: Rupesh Gujare <rgujare@ozmodevices.com>
Cc: Chris Kelly <ckelly@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-31 15:14:41 -07:00
Fengguang Wu 3d9562a6ed staging: ozwpan: compare pointer to NULL rather than 0
Generated by: scripts/coccinelle/null/badzero.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-19 09:28:14 +01:00
Greg Kroah-Hartman 6a2a2cdd57 Merge 3.6-rc6 into staging-next
This pulls in the staging tree fixes in 3.6-rc6 into our branch to resolve the
merge issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-16 17:17:25 -07:00
Wei Yongjun 094e74c204 staging: ozwpan: use list_move_tail instead of list_del/list_add_tail
Using list_move_tail() instead of list_del() + list_add_tail().

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-05 11:58:24 -07:00
Wei Yongjun 0c925aa043 staging: ozwpan: remove pointless conditional before kfree_skb()
Remove pointless conditional before kfree_skb().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-04 13:12:13 -07:00
Masanari Iida ba07275faf staging: ozwpan: Fix typo in staging/ozwpan
Fix spelling typo in staging/ozwpan

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-04 13:12:13 -07:00
Tomas Winkler 07732be2ef staging: ozwpan: fix memcmp() test in oz_set_active_pd()
"addr" is a pointer so it's either 4 or 8 bytes, but actually we want
to compare 6 bytes (ETH_ALEN).

As network stack already provides helper function
is_zero_ether_addr() we use that instead of memcmp

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-04 12:48:00 -07:00
Rupesh Gujare 3c1669d8a7 staging: ozwpan: Bump version number
Bump version numbers to keep in sync with internal
version information.

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-13 19:17:17 -07:00
Rupesh Gujare 86d03a0f4f staging: ozwpan: isoc latency for audio burst
Set audio latency. This fixes issue where audio clips heard during
link outage.

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-13 19:17:17 -07:00
Rupesh Gujare 5494ebdf3c staging: ozwpan: Return correct actual_length to userland
This fixes issue where wrong retrun value was received
by userland application after writing data to raw hid device.

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-13 19:17:17 -07:00
Rupesh Gujare 24168911be staging: ozwpan: Insulate driver from HZ value
This patch fixes issue caused due to different HZ
value on system which do not have HZ=1000

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-13 19:17:17 -07:00
Rupesh Gujare 28a7229588 staging: ozwpan: buffer frame if urb not available.
For interrupt end point buffer frames, if urb is not available
& give back as soon as urb is received from usb core.

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-13 19:17:17 -07:00
Rupesh Gujare 4b29a3058c staging: ozwpan: Update TODO file
Update TODO file.

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-26 15:07:56 -07:00
Rupesh Gujare ba0a7ae713 staging: ozwpan: Unregister with sysfs while unloading.
Destroy device node & unregister device class from sysfs while unloading
driver

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-26 15:07:56 -07:00
Rupesh Gujare 86c948b441 staging: ozwpan: Set AC_VO priority
Set packet priority to AC_VO for audio data.

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-20 16:05:35 -07:00
Rupesh Gujare 6261c1ee6c staging: ozwpan: udev support
Register ozmo_wpan class with sysfs & support for udev
to create device node.

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-20 16:05:35 -07:00
Rupesh Gujare 00ec12b827 staging: ozwpan: set last_pkt_nb
In case of trigeered ISOC mode set last_pkt_nb only when
we are ready to send data.

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-20 16:05:35 -07:00
Rupesh Gujare fec9f24b62 staging: ozwpan: kmalloc flag
Pass right flag as memory is assigned in process
 context.

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-20 16:05:35 -07:00
Rupesh Gujare df49093ae4 staging: ozwpan: Correct ioctl numbers.
ioctl numbers were not in order, rearranging them in ascending order.

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-20 16:05:35 -07:00
Rupesh Gujare 33e6ada17f staging: ozwpan: ISOC transfer in triggered mode
This patch implements ISOC frame transfer while PD is in
 triggered mode.

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-20 16:05:34 -07:00
Greg Kroah-Hartman d210267741 Merge 3.4-rc5 into staging-next
This resolves the conflict in:
	drivers/staging/vt6656/ioctl.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-02 11:48:07 -07:00
Rupesh Gujare 89f21cc050 staging: ozwpan: Fix bug where kfree is called twice.
Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Chris Kelly <ckelly@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-26 12:40:53 -07:00
Rupesh Gujare 8176df8e95 staging: ozwpan: Fix bug where kfree is called twice.
Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Chris Kelly <ckelly@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-25 17:30:42 -07:00
Masanari Iida 8dc245970a staging,ozwpan: Fix typo in comments within staging/ozwpan
Correct spelling in comments withon staging/ozwpan

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Chris Kelly <ckelly@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-25 10:59:16 -07:00
Rupesh Gujare 68a75f3f1a staging: ozwpan: Replace existing event logging mechanism
This patch replaces existing event logging mechanism from ioctl to debugfs.
This patch replaces previous patch submitted by Chris Kelly. Previous patch can
be found at :-
http://article.gmane.org/gmane.linux.usb.general/60026/

Signed-off-by: Rupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: Chris Kelly <ckelly@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:40:52 -07:00
Justin P. Mattock 595914fea3 staging:ozwpan:ozhcd.c Fix typos in staging:ozwpan
The below patch fixes a typo that I found while reading.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Acked-by: Chris Kelly <ckelly@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:29:21 -07:00
Chris Kelly 678b7c1707 staging: ozwpan: Added new maintainer for ozwpan
Added Rupesh Gujare to MAINTAINERS file and contact in TODO file
for ozwpan driver.

Signed-off-by: Chris Kelly <ckelly@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:18:59 -07:00
Randy Dunlap 9948bc7e1d staging: ozwpan depends on NET
Fix build errors:  add depends on NET.

ERROR: "skb_clone" [drivers/staging/ozwpan/ozwpan.ko] undefined!
ERROR: "dev_get_by_name" [drivers/staging/ozwpan/ozwpan.ko] undefined!
ERROR: "dev_remove_pack" [drivers/staging/ozwpan/ozwpan.ko] undefined!
ERROR: "init_net" [drivers/staging/ozwpan/ozwpan.ko] undefined!
ERROR: "__alloc_skb" [drivers/staging/ozwpan/ozwpan.ko] undefined!
ERROR: "kfree_skb" [drivers/staging/ozwpan/ozwpan.ko] undefined!
ERROR: "dev_add_pack" [drivers/staging/ozwpan/ozwpan.ko] undefined!
ERROR: "consume_skb" [drivers/staging/ozwpan/ozwpan.ko] undefined!
ERROR: "dev_queue_xmit" [drivers/staging/ozwpan/ozwpan.ko] undefined!
ERROR: "skb_put" [drivers/staging/ozwpan/ozwpan.ko] undefined!

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Acked-by: Chris Kelly <ckelly@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-14 12:14:26 -07:00
Greg Kroah-Hartman 1ec41a31fb staging: ozwpan: remove debug allocator
The kernel already has a debug allocator, no need to have one unique to
a single driver.  So delete it, replace with kfree, kmalloc, and, in a
few places that need it, kzalloc().

Cc: Chris Kelly <ckelly@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-02 16:51:09 -08:00
Dan Carpenter 92a6253299 Staging: ozwpan: prevent bogus dereference
app_id comes from the network and can't be trusted.  If it's zero then
it will lead to a kernel crash.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Chris Kelly <ckelly@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-02 16:32:21 -08:00
Chris Kelly f2e332662b staging: ozwpan: added TODO file.
Added TODO file for ozwpan driver.

Signed-off-by: Chris Kelly <ckelly@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-02 16:32:21 -08:00
Chris Kelly 0339d3dbbf staging: ozwpan: Reduced size of oz_evtlist structure.
This structure is used in an ioctl definition and was causing the
64-bit PowerPC build to fail. The size of the array in the structure
has been reduced to fix this.

Signed-off-by: Chris Kelly <ckelly@ozmodevices.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-29 15:23:37 -08:00
Chris Kelly b0406db5b3 staging: ozwpan: Plumbed in Kconfig and Kbuild
Added Kconfig and Kbuild files for ozwpan USB over WiFi driver.
Modified parent Makefile and Kconfig to include them.

Signed-off-by: Chris Kelly <ckelly@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-24 09:29:24 -08:00