2011-05-12 05:33:59

by matt mooney

[permalink] [raw]
Subject: [PATCH 1/2] staging: usbip: fix header includes

From: matt mooney <[email protected]>

Modify header directives to include what is needed by each file and
not already included in its own header.

Signed-off-by: matt mooney <[email protected]>
---
drivers/staging/usbip/stub.h | 9 ++++-----
drivers/staging/usbip/stub_dev.c | 2 +-
drivers/staging/usbip/stub_main.c | 2 +-
drivers/staging/usbip/stub_rx.c | 5 +++--
drivers/staging/usbip/stub_tx.c | 2 +-
drivers/staging/usbip/usbip_common.c | 8 ++++----
drivers/staging/usbip/usbip_common.h | 16 ++++++++++------
drivers/staging/usbip/usbip_event.c | 1 +
drivers/staging/usbip/vhci.h | 8 +++++++-
drivers/staging/usbip/vhci_hcd.c | 6 +++++-
drivers/staging/usbip/vhci_rx.c | 2 +-
drivers/staging/usbip/vhci_sysfs.c | 5 +++--
drivers/staging/usbip/vhci_tx.c | 2 +-
13 files changed, 42 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/usbip/stub.h b/drivers/staging/usbip/stub.h
index cd3a5bf..6592aa2 100644
--- a/drivers/staging/usbip/stub.h
+++ b/drivers/staging/usbip/stub.h
@@ -17,13 +17,12 @@
* USA.
*/

-#include <linux/kernel.h>
#include <linux/list.h>
-#include <linux/spinlock.h>
#include <linux/slab.h>
-#include <linux/string.h>
-#include <linux/module.h>
-#include <linux/net.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+#include <linux/usb.h>
+#include <linux/wait.h>

#define STUB_BUSID_OTHER 0
#define STUB_BUSID_REMOV 1
diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c
index 919d558..c71d0a3 100644
--- a/drivers/staging/usbip/stub_dev.c
+++ b/drivers/staging/usbip/stub_dev.c
@@ -17,7 +17,7 @@
* USA.
*/

-#include <linux/slab.h>
+#include <linux/device.h>
#include <linux/kthread.h>

#include "usbip_common.h"
diff --git a/drivers/staging/usbip/stub_main.c b/drivers/staging/usbip/stub_main.c
index a3c73b2..1f8fc5e 100644
--- a/drivers/staging/usbip/stub_main.c
+++ b/drivers/staging/usbip/stub_main.c
@@ -17,7 +17,7 @@
* USA.
*/

-#include <linux/slab.h>
+#include <linux/string.h>

#include "usbip_common.h"
#include "stub.h"
diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c
index e11ac2a..e245609 100644
--- a/drivers/staging/usbip/stub_rx.c
+++ b/drivers/staging/usbip/stub_rx.c
@@ -17,12 +17,13 @@
* USA.
*/

-#include <linux/slab.h>
+#include <asm/byteorder.h>
#include <linux/kthread.h>
+#include <linux/usb.h>
+#include <linux/usb/hcd.h>

#include "usbip_common.h"
#include "stub.h"
-#include <linux/usb/hcd.h>

