Commit graph

299 commits

Author SHA1 Message Date
Kurt Kanzenbach 6f19a2b1c3 staging: usbip: userspace: libsrc: removed assignments in if conditions
This patch fixes the following checkpatch error:
-ERROR: do not use assignment in if condition

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11 09:45:28 -07:00
Kurt Kanzenbach 9db91e1b4c staging: usbip: userspace: libsrc: replaced lines over 80 characters
This patch fixes some of the following checkpatch warnings:
-WARNING: line over 80 characters

We did not split format strings for readability.

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11 09:45:28 -07:00
Kurt Kanzenbach 71bd5b7672 staging: usbip: userspace: libsrc: (foo*) should be (foo *)
This patch fixes the following checkpatch error:
-ERROR: "(foo*)" should be "(foo *)"

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11 09:45:28 -07:00
Kurt Kanzenbach b8ab0f2bee staging: usbip: userspace: libsrc: spaces required around that '='
This patch fixes the following checkpatch error:
-ERROR: spaces required around that '='

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11 09:45:28 -07:00
Kurt Kanzenbach 5af7746f47 staging: usbip: userspace: libsrc: do not init static/globals to 0
This patch fixes the following checkpatch errors:
-ERROR: do not initialise statics to 0 or NULL
-ERROR: do not initialise globals to 0 or NULL

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11 09:45:28 -07:00
Kurt Kanzenbach cbb86718ac staging: usbip: userspace: libsrc: fix indention
This patch fixes the following checkpatch warning:
-ERROR: code indent should use tabs where possible
-WARNING: suspect code indent for conditional statements

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11 09:45:28 -07:00
Linus Torvalds d895cb1af1 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs pile (part one) from Al Viro:
 "Assorted stuff - cleaning namei.c up a bit, fixing ->d_name/->d_parent
  locking violations, etc.

  The most visible changes here are death of FS_REVAL_DOT (replaced with
  "has ->d_weak_revalidate()") and a new helper getting from struct file
  to inode.  Some bits of preparation to xattr method interface changes.

  Misc patches by various people sent this cycle *and* ocfs2 fixes from
  several cycles ago that should've been upstream right then.

  PS: the next vfs pile will be xattr stuff."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits)
  saner proc_get_inode() calling conventions
  proc: avoid extra pde_put() in proc_fill_super()
  fs: change return values from -EACCES to -EPERM
  fs/exec.c: make bprm_mm_init() static
  ocfs2/dlm: use GFP_ATOMIC inside a spin_lock
  ocfs2: fix possible use-after-free with AIO
  ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path
  get_empty_filp()/alloc_file() leave both ->f_pos and ->f_version zero
  target: writev() on single-element vector is pointless
  export kernel_write(), convert open-coded instances
  fs: encode_fh: return FILEID_INVALID if invalid fid_type
  kill f_vfsmnt
  vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op
  nfsd: handle vfs_getattr errors in acl protocol
  switch vfs_getattr() to struct path
  default SET_PERSONALITY() in linux/elf.h
  ceph: prepopulate inodes only when request is aborted
  d_hash_and_lookup(): export, switch open-coded instances
  9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate()
  9p: split dropping the acls from v9fs_set_create_acl()
  ...
2013-02-26 20:16:07 -08:00
Al Viro 496ad9aa8e new helper: file_inode(file)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-02-22 23:31:31 -05:00
Peter Huewe ff6944304e staging/usbip: Mark local functions as static (fix sparse warnings)
sparse complains about these functions:
usbip/stub_dev.c:529:5: warning: symbol 'stub_pre_reset' was not declared. Should it be static?
usbip/stub_dev.c:535:5: warning: symbol 'stub_post_reset' 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:12:40 -08:00
Joe Perches 78110bb8dc staging: Remove unnecessary OOM messages
alloc failures already get standardized OOM
messages and a dump_stack.

For the affected mallocs around these OOM messages:

Converted kzallocs with multiplies to kcalloc.
Converted kmallocs with multiplies to kmalloc_array.
Converted a kmalloc/strlen/strncpy to kstrdup.
Moved a spin_lock below a removed OOM message and
removed a now unnecessary spin_unlock.
Neatened alignment and whitespace.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-11 10:10:33 -08:00
Harvey Yang 50b66b5ce4 staging: usbip: replace the interrupt safe spinlocks with common ones.
On the client side, we have a virtual hcd driver, there actually no
hardware interrupts, so we do not need worry about race conditions
caused by irq with spinlock held. Turning off irq is not good for system
performance after all. Just replace them with a non interrupt safe
version.

Signed-off-by: Harvey Yang <harvey.huawei.yang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-22 09:00:10 -08:00
Harvey Yang dcf1477928 staging: usbip: use interrupt safe spinlock to avoid potential deadlock.
The function 'usbip_event_add()' may be called in interrupt context on
the stub side:
'stub_complete'->'stub_enqueue_ret_unlink'->'usbip_event_add'.
In this function it tries to get the lock 'ud->lock', so we should
disable irq when we get this lock in process context.

Signed-off-by: Harvey Yang <harvey.huawei.yang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-22 09:00:10 -08:00
Jake Champlin f14287b967 Staging: usbip: usbipcommon: Fixed single line bracing issue
Fixed coding style issue with single line braces.

Signed-off-by: Jake Champlin <jake.champlin.27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17 16:43:20 -08:00
Masanari Iida dbc320f749 staging: Add angle bracket before and after the URL
Add missing angle bracket before and after the URL.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 14:56:04 -08:00
Ilija Hadzic 82692d202a staging: usbip: userspace: suppress a bogus error
If mkdir() of VHCI_STATE_PATH fails because the directory
already exists, that's not an error. This patch fixes
annoying "record connection" errors that would typically
come up on attach.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Acked-by: David Chang <dchang@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 12:38:54 -08:00
Ilija Hadzic 107fefd4dd staging: usbip: userspace: add option to turn fortify on or off
This comes handy when hacking with different cross
compilers, some of which may or may not have
_FORTIFY_SOURCE turned on by default. This patch
allows us to turn _FORTIFY_SOURCE on by specifying
--with-fortify option at configuration time (or
to turn it off by specifying --without-fortify).