static int is_clear_halt_cmd(struct urb *urb)
{
diff --git a/drivers/staging/usbip/stub_tx.c b/drivers/staging/usbip/stub_tx.c
index fc02261..3c332c2 100644
--- a/drivers/staging/usbip/stub_tx.c
+++ b/drivers/staging/usbip/stub_tx.c
@@ -17,8 +17,8 @@
* USA.
*/

-#include <linux/slab.h>
#include <linux/kthread.h>
+#include <linux/socket.h>

#include "usbip_common.h"
#include "stub.h"
diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c
index 6c44fa4..fb95edf 100644
--- a/drivers/staging/usbip/usbip_common.c
+++ b/drivers/staging/usbip/usbip_common.c
@@ -17,12 +17,12 @@
* USA.
*/

-#include <linux/kernel.h>
+#include <asm/byteorder.h>
#include <linux/file.h>
-#include <linux/tcp.h>
-#include <linux/in.h>
-#include <linux/kthread.h>
+#include <linux/fs.h>
+#include <linux/kernel.h>
#include <linux/slab.h>
+#include <net/sock.h>

#include "usbip_common.h"

diff --git a/drivers/staging/usbip/usbip_common.h b/drivers/staging/usbip/usbip_common.h
index aa5d576..fd84ab2 100644
--- a/drivers/staging/usbip/usbip_common.h
+++ b/drivers/staging/usbip/usbip_common.h
@@ -17,14 +17,18 @@
* USA.
*/

-#ifndef __VHCI_COMMON_H
-#define __VHCI_COMMON_H
+#ifndef __USBIP_COMMON_H
+#define __USBIP_COMMON_H

-#include <linux/version.h>
#include <linux/compiler.h>
+#include <linux/device.h>
+#include <linux/interrupt.h>
+#include <linux/net.h>
+#include <linux/printk.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
#include <linux/usb.h>
-#include <asm/byteorder.h>
-#include <net/sock.h>
+#include <linux/wait.h>

#define USBIP_VERSION "1.0.0"

@@ -366,4 +370,4 @@ void usbip_stop_eh(struct usbip_device *ud);
void usbip_event_add(struct usbip_device *ud, unsigned long event);
int usbip_event_happened(struct usbip_device *ud);

-#endif
+#endif /* __USBIP_COMMON_H */
diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c
index 8861e3b..da6074d 100644
--- a/drivers/staging/usbip/usbip_event.c
+++ b/drivers/staging/usbip/usbip_event.c
@@ -18,6 +18,7 @@
*/

#include <linux/kthread.h>
+
#include "usbip_common.h"

static int event_handler(struct usbip_device *ud)
diff --git a/drivers/staging/usbip/vhci.h b/drivers/staging/usbip/vhci.h
index d745c4e..d5bc8e7 100644
--- a/drivers/staging/usbip/vhci.h
+++ b/drivers/staging/usbip/vhci.h
@@ -17,8 +17,14 @@
* USA.
*/

-#include <linux/platform_device.h>
+#include <linux/device.h>
+#include <linux/list.h>
+#include <linux/spinlock.h>
+#include <linux/sysfs.h>
+#include <linux/types.h>
+#include <linux/usb.h>
#include <linux/usb/hcd.h>
+#include <linux/wait.h>

struct vhci_device {
struct usb_device *udev;
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c
index 7372d4d..facd58e 100644
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c
@@ -17,8 +17,12 @@
* USA.
*/

-#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
#include <linux/kthread.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>

#include "usbip_common.h"
#include "vhci.h"
diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c
index fedc442..2fe6cbf 100644
--- a/drivers/staging/usbip/vhci_rx.c
+++ b/drivers/staging/usbip/vhci_rx.c
@@ -17,8 +17,8 @@
* USA.
*/

-#include <linux/slab.h>
#include <linux/kthread.h>
+#include <linux/slab.h>

#include "usbip_common.h"
#include "vhci.h"
diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/staging/usbip/vhci_sysfs.c
index 4acded4..a684f22 100644
--- a/drivers/staging/usbip/vhci_sysfs.c
+++ b/drivers/staging/usbip/vhci_sysfs.c
@@ -17,11 +17,12 @@
* USA.
*/

+#include <linux/kthread.h>
+#include <linux/net.h>
+
#include "usbip_common.h"
#include "vhci.h"

-#include <linux/in.h>
-
/* TODO: refine locking ?*/

/* Sysfs entry to show port status */
diff --git a/drivers/staging/usbip/vhci_tx.c b/drivers/staging/usbip/vhci_tx.c
index 62c9acb..c1aa03b 100644
--- a/drivers/staging/usbip/vhci_tx.c
+++ b/drivers/staging/usbip/vhci_tx.c
@@ -17,8 +17,8 @@
* USA.
*/

-#include <linux/slab.h>
#include <linux/kthread.h>
+#include <linux/slab.h>

#include "usbip_common.h"
#include "vhci.h"
--
1.7.5.1


2011-05-12 05:34:02

by matt mooney

[permalink] [raw]
Subject: [PATCH 2/2] staging: usbip: edit Kconfig and rename CONFIG options

From: matt mooney <[email protected]>

Change modules usbip_common_mod to usbip-core and usbip to usbip-host;
edit configuration option help text; rename CONFIG options to use a
USBIP prefix and change COMMON to CORE in both the Kconfig and
Makefiles; edit the menu entries; and edit the driver descriptions.

Signed-off-by: matt mooney <[email protected]>
---
drivers/staging/Makefile | 2 +-
drivers/staging/usbip/Kconfig | 52 +++++++++++++++++----------------
drivers/staging/usbip/Makefile | 12 ++++----
drivers/staging/usbip/stub_main.c | 2 +-
drivers/staging/usbip/usbip_common.c | 4 +-
drivers/staging/usbip/vhci_hcd.c | 2 +-
6 files changed, 38 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 7d38925..e150a45 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -12,7 +12,7 @@ obj-$(CONFIG_VIDEO_CX25821) += cx25821/
obj-$(CONFIG_VIDEO_TM6000) += tm6000/
obj-$(CONFIG_DVB_CXD2099) += cxd2099/
obj-$(CONFIG_LIRC_STAGING) += lirc/
-obj-$(CONFIG_USB_IP_COMMON) += usbip/
+obj-$(CONFIG_USBIP_CORE) += usbip/
obj-$(CONFIG_W35UND) += winbond/
obj-$(CONFIG_PRISM2_USB) += wlan-ng/
obj-$(CONFIG_ECHO) += echo/
diff --git a/drivers/staging/usbip/Kconfig b/drivers/staging/usbip/Kconfig
index 466f0d3..dd13c02 100644
--- a/drivers/staging/usbip/Kconfig
+++ b/drivers/staging/usbip/Kconfig
@@ -1,43 +1,45 @@
-config USB_IP_COMMON
- tristate "USB IP support (EXPERIMENTAL)"
+config USBIP_CORE
+ tristate "USB/IP support (EXPERIMENTAL)"
depends on USB && NET && EXPERIMENTAL
default N
---help---
This enables pushing USB packets over IP to allow remote
- machines access to USB devices directly. For more details,
- and links to the userspace utility programs to let this work
- properly, see http://usbip.sourceforge.net/.
+ machines direct access to USB devices. It provides the
+ USB/IP core that is required by both drivers.

- To compile this driver as a module, choose M here: the
- module will be called usbip_common_mod.
+ For more details, and to get the userspace utility
+ programs, please see http://usbip.sourceforge.net/.
+
+ To compile this as a module, choose M here: the module will
+ be called usbip-core.

If unsure, say N.

-config USB_IP_VHCI_HCD
- tristate "USB IP client driver"
- depends on USB_IP_COMMON
+config USBIP_VHCI_HCD
+ tristate "VHCI hcd"
+ depends on USBIP_CORE
default N
---help---
- This enables the USB IP host controller driver which will
- run on the client machine.
+ This enables the USB/IP virtual host controller driver,
+ which is run on the remote machine.

- To compile this driver as a module, choose M here: the
- module will be called vhci_hcd.
+ To compile this driver as a module, choose M here: the
+ module will be called vhci-hcd.

-config USB_IP_HOST
- tristate "USB IP host driver"
- depends on USB_IP_COMMON
+config USBIP_HOST
+ tristate "Host driver"
+ depends on USBIP_CORE
default N
---help---
- This enables the USB IP device driver which will run on the
- host machine.
+ This enables the USB/IP host driver, which is run on the
+ machine that is sharing the USB devices.

- To compile this driver as a module, choose M here: the
- module will be called usbip.
+ To compile this driver as a module, choose M here: the
+ module will be called usbip-host.

-config USB_IP_DEBUG
- bool "USB/IP debug messages"
- depends on USB_IP_COMMON
+config USBIP_DEBUG
+ bool "Debug messages for USB/IP"
+ depends on USBIP_CORE
default N
---help---
- This enables the debug messages from the USB-IP drivers.
+ This enables the debug messages from the USB/IP drivers.
diff --git a/drivers/staging/usbip/Makefile b/drivers/staging/usbip/Makefile
index a43a890..9ecd615 100644
--- a/drivers/staging/usbip/Makefile
+++ b/drivers/staging/usbip/Makefile
@@ -1,10 +1,10 @@
-ccflags-$(CONFIG_USB_IP_DEBUG) := -DDEBUG
+ccflags-$(CONFIG_USBIP_DEBUG) := -DDEBUG

-obj-$(CONFIG_USB_IP_COMMON) += usbip_common_mod.o
-usbip_common_mod-y := usbip_common.o usbip_event.o
+obj-$(CONFIG_USBIP_CORE) += usbip-core.o
+usbip-core-y := usbip_common.o usbip_event.o

-obj-$(CONFIG_USB_IP_VHCI_HCD) += vhci-hcd.o
+obj-$(CONFIG_USBIP_VHCI_HCD) += vhci-hcd.o
vhci-hcd-y := vhci_sysfs.o vhci_tx.o vhci_rx.o vhci_hcd.o

-obj-$(CONFIG_USB_IP_HOST) += usbip.o
-usbip-y := stub_dev.o stub_main.o stub_rx.o stub_tx.o
+obj-$(CONFIG_USBIP_HOST) += usbip-host.o
+usbip-host-y := stub_dev.o stub_main.o stub_rx.o stub_tx.o
diff --git a/drivers/staging/usbip/stub_main.c b/drivers/staging/usbip/stub_main.c
index 1f8fc5e..5568110 100644
--- a/drivers/staging/usbip/stub_main.c
+++ b/drivers/staging/usbip/stub_main.c
@@ -23,7 +23,7 @@
#include "stub.h"

#define DRIVER_AUTHOR "Takahiro Hirofuchi"
-#define DRIVER_DESC "Stub Driver for USB/IP"
+#define DRIVER_DESC "USB/IP Host Driver"

/* stub_priv is allocated from stub_priv_cache */
struct kmem_cache *stub_priv_cache;
diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c
index fb95edf..0f2cd97 100644
--- a/drivers/staging/usbip/usbip_common.c
+++ b/drivers/staging/usbip/usbip_common.c
@@ -27,9 +27,9 @@
#include "usbip_common.h"

#define DRIVER_AUTHOR "Takahiro Hirofuchi <[email protected]>"
-#define DRIVER_DESC "USB/IP Common Driver"
+#define DRIVER_DESC "USB/IP Core"

-#ifdef CONFIG_USB_IP_DEBUG
+#ifdef CONFIG_USBIP_DEBUG
unsigned long usbip_debug_flag = 0xffffffff;
#else
unsigned long usbip_debug_flag;
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c
index facd58e..fad10c5 100644
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c
@@ -28,7 +28,7 @@
#include "vhci.h"

#define DRIVER_AUTHOR "Takahiro Hirofuchi"
-#define DRIVER_DESC "Virtual Host Controller Interface Driver for USB/IP"
+#define DRIVER_DESC "USB/IP 'Virtual' Host Controller (VHCI) Driver"

/*
* TODO
--
1.7.5.1