If nothing is specified, default compiler behavior
is assumed.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 12:38:54 -08:00
Ilija Hadzic 328f7f8a0a staging: usbip: userspace: eliminate glib dependency
USBIP daemon relies on functions available in glib2 library
to spawn handler code for incoming connection. This makes the
whole program dependent on glib2 library, which is a GNOME library
that on systems that don't have GNOME results in pulling more
dependency, only to be able to run a relatively trivial
socket-based program.

While this may not seem to be a problem on full-blown desktops
that already have the necessary libraries, it is a big issue
on small embedded systems (think USB hub with an Ethernet port)
that only have bare essentials in their file systems.

This patch eliminates glib2 dependency by reworking the
code to use lower level system calls to dispatch connection
handler. Instead of using glib2-style event loop and dispatching
mechanism, just do a ppoll(2) system call in our own loop and call
accept(2) followed by fork(2) on the socket that has incoming
connection. Stevens' books taught us that more than twenty
years ago. No need for anything smarter in a simple server, such
as usbipd.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 12:38:54 -08:00
Ilija Hadzic 0d0651d492 staging: usbip: userspace: add gitignore file
There are a bunch of automatically generated files that git
should not care about.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 12:38:54 -08:00
Ilija Hadzic 8a1430a787 staging: usbip: userspace: fix build breakage in doc directory
File doc/usbip_bind_driver.8 does not exist any more but it is
listed in dist_man_MANS. This breaks the build of the userspace.
Remove the file from the list.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Acked-by: David Chang <dchang@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 12:38:53 -08:00
Bill Pemberton f307da94db staging: usbip: remove use of __devexit_p
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Matt Mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 15:04:59 -08:00
Harvey Yang a6bb87522f usb: usbip: userspace: remove the port state file when detaching port.
with the last detached port state file remaining, usbip reports error on
attaching. So clean up the state files on detaching.

Signed-off-by: Harvey Yang <harvey.huawei.yang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 17:47:29 -08:00
Harvey Yang 695bcb1c0a staging: usbip: put usb_device and kill event handler thread in error cleanups.
If probe returns with error, the kthread is still alive even when all
usbip modules unloaded. So do cleanups in error handler.

Signed-off-by: harvey.yang <harvey.huawei.yang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 13:08:48 -08:00
Bernard Blackham 9e1b6cb9dc staging: usbip: Avoid superfluous set HC_STATE_RUNNING in vhci_start
HC_STATE_RUNNING is already set by the usb core.

Signed-off-by: Bernard Blackham <b-linuxgit@largestprime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22 13:38:40 -07:00
Bernard Blackham 3d0a2a22c9 staging: usbip: Don't leak struct file.
usbip takes a reference on a struct file which is passed in via
sysfs.  Previously, this reference was never cleaned up, although
the socket it referred to was.

This patch drops the corresponding reference (found with the
socket's ->file backpointer) instead of just closing the socket.

Signed-off-by: Bernard Blackham <b-linuxgit@largestprime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22 13:38:04 -07:00
Bart Westgeest c7f0089931 staging: usbip: cleanup of comments
Removed commented-out code, obsolete comments, and fixed comment typos.

Signed-off-by: Bart Westgeest <bart@elbrys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22 13:36:29 -07:00
Bart Westgeest 20960faca5 staging: usbip: make rh_port_disconnect static
Signed-off-by: Bart Westgeest <bart@elbrys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22 13:36:28 -07:00
Bart Westgeest 36ac9b055f staging: usbip: replaced pointer arithmetic, and strongly type function return.
Replaced pointer arithmetic by using array indexing, and changed
function return type for usbip_alloc_iso_desc_pdu from 'void*' to
'struct usbip_iso_packet_descriptor'.

Signed-off-by: Bart Westgeest <bart@elbrys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22 13:36:28 -07:00
Linus Torvalds d9a807461f USB merge for 3.7-rc1
Here is the big USB pull request for 3.7-rc1
 
 There are lots of gadget driver changes (including copying a bunch of
 files into the drivers/staging/ccg/ directory so that the other gadget
 drivers can be fixed up properly without breaking that driver), and we
 remove the old obsolete ub.c driver from the tree.  There are also the
 usual XHCI set of updates, and other various driver changes and updates.
 We also are trying hard to remove the old dbg() macro, but the final
 bits of that removal will be coming in through the networking tree
 before we can delete it for good.
 
 All of these patches have been in the linux-next tree.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iEYEABECAAYFAlBp3+AACgkQMUfUDdst+ym5vwCfe93FyJyXn/RDkGz7iBemvWFd
 vrwAoIxjaOa4/yWZWcgrWc5bP4aO3ssc
 =jYDr
 -----END PGP SIGNATURE-----

Merge tag 'usb-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB changes from Greg Kroah-Hartman:
 "Here is the big USB pull request for 3.7-rc1

  There are lots of gadget driver changes (including copying a bunch of
  files into the drivers/staging/ccg/ directory so that the other gadget
  drivers can be fixed up properly without breaking that driver), and we
  remove the old obsolete ub.c driver from the tree.

  There are also the usual XHCI set of updates, and other various driver
  changes and updates.  We also are trying hard to remove the old dbg()
  macro, but the final bits of that removal will be coming in through
  the networking tree before we can delete it for good.

  All of these patches have been in the linux-next tree.

  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

Fix up several annoying - but fairly mindless - conflicts due to the
termios structure having moved into the tty device, and often clashing
with dbg -> dev_dbg conversion.

* tag 'usb-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (339 commits)
  USB: ezusb: move ezusb.c from drivers/usb/serial to drivers/usb/misc
  USB: uas: fix gcc warning
  USB: uas: fix locking
  USB: Fix race condition when removing host controllers
  USB: uas: add locking
  USB: uas: fix abort
  USB: uas: remove aborted field, replace with status bit.
  USB: uas: fix task management
  USB: uas: keep track of command urbs
  xhci: Intel Panther Point BEI quirk.
  powerpc/usb: remove checking PHY_CLK_VALID for UTMI PHY
  USB: ftdi_sio: add TIAO USB Multi-Protocol Adapter (TUMPA) support
  Revert "usb : Add sysfs files to control port power."
  USB: serial: remove vizzini driver
  usb: host: xhci: Fix Null pointer dereferencing with 71c731a for non-x86 systems
  Increase XHCI suspend timeout to 16ms
  USB: ohci-at91: fix null pointer in ohci_hcd_at91_overcurrent_irq
  USB: sierra_ms: don't keep unused variable
  fsl/usb: Add support for USB controller version 2.4
  USB: qcaux: add Pantech vendor class match
  ...
2012-10-01 13:23:01 -07:00
navin cbf7d122cc staging: usbip: vhci_hcd: Fixed oops during removal of vhci_hcd
In response to "usbip detach -p [port_number]" user command,vhci_shutdown_connection() gets
executed which kills tcp_tx,tcp_rx kernel threads but doesn't set thread pointers to NULL.
so, at the time of vhci_hcd removal vhci_shutdown_connection() again tries to kill kernel
threads which are already killed.

[  312.220259] BUG: unable to handle kernel NULL pointer dereference at           (null)
[  312.220313] IP: [<ffffffff8108186f>] exit_creds+0x1f/0x70
[  312.220349] PGD 5b7be067 PUD 5b7dc067 PMD 0
[  312.220388] Oops: 0000 [#1] SMP
[  312.220415] Modules linked in: vhci_hcd(O-) usbip_host(O) usbip_core(O) uas usb_storage joydev parport_pc bnep rfcomm ppdev binfmt_misc
snd_hda_codec_hdmi snd_hda_codec_conexant snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_seq_midi arc4 snd_rawmidi snd_seq_midi_event snd_seq
ath9k mac80211 ath9k_common ath9k_hw snd_timer snd_seq_device snd ath i915 drm_kms_helper drm psmouse cfg80211 coretemp soundcore lpc_ich i2c_algo_bit
snd_page_alloc video intel_ips wmi btusb mac_hid bluetooth ideapad_laptop lp sparse_keymap serio_raw mei microcode parport r8169
[  312.220862] CPU 0
[  312.220882] Pid: 2095, comm: usbip_eh Tainted: G           O 3.6.0-rc3+ #2 LENOVO 20042                           /Base Board Product Name
[  312.220938] RIP: 0010:[<ffffffff8108186f>]  [<ffffffff8108186f>] exit_creds+0x1f/0x70
[  312.220979] RSP: 0018:ffff88004d6ebdb0  EFLAGS: 00010282
[  312.221008] RAX: 0000000000000000 RBX: ffff880041c4db40 RCX: ffff88005ad52230
[  312.221041] RDX: 0000000000000034 RSI: 0000000000000286 RDI: 0000000000000000
[  312.221074] RBP: ffff88004d6ebdc0 R08: ffff88004d6ea000 R09: 0000000000000000
[  312.221107] R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
[  312.221144] R13: 0000000000000000 R14: ffff88005ad521d8 R15: ffff88004d6ebea0
[  312.221177] FS:  0000000000000000(0000) GS:ffff880077400000(0000) knlGS:0000000000000000
[  312.221214] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  312.221241] CR2: 0000000000000000 CR3: 000000005b7b9000 CR4: 00000000000007f0
[  312.221277] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  312.221309] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  312.221342] Process usbip_eh (pid: 2095, threadinfo ffff88004d6ea000, task ffff88004d44db40)
[  312.221384] Stack:
[  312.221396]  ffff88004d6ebdc0 ffff880041c4db40 ffff88004d6ebde0 ffffffff81052aaa
[  312.221442]  ffff880041c4db40 0000000000000000 ffff88004d6ebe10 ffffffff8107a148
[  312.221487]  ffff88005ad521f0 ffff88005ad52228 ffff88004d44db40 ffff88005ad521d8
[  312.221536] Call Trace:
[  312.221556]  [<ffffffff81052aaa>] __put_task_struct+0x4a/0x140
[  312.221587]  [<ffffffff8107a148>] kthread_stop+0x108/0x110
[  312.221616]  [<ffffffffa0412569>] vhci_shutdown_connection+0x49/0x2b4 [vhci_hcd]
[  312.221657]  [<ffffffffa0139920>] event_handler_loop+0x70/0x140 [usbip_core]
[  312.221692]  [<ffffffff8107ad30>] ? add_wait_queue+0x60/0x60
[  312.221721]  [<ffffffffa01398b0>] ? usbip_stop_eh+0x30/0x30 [usbip_core]
[  312.221754]  [<ffffffff8107a453>] kthread+0x93/0xa0
[  312.221784]  [<ffffffff81670e84>] kernel_thread_helper+0x4/0x10
[  312.221814]  [<ffffffff8107a3c0>] ? flush_kthread_worker+0xb0/0xb0
[  312.223589]  [<ffffffff81670e80>] ? gs_change+0x13/0x13
[  312.225360] Code: 0b 0f 0b 66 0f 1f 84 00 00 00 00 00 55 48 89 e5 53 48 83 ec 08 66 66 66 66 90 48 8b 87 58 04 00 00 48 89 fb 48 8b bf 50 04 00 00
<8b> 00 48 c7 83 50 04 00 00 00 00 00 00 f0 ff 0f 0f 94 c0 84 c0
[  312.229663] RIP  [<ffffffff8108186f>] exit_creds+0x1f/0x70
[  312.231696]  RSP <ffff88004d6ebdb0>
[  312.233648] CR2: 0000000000000000
[  312.256464] ---[ end trace 1971ce612a167279 ]---

Signed-off-by: navin patidar <navinp@cdac.in>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-21 08:56:40 -07:00
navin b7caecb8c9 staging: usbip: stub_dev: Fixed oops during removal of usbip_host
stub_shutdown_connection() should set kernel thread pointers to NULL after killing them.
so that at the time of usbip_host removal stub_shutdown_connection() doesn't try to kill kernel threads
which are already killed.

[ 1504.312158] BUG: unable to handle kernel NULL pointer dereference at           (null)
[ 1504.315833] IP: [<ffffffff8108186f>] exit_creds+0x1f/0x70
[ 1504.317688] PGD 41f1c067 PUD 41d0f067 PMD 0
[ 1504.319611] Oops: 0000 [#2] SMP
[ 1504.321480] Modules linked in: vhci_hcd(O) usbip_host(O-) usbip_core(O) uas usb_storage joydev parport_pc bnep rfcomm ppdev binfmt_misc
snd_hda_codec_hdmi snd_hda_codec_conexant snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_seq_midi arc4 snd_rawmidi snd_seq_midi_event
snd_seq ath9k mac80211 ath9k_common ath9k_hw snd_timer snd_seq_device snd ath i915 drm_kms_helper drm psmouse cfg80211 coretemp soundcore
lpc_ich i2c_algo_bit snd_page_alloc video intel_ips wmi btusb mac_hid bluetooth ideapad_laptop lp sparse_keymap serio_raw mei microcode parport r8169
[ 1504.329666] CPU 1
[ 1504.329687] Pid: 2434, comm: usbip_eh Tainted: G      D    O 3.6.0-rc31+ #2 LENOVO 20042                           /Base Board Product Name
[ 1504.333502] RIP: 0010:[<ffffffff8108186f>]  [<ffffffff8108186f>] exit_creds+0x1f/0x70
[ 1504.335371] RSP: 0018:ffff880041c7fdd0  EFLAGS: 00010282
[ 1504.337226] RAX: 0000000000000000 RBX: ffff880041c2db40 RCX: ffff880041e4ae50
[ 1504.339101] RDX: 0000000000000044 RSI: 0000000000000286 RDI: 0000000000000000
[ 1504.341027] RBP: ffff880041c7fde0 R08: ffff880041c7e000 R09: 0000000000000000
[ 1504.342934] R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
[ 1504.344840] R13: 0000000000000000 R14: ffff88004d448000 R15: ffff880041c7fea0
[ 1504.346743] FS:  0000000000000000(0000) GS:ffff880077440000(0000) knlGS:0000000000000000
[ 1504.348671] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 1504.350612] CR2: 0000000000000000 CR3: 0000000041d0d000 CR4: 00000000000007e0
[ 1504.352723] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 1504.354734] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[ 1504.356737] Process usbip_eh (pid: 2434, threadinfo ffff880041c7e000, task ffff88004d448000)
[ 1504.358711] Stack:
[ 1504.360635]  ffff880041c7fde0 ffff880041c2db40 ffff880041c7fe00 ffffffff81052aaa
[ 1504.362589]  ffff880041c2db40 0000000000000000 ffff880041c7fe30 ffffffff8107a148
[ 1504.364539]  ffff880041e4ae10 ffff880041e4ae00 ffff88004d448000 ffff88004d448000
[ 1504.366470] Call Trace:
[ 1504.368368]  [<ffffffff81052aaa>] __put_task_struct+0x4a/0x140
[ 1504.370307]  [<ffffffff8107a148>] kthread_stop+0x108/0x110
[ 1504.370312]  [<ffffffffa040da4e>] stub_shutdown_connection+0x3e/0x1b0 [usbip_host]
[ 1504.370315]  [<ffffffffa03fd920>] event_handler_loop+0x70/0x140 [usbip_core]
[ 1504.370318]  [<ffffffff8107ad30>] ? add_wait_queue+0x60/0x60
[ 1504.370320]  [<ffffffffa03fd8b0>] ? usbip_stop_eh+0x30/0x30 [usbip_core]
[ 1504.370322]  [<ffffffff8107a453>] kthread+0x93/0xa0
[ 1504.370327]  [<ffffffff81670e84>] kernel_thread_helper+0x4/0x10
[ 1504.370330]  [<ffffffff8107a3c0>] ? flush_kthread_worker+0xb0/0xb0
[ 1504.370332]  [<ffffffff81670e80>] ? gs_change+0x13/0x13
[ 1504.370351] Code: 0b 0f 0b 66 0f 1f 84 00 00 00 00 00 55 48 89 e5 53 48 83 ec 08 66 66 66 66 90 48 8b 87 58 04 00 00 48 89 fb 48 8b bf 50 04 00 00
<8b> 00 48 c7 83 50 04 00 00 00 00 00 00 f0 ff 0f 0f 94 c0 84 c0
[ 1504.370353] RIP  [<ffffffff8108186f>] exit_creds+0x1f/0x70
[ 1504.370353]  RSP <ffff880041c7fdd0>
[ 1504.370354] CR2: 0000000000000000
[ 1504.401376] ---[ end trace 1971ce612a16727a ]---

Signed-off-by: navin patidar <navinp@cdac.in>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-21 08:56:39 -07:00
Greg Kroah-Hartman ba753e4180 Staging: remove CONFIG_EXPERIMENTAL dependancies
As discussed at the kernel summit this year, CONFIG_EXPERIMENTAL means
nothing, so let's get rid of it.

Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-17 23:02:36 -07:00
Lan Tianyu ff823c79a5 usb: move children to struct usb_port
The usb_device structure contains an array of usb_device "children".
This array is only valid if the usb_device is a hub, so it makes no
sense to store it there.  Instead, store the usb_device child
in its parent usb_port structure.

Since usb_port is an internal USB core structure, add a new function to
get the USB device child, usb_hub_find_child().  Add a new macro,
usb_hub_get_each_child(), to iterate over all the children attached to a
particular USB hub.

Remove the printing the USB children array pointer from the usb-ip
driver, since it's really not necessary.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 12:59:42 -07:00
navin patidar 107f04bbce staging: usbip: vhci_hcd: fixed suspend-resume loop
USB autosuspend suspends vhci_hcd. In this process hcd_bus_suspend gets
executed which puts vhci_hcd in suspend state and calls vhci_hub_status.
vhci_hub_status function checks hub state and if it is in suspend state,
usb_hcd_resume_root_hub gets executed which resumes hub and if hub is
idle, again autosuspend puts it in suspend state and this goes on.

vhci_hub_status should resume hub only when hub port is in suspend state
and hub port status has changed.

Signed-off-by: navin patidar <navinp@cdac.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-06 09:31:54 -07:00
Bernard Blackham 236742de5b staging: usbip: avoid deadlock in vhci_device_unlink_cleanup()
Almost all of usbip assumes that the_controller->lock is acquired
before vdev->priv_lock. The exception is in
vhci_device_unlink_cleanup(), where locks are acquired in the
reverse order. This leads to occasional deadlocks.

Fixing this is a bit fiddly, as the_controller->lock can't be held
when calling usb_hcd_unlink_urb_from_ep() in the middle of the list
traversal. As I can't rule out concurrent callers to this function
(perhaps it is safe?), the code here becomes slightly uglier - when
locks are dropped in the middle so the list may have emptied itself
(not even list_for_each_entry_safe is safe here).

Signed-off-by: Bernard Blackham <b-linuxgit@largestprime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-06 09:31:53 -07:00
W. Trevor King 4faf3a8d18 staging: usbip: userspace: update man pages for v1.0.0
This brings them back up to date after:

  commit e9837bbb3e
  Author: matt mooney <mfm@muteddisk.com>
  Date:   Thu May 26 06:17:11 2011 -0700

    staging: usbip: userspace tools v1.0.0

I couldn't find a current equivalent for

  client:# usbip --port

Perhaps that functionality has been deprecated due to better logging.
It seems like libsrc/usbip_common.h's usbip_status_string is no longer
used.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-17 09:44:04 -07:00
W. Trevor King ce591f76c7 staging: usbip: userspace: allow configure --with-tcp-wrappers
When `--with-tcp-wrappers` is passed to `configure`, the previous code
always reset LIBS to $saved_LIBS, regardless of whether libwrap was
found or not.  The current code makes the `--with-tcp-wrappers` case
look more like the default case, and it only resets LIBS if libwrap
was not found.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-17 09:44:04 -07:00
W. Trevor King 93efc55b42 staging: usbip: export usbip_debug_flag as a usbip-core module parameter.
Now usbip_common.c's pr_fmt is the only thing setup by CONFIG_USBIP_DEBUG
that you can't subsequently alter using this parameter.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-17 09:44:04 -07:00
Justin P. Mattock 4ec2601f6f staging "usbip" Fix typos.
Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-13 19:32:14 -07:00
Bart Westgeest 7489301a15 staging: usbip: cleanup and fix of vhci_hub_status
Changed setting the status bits to a byte-oriented approach. Number of
written status bits is now based on VHCI_NPORT, instead of casting
status buffer to a long. This fixes a stack corruption bug on 64-bit
based architectures, and potential byte order / endianness related
issues.

In addition updated function comments, and log statements.

Signed-off-by: Bart Westgeest <bart@elbrys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:22:57 -07:00
Bart Westgeest 1132b9aafa staging: usbip: Updated comment describing VHCI_NPORTS
Updated out-of-date comment describing VHCI_NPORT

Signed-off-by: Bart Westgeest <bart@elbrys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-11 17:06:35 -07:00
Natanael Copa e034410a3d staging: usbip: userspace: include headers in release tarballs
The header files should be included in generated tarballs for archives.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-11 09:07:43 -07:00
Masanari Iida 73e2918990 staging: Fix typo in multiple files
Collect spelling typo in multiple files within staging directory.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:31:01 -07:00
Christopher Harvey 3567f97965 staging: usbip: Fix typo in printed text
Signed-off-by: Christopher Harvey <charvey@matrox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:47:06 -07:00
Christopher Harvey 2f5c638ced staging: usbip: fix potential segfault because of unchecked return value of strchr.
This doesn't happen with the usbip virtual hci module, but another
module wanting to interface with this user space code could cause a
seg-fault by sending data without newlines.

Signed-off-by: Christopher Harvey <charvey@matrox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:47:06 -07:00
Oleg Nesterov ba46ce30f1 staging: usbip: fix the usage of kthread_stop()
stub_shutdown_connection() and vhci_shutdown_connection() use
task_is_dead() before kthread_stop(). This buys nothing and wrong.
kthread_stop() is fine even if this thread is dead. However, if it
is dead nothing protects this task_struct, we shouldn't touch this
memory.

Change the code to do the necessary get_task_struct/put_task_struct.

This patch assumes that

	- xxx_shutdown_connection() is always called, so we can't
	  leak the task_struct.

	- kthread_stop_put() can't be called twice on the same task.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Tobias Klauser <tklauser@distanz.ch>
Cc: Matt Mooney <mfm@muteddisk.com>,
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:28:04 -07:00
Santosh Nayak ea50a5da79 Staging: usbip: Remove commented code.
Remove commented code of old style lock initilization

Signed-off-by: Santosh Nayak <santoshprasadnayak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-24 11:59:57 -08:00
Greg Kroah-Hartman b91867f2ee Merge tag 'staging-3.3-rc3' into staging-next
This was done to resolve some merge issues with the following files that
had changed in both branches:
	drivers/staging/rtl8712/rtl871x_sta_mgt.c
	drivers/staging/tidspbridge/rmgr/drv_interface.c
	drivers/staging/zcache/zcache-main.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-10 10:58:25 -08:00
Bart Westgeest 34c0957817 staging: usbip: removed #if 0'd out code
Signed-off-by: Bart Westgeest <bart@elbrys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-09 09:42:23 -08:00
Bart Westgeest ac2b41acfa staging: usbip: changed function return type to void
The function usbip_pad_iso never returns anything but 0 (success).

Signed-off-by: Bart Westgeest <bart@elbrys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-09 09:42:23 -08:00
Bart Westgeest 98b9de2189 staging: usbip: removed unused structure field
Signed-off-by: Bart Westgeest <bart@elbrys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-09 09:42:22 -08:00
Bart Westgeest 737912e11b staging: usbip: fix to prevent potentially using uninitialized spinlock
The stub_probe function can be called as soon as the stub_driver is
registered. This can lead to the busid_table_lock being used before it
is initialized. Moved calling the init_busid_table function (which
initalizes this spinlock) to be called earlier in the init function to
prevent this from happening.

Signed-off-by: Bart Westgeest <bart@elbrys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-08 14:14:15 -08:00
Bart Westgeest 75fe8c8b90 staging: usbip: removed unused definitions from header
Removed remnants of old function definitions which have since been
removed in earlier cleanup work.

Signed-off-by: Bart Westgeest <bart@elbrys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-22 13:40:03 -08:00
Bart Westgeest 5a08c5267e staging: usbip: removed dead code from receive function
The usbip_xmit function supported sending and receiving data, however
the sending part of the function was never used/executed. Renamed the
function to usbip_recv, and removed the unused code.

Signed-off-by: Bart Westgeest <bart@elbrys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-22 13:40:03 -08:00
Bart Westgeest 438957f8d4 staging: usbip: bugfix for deadlock
Interrupts must be disabled prior to calling usb_hcd_unlink_urb_from_ep.
If interrupts are not disabled, it can potentially lead to a deadlock.
The deadlock is readily reproduceable on a slower (ARM based) device
such as the TI Pandaboard.

Signed-off-by: Bart Westgeest <bart@elbrys.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26 17:37:38 -08:00
Paul Gortmaker 452962366c staging: Add module.h to more drivers implicitly using it.
This 2nd batch of implicit module.h users only appeared when we
removed the unnecessary module.h from include/linux/miscdevice.h
[The 1st batch is already present in Greg's staging tree.]

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:32:10 -04:00
Paul Gortmaker 8e336a722b staging: Add export.h for THIS_MODULE/EXPORT_SYMBOL to drivers/staging users.
Lots of drivers have in the past expected the presence of basic things
like THIS_MODULE and EXPORT_SYMBOL.  With the header cleanup, they wont
have these.  Call out the include explicitly.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:32:08 -04:00
Alexander Thomas 7518b9b8fc staging: usbip: fix up api changes that broke windows clients
Revert changes in definitions that were submitted on May 11 2011 and
committed on June 7 2011. No reason for the change in these values was
given in the patch comment, it broke compatibility with older
versions, and was difficult to detect by the simultaneous move of the
lines of code.

Signed-off-by: Alexander Thomas <alexander.thomas@esaturnus.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-19 10:45:03 -07:00
Paul Gortmaker 99c978529a staging: Add module.h to drivers/staging users
Lots of people expect module.h to just "be there" without
any #include effort.  But we are crushing that.  So fix those
files in staging relying on implicit module.h presence.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-25 17:01:20 -07:00
Greg Kroah-Hartman a813833df8 Merge git://git.kernel.org/pub/scm/linux/kernel/git/lwfinger/r8192E into staging-next
* git://git.kernel.org/pub/scm/linux/kernel/git/lwfinger/r8192E: (61 commits)
  staging: rtl8192e: Fix compilation warnings
  staging: rtl8192e: Fix unload/reload problem
  staging: rtl8192e: Remove dead code associated with CONFIG_RTL_RFKILL
  staging: rtl8192e: Remove conditional code associated with EEPROM_OLD_FORMAT_SUPPORT
  staging: rtl8192e: Remove dead code associated with EFUSE_REPG_WORKAROUND
  staging: rtl8192e: Remove LOOP_TEST as parameter
  staging: rtl8192e: Remove dead code associated with CONFIG_FW_SETCHAN
  staging: rtl8192e: Remove dead code associated with CONFIG_RTLWIFI_DEBUGFS
  staging: rtl8192e: Remove dead code associated with _RTL8192_EXT_PATCH_
  staging: rtl8192e: Remove ifdefs for CONFIG_RTLLIB_DEBUG
  staging: rtl8192e: Remove dead code associated with RTL819x_DEBUG
  staging: rtl8192e: Remove dead code associated with _ENABLE_SW_BEACON
  staging: rtl8192e: Remove dead code associated with CONFIG_CRYPTO_HMAC
  staging: rtl8192e: Remove dead code associated with CONFIG_BT_30
  staging: rtl8192e: Remove dead code associated with ENABLE_NULL_PT_DEBUG
  staging: rtl8192e: Remove dead code associated with CONFIG_64BIT_DMA
  staging: rtl8192e: Remove dead code associated with CONFIG_RTLLIB_CRYPT_TKIP
  staging: rtl8192e: Remove dead code associated with IRQF_SHARED
  staging: rtl8192e: Remove dead code associated with CONFIG_CFG_80211
  staging: rtl8192e: Remove dead code associated with BUILT_IN_CRYPTO
  ...
2011-08-23 21:17:36 -07:00
Julia Lawall 9358354858 drivers/staging/usbip/userspace/libsrc/vhci_driver.c: test the just-initialized value
Test the just-initialized value rather than some other one.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
statement S;
@@

x = f(...);
(
if (\(x == NULL\|IS_ERR(x)\)) S
|
*if (\(y == NULL\|IS_ERR(y)\))
 { ... when != x
   return ...; }
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: David Chang <dchang@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 14:42:34 -07:00
Tobias Klauser 306dac699e staging: usbip: Add header guards to stub.h and vhci.h
stub.h and vhci.h are missing proper #ifndef/#define header guards, so
add them.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 14:42:34 -07:00
Márton Németh c8742cf07d staging: usbip: add a usbip protocol document
Initial version of USBIP protocol document.

Signed-off-by: David Chang <dchang@suse.com>
Acked-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 14:42:34 -07:00
Tobias Klauser 549fb10097 staging: usbip: userspace: Check return value for mkdir()
mkdir() could fail, so we should check its return value.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 14:42:33 -07:00
Akshay Joshi 97c451ca10 Staging: usbip: Fix braces and spaces to match coding style.
Fix brace positioning and spaces at the start of lines in order to
comply with the kernel coding style.

Signed-off-by: Akshay Joshi <me@akshayjoshi.com>
Acked-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 14:42:33 -07:00
Akshay Joshi 553a1a5065 Staging: usbip: Remove trailing spaces.
Remove trailing spaces to comply with the kernel coding style.

Signed-off-by: Akshay Joshi <me@akshayjoshi.com>
Acked-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 14:42:33 -07:00
Larry Finger 275d38585c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
Conflicts:
	Documentation/feature-removal-schedule.txt
	drivers/staging/bcm/headers.h
	drivers/staging/brcm80211/brcmfmac/dhd_linux.c
	drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
	drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
	drivers/staging/et131x/et131x_netdev.c
	drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
	drivers/staging/rtl8192e/r8192E.h
	drivers/staging/usbip/userspace/src/utils.h
2011-08-01 12:33:12 -05:00
Larry Finger 48d67fe035 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
Conflicts:
	Documentation/feature-removal-schedule.txt
	drivers/staging/bcm/headers.h
	drivers/staging/brcm80211/brcmfmac/dhd_linux.c
	drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
	drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
	drivers/staging/brcm80211/brcmfmac/wl_iw.c
	drivers/staging/et131x/et131x_netdev.c
	drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
	drivers/staging/rtl8192e/r8192E.h
	drivers/staging/usbip/userspace/src/utils.h
2011-07-26 15:52:24 -05:00
matt mooney 0aee588945 staging: usbip: userspace: usbip-utils 1.1.1
Bump package revision number!

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-08 14:01:18 -07:00
matt mooney 45dd9a98f7 staging: usbip: userspace: README: update example output
Change a missed reference to the `list' command, and update the output
from `usbip bind ...' and `usbip list -r ...'

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-08 14:01:17 -07:00
matt mooney 2435ab147b staging: usbip: userspace: usbip: modify `list' help message
The remote devices listed are, technically, exportable and not
necessarily exported.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-08 14:01:17 -07:00
matt mooney fcedd169be staging: usbip: userspace: usbip_list.c: modify exportable device output
Change spacing to provide better indentation for readability.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-08 14:01:16 -07:00
matt mooney dffb9649d3 staging: usbip: userspace: fix header installation bug
A bug that I created due to using simply expanding variables in the
makefiles. Although only unexpanded paths are at issue here, I decided
to use recursively expanding variables on all of the parameterized
values.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-08 14:01:16 -07:00
matt mooney 3c6e9e8f35 staging: usbip: userspace: add new prefix for usbip network code
Change and add new usbip_net_ prefix to every function in the network
code for easier identification.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-08 14:01:15 -07:00
matt mooney e2ec6b4e39 staging: usbip: userspace: usbipd: major cleanup of daemon
Reorganize, rename [for clarity and to remove stub_driver
references], modify output messages, and cleanup coding style;
nevertheless, the actual implementation is pretty much untouched.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-08 14:01:15 -07:00
Randy Dunlap 6394c5a037 staging: fix usbip printk format warning
Fix usbip printk format warning for size_t:

drivers/staging/usbip/stub_tx.c:236: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'size_t'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-08 13:59:55 -07:00
David Chang 7104b5df5b staging: usbip: userspace: usbipd.c: fix userspace build error
When build userspace code, got the following error message:
make[2]: Entering directory `/usr/src/staging-2.6/drivers/staging/usbip/userspace/src'
  CC     usbip.o
...
  CCLD   usbip
  CC     usbipd.o
usbipd.c:30:25: fatal error: stub_driver.h: No such file or directory
compilation terminated.
make[2]: *** [usbipd.o] Error 1
make[2]: Leaving directory `/usr/src/staging-2.6/drivers/staging/usbip/userspace/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/staging-2.6/drivers/staging/usbip/userspace'
make: *** [all] Error 2

Due to commit 756d6726 and a16941ae, stub_driver had been changed
into host_driver, so update header filename and functions name to
fix these build errors

Signed-off-by: David Chang <dchang@novell.com>
CC: Joe Perches <joe@perches.com>
Cc: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-06 08:22:48 -07:00
Arjan Mels 1aee199cad drivers/staging/usbip: bugfix prevent driver unbind regression in linux-next
Fix regression problem in linux-next: post_reset and pre_reset are no longer
included in linux-next while they are in linux-3.0rc5.

Signed-off-by: Arjan Mels <arjan.mels@gmx.net>
Cc: usbip-devel <usbip-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:14:10 -07:00
Tobias Klauser 8547d4cc2b Staging: usbip: vhci-hcd: Do not kill already dead RX/TX kthread
When unbinding a device on the host which was still attached on the
client, I got a NULL pointer dereference on the client. This turned out
to be due to kthread_stop() being called on an already dead kthread.

Here is how I was able to reproduce the problem:

 server:# usbip bind -b 1-2
                                client:# usbip attach -h server -b 1-2
 server:# usbip unbind -b 1-2

This patch fixes the problem by checking the kthread before attempting
to kill it, as it is done on the opposite side in
stub_shutdown_connection().

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:14:10 -07:00
matt mooney c88f9906c3 staging: usbip: userspace: configure.ac: change package data
Change package name to usbip-utils, email address to linux-usb, and
bump minor version number.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:12:17 -07:00
matt mooney fb5ca8131c staging: usbip: userspace: usbip_network.c: coding style cleanup
Change messges to debug, and fix a few coding style issues.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:12:12 -07:00
matt mooney 756d6726f8 staging: usbip: userspace: usbip_host: update function and variable names
Officially change stub_driver to usbip_host_driver. And, reorganize
usbip_host_driver.c while also cleaning up coding style.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:35 -07:00
matt mooney a16941aef1 staging: usbip: userspace: rename stub driver files
Rename stub_driver.? to usbip_host_driver.?

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:35 -07:00
matt mooney b9d65b1dd3 staging: usbip: userspace: usbip list: move output header
Delay the printing of the output header until the list is received
from the remote host. This allows notification that the host does not
have any exportable devices.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:35 -07:00
matt mooney 622dde8105 staging: usbip: userspace: usbip list: edit output messages
Edit dbg and normal output messages for consistency and better
feedback.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:34 -07:00
matt mooney 9cda570411 staging: usbip: userspace: usbip_unbind.c: implement using libsysfs
Modify unbind to use libsysfs, and include a check to verify that the
device is actually using usbip-host before proceeding. The output
messages have been changed to be consistent with `usbip bind'.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:34 -07:00
matt mooney 06c465f5d2 staging: usbip: userspace: usbip_bind.c: major rewrite of the implementation
Rewrite functions in terms of libsysfs, which eliminates a lot of
helper functions simplifying the file layout. Now, the two processes
taking place here, an unbind of the old driver and a bind of
usbip-host, are single functions and have been renamed along with the
controlling function. A check to see if the device is already bound to
usbip-host is now included.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:34 -07:00
matt mooney 30f0554659 staging: usbip: userspace: utils.c: rewrite modify_match_busid
Rewrite the function to use libsysfs.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:34 -07:00
matt mooney 42685d577f staging: usbip: userspace: utils: remove libsysfs circumvention
Removes all of the helper functions that used a lot of hard-coded
values intead of libsysfs. Most of these functions were unused
anyway.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:34 -07:00
matt mooney 4737d7e332 staging: usbip: userspace: usbip: modify command failure
When a bad option is given, display a message stating such and output
usage. When a bad command is given, output command help.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:34 -07:00
matt mooney 25567a3979 staging: usbip: userspace: libsrc: change all output messages to debug
The library should not be displaying random messages intermixed with
those from the programs that use them. So, instead, change all of the
output from the library to debug only, and allow the programs to
decide what to tell the user. This also changes the messages to use
the same form, which makes understanding them easier.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:33 -07:00
matt mooney 099f79fa5a staging: usbip: userspace: libsrc: remove usbip.h
Remove the library version of usbip.h because its sole purpose was to
include other headers, which is bad practice. Also modify include
guards for consistency.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:33 -07:00
matt mooney c93be5b178 staging: usbip: userspace: usbip.c: add log option
Add option for logging with syslog, and default to use stderr for
error and info messages.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:33 -07:00
matt mooney f2fb62b371 staging: usbip: userspace: libsrc: set program name for logging
Set the program name to "libusbip" to identify that the message is
from the library code.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:33 -07:00
matt mooney 4fd83e84d5 staging: usbip: userspace: usbip_common.h: fixup header includes
Remove unnecessary headers from the file, and add the now missing
headers into the files that actually need them.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:33 -07:00
matt mooney 93e18e0ece staging: usbip: userspace: usbip_common.h: move enums
Relocate enums to follow logging macros.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:33 -07:00
matt mooney 213fd4adce staging: usbip: userspace: usbip_common.h: cleanup log macros
Provide better abstraction for easier modification, and align the
macros for readability. Remove notice() because it is not used.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:32 -07:00
matt mooney 9a20542fd2 staging: usbip: userspace: update cleanup.sh
Modify $FILES to account for the new directory layout. Also, sort the
list of files within the variable to make it human-readable.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 20:11:32 -07:00
matt mooney 89415218ad staging: usbip: userspace: cleanup README
Update examples to correspond with the new usbip-utils; edit grammar;
and cleanup format for consistency.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 19:59:48 -07:00
matt mooney e8323b834d staging: usbip: userspace: add name to AUTHORS
Add myself to the AUTHORS file.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 19:59:47 -07:00
matt mooney 7ddf1a0c48 staging: usbip: userspace: remove usb.ids file
Inclusion of the usb.ids file is redundant. USBIDS_DIR is set in
configure.ac to a default of /usr/share/hwdata/. This can be
overridden using `./configure --with-usbids-dir=<dir>'.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05 19:59:47 -07:00