[V2 PATCH 06/10] added media agnostic (MA) UDC
This is where we implement the behavior of a USB device controller for the MA USB device-side driver. The MA UDC interfaces with a gadget driver and appears to the driver as a regular UDC. However, instead of sending USB packets over a wired USB bus, the MA UDC hands MA USB packets off to a media specific layer for transport. Signed-off-by: Sean O. Stalley sean.stal...@intel.com Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com --- drivers/staging/mausb/drivers/mausb_udc.c | 1486 + drivers/staging/mausb/drivers/mausb_udc.h | 147 +++ 2 files changed, 1633 insertions(+) create mode 100644 drivers/staging/mausb/drivers/mausb_udc.c create mode 100644 drivers/staging/mausb/drivers/mausb_udc.h diff --git a/drivers/staging/mausb/drivers/mausb_udc.c b/drivers/staging/mausb/drivers/mausb_udc.c new file mode 100644 index 000..af00786 --- /dev/null +++ b/drivers/staging/mausb/drivers/mausb_udc.c @@ -0,0 +1,1486 @@ +/* name: mausb_udc.c + * description: Implements a USB device controller(UDC) for interfacing with + * gadget drivers. The gadget driver uses this interface to return + * descriptors and to implement configuration and data transfer + * protocols with the pHCD. The UDC also allocates and initializes + * endpoints to support gadget/pHCD interfacing. + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2014 Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Contact Information: + * Sean Stalley, sean.o.stal...@intel.com + * Stephanie Wallick, stephanie.s.wall...@intel.com + * 2111 NE 25th Avenue + * Hillsboro, Oregon 97124 + * + * BSD LICENSE + * + * Copyright(c) 2014 Intel Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. +* Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include linux/init.h +#include linux/module.h +#include linux/usb.h +#include linux/usb/hcd.h +#include linux/platform_device.h +#include linux/usb/ch11.h +#include linux/usb/gadget.h +#include linux/device.h +#include linux/usb/composite.h +#include linux/spinlock.h + +#include mausb_udc.h +#include mausb_mgmt.h +#include mausb_mem.h +#include mausb_msapi.h +#include mausb_tx.h + +static const char ep0[] = ep0; +static const char *const ep_name[] = {ep0, ep1, ep2}; + +static struct platform_device udc_pdev; + +void udc_dev_release(struct device *dev) +{ + /* free any dynamically allocated structures here */ +} + +static inline struct mausb_udc *gadget_to_udc(struct usb_gadget *gadget) +{ + return container_of(gadget, struct mausb_udc, gadget); +} + +static inline struct mausb_udc *gadget_dev_to_mausb_udc(struct device *dev) +{ + return container_of(dev, struct mausb_udc, gadget.dev); +} + +static inline struct mausb_request *usb_req_to_mausb_req( + struct usb_request *req) +{ + return container_of(req, struct mausb_request, req); +} + +static inline struct mausb_udc *mausb_ma_dev_to_udc(struct ma_dev
[V2 PATCH 04/10] added media agnostic (MA) USB packet handling
This is where we handle MA USB packets. The structure and types of MA USB packets are defined in the MA USB specification. When an MA USB driver receives a USB packet, it translates it into a MA USB packet (or packets if urb exceeds maximum USB packet size). When an MA USB packet is received, the data from that packet is given to the waiting USB packet and the USB packet is released. Signed-off-by: Sean O. Stalley sean.stal...@intel.com Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com --- drivers/staging/mausb/drivers/mausb_pkt.c | 1038 + drivers/staging/mausb/drivers/mausb_pkt.h | 914 + 2 files changed, 1952 insertions(+) create mode 100644 drivers/staging/mausb/drivers/mausb_pkt.c create mode 100644 drivers/staging/mausb/drivers/mausb_pkt.h diff --git a/drivers/staging/mausb/drivers/mausb_pkt.c b/drivers/staging/mausb/drivers/mausb_pkt.c new file mode 100644 index 000..c78cfc2 --- /dev/null +++ b/drivers/staging/mausb/drivers/mausb_pkt.c @@ -0,0 +1,1038 @@ +/* name: mausb_pkt.c + * description: MA USB packet helper functions + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2014 Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Contact Information: + * Sean Stalley, sean.stal...@intel.com + * Stephanie Wallick, stephanie.s.wall...@intel.com + * 2111 NE 25th Avenue + * Hillsboro, Oregon 97124 + * + * BSD LICENSE + * + * Copyright(c) 2014 Intel Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. +* Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include linux/slab.h +#include linux/usb/ch9.h +#include linux/usb.h + +#include mausb_mem.h +#include mausb_pkt.h +#include mausb_const.h + +/** + * Translates numerical packet type into corresponding string (for printing). + */ +const char *mausb_type_to_string(enum mausb_pkt_type type) +{ + switch (type) { + case CapReq: + return CapReq; + case CapResp: + return CapResp; + case USBDevHandleReq: + return USBDevHandleReq; + case USBDevHandleResp: + return USBDevHandleResp; + case EPHandleReq: + return EPHandleReq; + case EPHandleResp: + return EPHandleResp; + case EPActivateReq: + return EPActivateReq; + case EPActivateResp: + return EPActivateResp; + case EPInactivateReq: + return EPInactivateReq; + case EPInactivateResp: + return EPInactivateResp; + case EPResetReq: + return EPResetReq; + case EPResetResp: + return EPResetResp; + case EPClearTransferReq: + return EPClearTransferReq; + case EPClearTransferResp: + return EPClearTransferResp; + case EPHandleDeleteReq: + return EPHandleDeleteReq; + case EPHandleDeleteResp: + return EPHandleDeleteResp; + case
[V2 PATCH 03/10] added media agnostic (MA) data structures and handling
This is where we create, store and handle endpoint and device structures that are specific to the MA USB drivers. Each MA USB structure maps 1:1 with it's corresponding USB structure (e.g. there is one MA USB endpoint per USB endpoint). Signed-off-by: Sean O. Stalley sean.stal...@intel.com Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com --- drivers/staging/mausb/drivers/mausb_const.h| 109 drivers/staging/mausb/drivers/mausb_mem-host.c | 402 drivers/staging/mausb/drivers/mausb_mem-host.h | 74 +++ drivers/staging/mausb/drivers/mausb_mem.c | 842 + drivers/staging/mausb/drivers/mausb_mem.h | 509 +++ drivers/staging/mausb/drivers/mausb_state.h| 184 ++ 6 files changed, 2120 insertions(+) create mode 100755 drivers/staging/mausb/drivers/mausb_const.h create mode 100644 drivers/staging/mausb/drivers/mausb_mem-host.c create mode 100644 drivers/staging/mausb/drivers/mausb_mem-host.h create mode 100644 drivers/staging/mausb/drivers/mausb_mem.c create mode 100644 drivers/staging/mausb/drivers/mausb_mem.h create mode 100644 drivers/staging/mausb/drivers/mausb_state.h diff --git a/drivers/staging/mausb/drivers/mausb_const.h b/drivers/staging/mausb/drivers/mausb_const.h new file mode 100755 index 000..1089f81 --- /dev/null +++ b/drivers/staging/mausb/drivers/mausb_const.h @@ -0,0 +1,109 @@ +/* Name: mausb_const.h + * Description: This header describes the Media Agnostic USB constants + * that must be known by the both the host and device side drivers. + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2014 Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Contact Information: + * Sean Stalley, sean.stal...@intel.com + * Stephanie Wallick, stephanie.s.wall...@intel.com + * 2111 NE 25th Avenue + * Hillsboro, Oregon 97124 + * + * BSD LICENSE + * + * Copyright(c) 2014 Intel Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. +* Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __MAUSB_CONST_H +#define __MAUSB_CONST_H + +/* MA USB protocol constants per Table 68 of the MA USB Spec */ +#define MAUSB_DATA_CHANNEL_DELAY 400 /* temp value */ +#define MAUSB_MGMT_CHANNEL_DELAY ((100 * HZ)/1000 + 1) +#define MAUSB_MGMT_RESPONSE_DELAY ((5 * HZ)/1000 + 1) /* 5 msec */ +#define MAUSB_MGMT_RT_DELAY \ + ((MAUSB_MGMT_RESPONSE_DELAY + (2 * MAUSB_MGMT_CHANNEL_DELAY))) +#define MAUSB_TRANSFER_RESPONSE_TIME 10 /* 10 msec */ +#define MAUSB_TRANSFER_TIMEOUT \ + (MAUSB_TRANSFER_RESPONSE_TIME + (2 * MAUSB_DATA_CHANNEL_DELAY)) +#define MAUSB_TRANSFER_KEEP_ALIVE \ + (MAUSB_TRANSFER_RESPONSE_TIME + MAUSB_DATA_CHANNEL_DELAY) +#define MAUSB_DEFAULT_KEEP_ALIVE0 +#define MAUSB_MAX_TRANSFER_LIFETIME 1000 /* 1 sec */ +#define MAUSB_TRANSFER_REPEAT_TIME 10 /* 10 msec */ + +#define MAUSB_MAX_REQ_ID((1 8) - 1) +#define MAUSB_MAX_SEQ_NUM
[V2 PATCH 08/10] added media agnostic (MA) USB data packet handling
The MA USB Specification outlines packet types and a protocol for bulk and interrupt transfers. This is where we implement that protocol. MA USB transfers are initiated by the host via a TransferRequest packet. The host then either sends data to the device via subsequent TransferRequest packets (OUT transfer) or receives data from the device via TransferResponse packets (IN transfer). Each data transfer is identified by a Request ID number that increments up for each new transfer. One URB maps to one MA USB transfer. A transfer can consist of one or more MA USB packets depending on total transfer size. Each MA USB packet is assigned a Sequence Number with sequence numbers incrementing up for each new packet. The host sends a TransferAck packet to acknowledge the end of a transfer or when requested to do so by the device. Signed-off-by: Sean O. Stalley sean.stal...@intel.com Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com --- drivers/staging/mausb/drivers/mausb_tx-device.c | 845 drivers/staging/mausb/drivers/mausb_tx-host.c | 1209 +++ drivers/staging/mausb/drivers/mausb_tx.c| 316 ++ drivers/staging/mausb/drivers/mausb_tx.h| 127 +++ 4 files changed, 2497 insertions(+) create mode 100644 drivers/staging/mausb/drivers/mausb_tx-device.c create mode 100644 drivers/staging/mausb/drivers/mausb_tx-host.c create mode 100644 drivers/staging/mausb/drivers/mausb_tx.c create mode 100644 drivers/staging/mausb/drivers/mausb_tx.h diff --git a/drivers/staging/mausb/drivers/mausb_tx-device.c b/drivers/staging/mausb/drivers/mausb_tx-device.c new file mode 100644 index 000..7d1cab2 --- /dev/null +++ b/drivers/staging/mausb/drivers/mausb_tx-device.c @@ -0,0 +1,845 @@ +/* Name:mausb_tx_device.c + * Description: implements MA USB transfers on device side + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2014 Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Contact Information: + * Sean Stalley, sean.stal...@intel.com + * Stephanie Wallick, stephanie.s.wall...@intel.com + * 2111 NE 25th Avenue + * Hillsboro, Oregon 97124 + * + * BSD LICENSE + * + * Copyright(c) 2014 Intel Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. +* Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include mausb_hcd.h +#include mausb_udc.h +#include mausb_pkt.h +#include mausb_tx.h + +#include linux/kthread.h + +int device_transfer_timeout(void *data) +{ + struct mausb_host_ep*ep = (struct mausb_host_ep *) data; + struct mausb_udc*udc = mausb_host_ep_to_maudc(ep); + + while (!kthread_should_stop()) { + /* +* make sure actual transfer timeout (i.e. not thread +* setup) +*/ + if (ep-tx_timed_out) { + if (ep-state.retry_counter 0) { + maudc_dbg(udc, %s: device timed out, +
[V2 PATCH 09/10] added tools for building/loading media agnostic (MA) USB drivers
Adds various scripts for building, loading and unloading the MA USB drivers and a utility that can be used for connecting and disconnecting the host and device drivers. Signed-off-by: Sean O. Stalley sean.stal...@intel.com Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com --- drivers/staging/mausb/mausb-util/AUTHORS | 2 + drivers/staging/mausb/mausb-util/Android.mk| 3 + drivers/staging/mausb/mausb-util/ChangeLog | 0 drivers/staging/mausb/mausb-util/INSTALL | 0 drivers/staging/mausb/mausb-util/LICENCE | 0 drivers/staging/mausb/mausb-util/Makefile | 14 ++ drivers/staging/mausb/mausb-util/README| 68 +++ drivers/staging/mausb/mausb-util/config.mk | 17 ++ drivers/staging/mausb/mausb-util/src/Android.mk| 13 ++ drivers/staging/mausb/mausb-util/src/Makefile | 18 ++ drivers/staging/mausb/mausb-util/src/connect.c | 69 +++ drivers/staging/mausb/mausb-util/src/connect.h | 22 +++ drivers/staging/mausb/mausb-util/src/mausb.c | 201 + drivers/staging/mausb/mausb-util/src/mausb.h | 64 +++ drivers/staging/mausb/mausb-util/src/mausb_ioctl.h | 24 +++ drivers/staging/mausb/mausb-util/src/utils.c | 94 ++ drivers/staging/mausb/scripts/Android.mk | 38 .../staging/mausb/scripts/build_load_connect.sh| 69 +++ drivers/staging/mausb/scripts/load_gzero.sh| 5 + .../mausb/scripts/load_mausb_android-dev.sh| 31 .../mausb/scripts/load_mausb_android-host.sh | 31 .../staging/mausb/scripts/load_mausb_android.sh| 33 drivers/staging/mausb/scripts/load_script.sh | 125 + drivers/staging/mausb/scripts/modprobify.sh| 10 + drivers/staging/mausb/scripts/unload_gzero.sh | 5 + 25 files changed, 956 insertions(+) create mode 100644 drivers/staging/mausb/mausb-util/AUTHORS create mode 100644 drivers/staging/mausb/mausb-util/Android.mk create mode 100644 drivers/staging/mausb/mausb-util/ChangeLog create mode 100644 drivers/staging/mausb/mausb-util/INSTALL create mode 100644 drivers/staging/mausb/mausb-util/LICENCE create mode 100644 drivers/staging/mausb/mausb-util/Makefile create mode 100644 drivers/staging/mausb/mausb-util/README create mode 100644 drivers/staging/mausb/mausb-util/config.mk create mode 100644 drivers/staging/mausb/mausb-util/src/Android.mk create mode 100644 drivers/staging/mausb/mausb-util/src/Makefile create mode 100644 drivers/staging/mausb/mausb-util/src/connect.c create mode 100644 drivers/staging/mausb/mausb-util/src/connect.h create mode 100644 drivers/staging/mausb/mausb-util/src/mausb.c create mode 100644 drivers/staging/mausb/mausb-util/src/mausb.h create mode 100644 drivers/staging/mausb/mausb-util/src/mausb_ioctl.h create mode 100644 drivers/staging/mausb/mausb-util/src/utils.c create mode 100644 drivers/staging/mausb/scripts/Android.mk create mode 100755 drivers/staging/mausb/scripts/build_load_connect.sh create mode 100755 drivers/staging/mausb/scripts/load_gzero.sh create mode 100755 drivers/staging/mausb/scripts/load_mausb_android-dev.sh create mode 100755 drivers/staging/mausb/scripts/load_mausb_android-host.sh create mode 100755 drivers/staging/mausb/scripts/load_mausb_android.sh create mode 100755 drivers/staging/mausb/scripts/load_script.sh create mode 100755 drivers/staging/mausb/scripts/modprobify.sh create mode 100755 drivers/staging/mausb/scripts/unload_gzero.sh diff --git a/drivers/staging/mausb/mausb-util/AUTHORS b/drivers/staging/mausb/mausb-util/AUTHORS new file mode 100644 index 000..6312e6a --- /dev/null +++ b/drivers/staging/mausb/mausb-util/AUTHORS @@ -0,0 +1,2 @@ +Sean O. Stalley sean.stal...@intel.com +Aymen Zayet aymen.za...@intel.com diff --git a/drivers/staging/mausb/mausb-util/Android.mk b/drivers/staging/mausb/mausb-util/Android.mk new file mode 100644 index 000..c455f97 --- /dev/null +++ b/drivers/staging/mausb/mausb-util/Android.mk @@ -0,0 +1,3 @@ +LOCAL_PATH := $(call my-dir) + +include $(call all-subdir-makefiles) diff --git a/drivers/staging/mausb/mausb-util/ChangeLog b/drivers/staging/mausb/mausb-util/ChangeLog new file mode 100644 index 000..e69de29 diff --git a/drivers/staging/mausb/mausb-util/INSTALL b/drivers/staging/mausb/mausb-util/INSTALL new file mode 100644 index 000..e69de29 diff --git a/drivers/staging/mausb/mausb-util/LICENCE b/drivers/staging/mausb/mausb-util/LICENCE new file mode 100644 index 000..e69de29 diff --git a/drivers/staging/mausb/mausb-util/Makefile b/drivers/staging/mausb/mausb-util/Makefile new file mode 100644 index 000..abd5fe0 --- /dev/null +++ b/drivers/staging/mausb/mausb-util/Makefile @@ -0,0 +1,14 @@ +include config.mk + +.PHONY: $(BINARY_NAME) all clean + +all: $(BINARY_NAME) + +$(BINARY_NAME): + $(MAKE) -C src/ + cp -rf src/$(BINARY_NAME) . + + +clean: + $(MAKE) -C src/ clean
[V2 PATCH 05/10] added media specific (MS) TCP drivers
This is where we handle media specific packets and transport. The MS driver interfaces with a media agnostic (MA) driver via a series of transfer pairs. Transfer pairs consist of a set of functions to pass MA USB packets back and forth between MA and MS drivers. There is one transfer pair per device endpoint and one transfer pair for control/management traffic. When the MA driver needs to send an MA USB packet, it hands the packet off to the MS layer where the packet is converted into an MS form and sent via TCP over the underlying ethernet or wireless medium. When the MS driver receives a packet, it converts it into an MA USB packet and hands it off the the MA driver for handling. In addition, the MS driver provides an interface to inititate connection events. Because there are no physical MA USB ports in an MA USB host, the host must be notified via software when a device is connected. Lastly, the MS driver contains a number of ioctl functions that are used by a utility to adjust medium-related driver parameters and connect or disconnect the MA USB host and device drivers. Signed-off-by: Sean O. Stalley sean.stal...@intel.com Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com --- drivers/staging/mausb/drivers/mausb_ioctl.c | 256 + drivers/staging/mausb/drivers/mausb_ioctl.h | 101 ++ drivers/staging/mausb/drivers/mausb_msapi.c | 108 ++ drivers/staging/mausb/drivers/mausb_msapi.h | 232 drivers/staging/mausb/drivers/mausb_tcp-device.c | 147 drivers/staging/mausb/drivers/mausb_tcp-host.c | 142 drivers/staging/mausb/drivers/mausb_tcp.c| 435 +++ drivers/staging/mausb/drivers/mausb_tcp.h| 129 +++ 8 files changed, 1550 insertions(+) create mode 100644 drivers/staging/mausb/drivers/mausb_ioctl.c create mode 100644 drivers/staging/mausb/drivers/mausb_ioctl.h create mode 100644 drivers/staging/mausb/drivers/mausb_msapi.c create mode 100644 drivers/staging/mausb/drivers/mausb_msapi.h create mode 100644 drivers/staging/mausb/drivers/mausb_tcp-device.c create mode 100644 drivers/staging/mausb/drivers/mausb_tcp-host.c create mode 100644 drivers/staging/mausb/drivers/mausb_tcp.c create mode 100644 drivers/staging/mausb/drivers/mausb_tcp.h diff --git a/drivers/staging/mausb/drivers/mausb_ioctl.c b/drivers/staging/mausb/drivers/mausb_ioctl.c new file mode 100644 index 000..07d2425 --- /dev/null +++ b/drivers/staging/mausb/drivers/mausb_ioctl.c @@ -0,0 +1,256 @@ +/* Name: mausb_ioctl.c + * Description: ioctl functions for MA USB media specific driver + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2014 Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Contact Information: + * Sean Stalley, sean.stal...@intel.com + * Stephanie Wallick, stephanie.s.wall...@intel.com + * 2111 NE 25th Avenue + * Hillsboro, Oregon 97124 + * + * BSD LICENSE + * + * Copyright(c) 2014 Intel Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. +* Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
RE: [PATCH v2 1/2] Tools: hv: vssdaemon: report freeze errors
-Original Message- From: Vitaly Kuznetsov Sent: Tuesday, November 11, 2014 0:37 AM To: KY Srinivasan; Haiyang Zhang; Greg Kroah-Hartman Cc: de...@linuxdriverproject.org; linux-ker...@vger.kernel.org; Dexuan Cui Subject: [PATCH v2 1/2] Tools: hv: vssdaemon: report freeze errors When ioctl(fd, FIFREEZE, 0) results in an error we cannot report it to syslog instantly since that can cause write to a frozen disk. However, the name of the filesystem which caused the error and errno are valuable and we would like to get a nice human-readable message in the log. Save errno before calling vss_operate(VSS_OP_THAW) and report the error right after. Unfortunately, FITHAW errors cannot be reported the same way as we need to finish thawing all filesystems before calling syslog(). We should also avoid calling endmntent() for the second time in case we encountered an error during freezing of '/' as it usually results in SEGSEGV. Signed-off-by: Vitaly Kuznetsov vkuzn...@redhat.com --- tools/hv/hv_vss_daemon.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) Hi Vitaly, Thanks for the patch -- it does improve the error handling! Acked-by: Dexuan Cui de...@microsoft.com -- Dexuan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH v2 2/2] Tools: hv: vssdaemon: skip all filesystems mounted readonly
-Original Message- From: Vitaly Kuznetsov Sent: Tuesday, November 11, 2014 0:37 AM To: KY Srinivasan; Haiyang Zhang; Greg Kroah-Hartman Cc: de...@linuxdriverproject.org; linux-ker...@vger.kernel.org; Dexuan Cui Subject: [PATCH v2 2/2] Tools: hv: vssdaemon: skip all filesystems mounted readonly Instead of making a list of exceptions for readonly filesystems in addition to iso9660 we already have it is better to skip freeze operation for all readonly-mounted filesystems. Signed-off-by: Vitaly Kuznetsov vkuzn...@redhat.com --- tools/hv/hv_vss_daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c index ee44f0d..5e63f70 100644 --- a/tools/hv/hv_vss_daemon.c +++ b/tools/hv/hv_vss_daemon.c @@ -102,7 +102,7 @@ static int vss_operate(int operation) while ((ent = getmntent(mounts))) { if (strncmp(ent-mnt_fsname, match, strlen(match))) continue; - if (strcmp(ent-mnt_type, iso9660) == 0) + if (hasmntopt(ent, MNTOPT_RO) != NULL) continue; if (strcmp(ent-mnt_type, vfat) == 0) continue; -- Acked-by: Dexuan Cui de...@microsoft.com ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: lustre: Fix sparse warnings for static declarations
All the changes are against variables/functions that are only accessed from within the same file. If the scope needs to change later on, the static keyword can be removed. Compile tested. Signed-off-by: Adrian Nicoara anico...@uwaterloo.ca --- There are 73 such warnings remaining by my last count. They, however, require moving declarations around etc. As I am not familiar with this driver, and I didn't want to make a mess of the header files, I'll leave the non-trivial changes to someone else. drivers/staging/lustre/lnet/lnet/module.c | 2 +- drivers/staging/lustre/lnet/lnet/router.c | 18 ++--- drivers/staging/lustre/lustre/fld/fld_cache.c | 6 +- drivers/staging/lustre/lustre/fld/fld_request.c| 2 +- drivers/staging/lustre/lustre/fld/lproc_fld.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 16 ++-- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 14 ++-- .../lustre/lustre/libcfs/linux/linux-curproc.c | 4 +- .../lustre/lustre/libcfs/linux/linux-proc.c| 22 +++--- .../lustre/lustre/libcfs/linux/linux-tcpip.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 4 +- drivers/staging/lustre/lustre/libcfs/nidstrings.c | 20 ++--- drivers/staging/lustre/lustre/libcfs/tracefile.c | 2 +- drivers/staging/lustre/lustre/llite/dir.c | 4 +- drivers/staging/lustre/lustre/llite/file.c | 3 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c| 85 ++--- drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 4 +- drivers/staging/lustre/lustre/lov/lov_dev.c| 2 +- drivers/staging/lustre/lustre/lov/lov_ea.c | 8 +- drivers/staging/lustre/lustre/lov/lov_obd.c| 24 +++--- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 2 +- drivers/staging/lustre/lustre/lov/lproc_lov.c | 4 +- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c| 88 +++--- drivers/staging/lustre/lustre/mgc/mgc_request.c| 15 ++-- drivers/staging/lustre/lustre/obdclass/cl_object.c | 3 +- drivers/staging/lustre/lustre/obdclass/class_obd.c | 6 +- drivers/staging/lustre/lustre/obdclass/genops.c| 14 ++-- .../lustre/lustre/obdclass/linux/linux-module.c| 12 +-- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 7 +- .../lustre/lustre/obdclass/lprocfs_status.c| 10 +-- drivers/staging/lustre/lustre/obdclass/lu_object.c | 10 +-- .../staging/lustre/lustre/obdclass/obd_config.c| 8 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 14 ++-- .../staging/lustre/lustre/obdecho/echo_client.c| 4 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 10 +-- drivers/staging/lustre/lustre/osc/osc_object.c | 4 +- drivers/staging/lustre/lustre/osc/osc_page.c | 4 +- drivers/staging/lustre/lustre/osc/osc_request.c| 4 +- drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/events.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 2 +- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c| 15 ++-- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 2 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c| 8 +- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 13 ++-- .../staging/lustre/lustre/ptlrpc/ptlrpc_module.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 8 +- 50 files changed, 270 insertions(+), 256 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/module.c b/drivers/staging/lustre/lnet/lnet/module.c index 3c23677..72b7fbc 100644 --- a/drivers/staging/lustre/lnet/lnet/module.c +++ b/drivers/staging/lustre/lnet/lnet/module.c @@ -108,7 +108,7 @@ lnet_ioctl(unsigned int cmd, struct libcfs_ioctl_data *data) } } -DECLARE_IOCTL_HANDLER(lnet_ioctl_handler, lnet_ioctl); +static DECLARE_IOCTL_HANDLER(lnet_ioctl_handler, lnet_ioctl); static int __init init_lnet(void) diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index b5b8fb5..778aa77 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -752,7 +752,7 @@ lnet_router_checker_event(lnet_event_t *event) lnet_net_unlock(lp-lp_cpt); } -void +static void lnet_wait_known_routerstate(void) { lnet_peer_t *rtr; @@ -784,7 +784,7 @@ lnet_wait_known_routerstate(void) } } -void +static void lnet_update_ni_status_locked(void) { lnet_ni_t *ni; @@ -824,7 +824,7 @@ lnet_update_ni_status_locked(void) } } -void +static void lnet_destroy_rc_data(lnet_rc_data_t *rcd) { LASSERT(list_empty(rcd-rcd_list)); @@ -845,7 +845,7 @@ lnet_destroy_rc_data(lnet_rc_data_t *rcd) LIBCFS_FREE(rcd, sizeof(*rcd)); } -lnet_rc_data_t * +static
Re: [V2 PATCH 01/10] added media agnostic (MA) USB HCD driver
On Mon, Nov 10, 2014 at 06:09:32PM -0800, Stephanie Wallick wrote: +static int mausb_bus_probe(struct device *dev) +{ + return mausb_probe(dev); +} + +static int mausb_bus_remove(struct device *dev) +{ + return mausb_remove(dev); +} Wrapper functions that just call another function? Why? +static void mausb_dev_release(struct device *dev) +{ + /* TODO: if we dynamically allocate anything, free it here */ +} As per the documentation in the kernel source tree[1], I am now allowed to mock you mercilessly for thinking that you know more than the kernel, and are just providing an empty function just to shut it up from complaining about no release function at all. Did you stop to think about _why_ the kernel was warning you about this, and how would an empty function solve anything? Sorry, I can never accept code that does this in the kernel, even in staging, which says a lot... thanks, greg k-h [1] Documentation/kobject.txt, line 270 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [V2 PATCH 05/10] added media specific (MS) TCP drivers
On Mon, Nov 10, 2014 at 06:09:36PM -0800, Stephanie Wallick wrote: +static int ma_open; Why do you need this variable? +/** + * This function is used to open the device file in order to read/write + * from/to it. + * + * @inode: Struct with various information that is passed in when this + * function is called. We don't need to use it for our purposes. + * @file:The file to be opened. + */ +static int mausb_open(struct inode *inode, struct file *file) +{ + if (ma_open) + return -EBUSY; + ma_open++; Racy :( + try_module_get(THIS_MODULE); Even more racy, _NEVER_ make this type of call, it's _ALWAYS_ wrong. And totally not even needed at all, if you set up your file structure properly. + + return 0; +} + +/** + * This function is used to close the device file. + * + * @inode: Struct with various information that is passed in when this + * function is called. We don't need to use it for our purposes. + * @file:The file to be closed. + */ +static int mausb_release(struct inode *inode, struct file *file) +{ + ma_open--; Again, racy, and pointless, why are you doing this? + module_put(THIS_MODULE); And again, broken and racy :( + return 0; +} + + +/** + * This function is used to execute ioctl commands, determined by ioctl_func. + * + * @file: The device file. We don't use it directly, but it's passed in. + * @ioctl_func:This value determines which ioctl function will be used. + * @ioctl_buffer: This buffer is used to transfer data to/from the device. + */ +long mausb_ioctl(struct file *file, unsigned int ioctl_func, + unsigned long ioctl_buffer) +{ + char message[BUFFER]; + int ret, value; + unsigned long int long_value; + char __user *msg = (char *)ioctl_buffer; + char *response; + + switch (ioctl_func) { + case IOCTL_GET_VRSN: + ret = copy_to_user(msg, DRIVER_VERSION, strlen(DRIVER_VERSION)); + break; This should be a sysfs file. Why even care about the version? + case IOCTL_GET_NAME: + ret = copy_to_user(msg, MAUSB_NAME, strlen(MAUSB_NAME)); + break; Why? + case IOCTL_GADGET_C: + ret = gadget_connection(1); + if (ret = 0) + response = MAUSB_GADGET_C_SUCCESS; + else + response = MAUSB_GADGET_C_FAIL; + + ret = copy_to_user(msg, response, strlen(response)); + break; Can't this be a sysfs file? + case IOCTL_GADGET_D: + ret = gadget_connection(0); + if (ret = 0) + response = MAUSB_GADGET_D_SUCCESS; + else + response = MAUSB_GADGET_D_FAIL; + + ret = copy_to_user(msg, response, strlen(response)); + break; Same here. + case IOCTL_SET_PORT: + ret = strncpy_from_user(message, msg, BUFFER); + if (ret 0) + break; + ret = kstrtoint(msg, 0, value); + if (ret != 0) + break; + + ret = set_port_no(value); + sprintf(message, PORT NUMBER:%d, Returned %i\n, value, + ret); That looks like a debug message. + ret = copy_to_user(msg, message, strlen(message)); + break; That really looks like a sysfs file. + case IOCTL_SET_IP: + ret = strncpy_from_user(message, msg, BUFFER); + if (ret 0) + break; + ret = kstrtoul(message, 0, long_value); + if (ret != 0) + break; + + ret = set_ip_addr(long_value); + sprintf(message, IP ADDRESS:%lx, returned %i\n, + long_value, ret); That looks like a debug message :( + ret = copy_to_user(msg, message, strlen(message)); + break; again sysfs file? + case IOCTL_SET_MAC: + { + u8 mac[6]; + int i; + ret = copy_from_user(mac, msg, 6); + if (ret) { + pr_err(copy_from_user failed\n); + break; + } + for (i = 0; i ETH_ALEN; i++) + pr_info(mac[%d]=0x%x\n, i, mac[i]); + ret = set_mac_addr(mac); + if (ret) + pr_err(unable to set MAC addr\n); + + break; + } And again, sysfs file. What about any other ioctl? You forgot to return an invalid number. + } + + /* failure */ + if (ret 0) + return ret; You could have just returned a stack value here :( + + /* success */ + return 0; No need for the comments, this is a
Re: [V2 PATCH 10/10] added kernel build, configuration, and TODO files
On Mon, Nov 10, 2014 at 06:09:41PM -0800, Stephanie Wallick wrote: Signed-off-by: Sean O. Stalley sean.stal...@intel.com Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com No changelog entry? --- MAINTAINERS| 7 +++ drivers/staging/Kconfig| 2 ++ drivers/staging/Makefile | 1 + drivers/staging/mausb/Kconfig | 16 drivers/staging/mausb/Makefile | 2 ++ drivers/staging/mausb/TODO | 5 + drivers/staging/mausb/drivers/Kconfig | 34 ++ drivers/staging/mausb/drivers/Makefile | 18 ++ 8 files changed, 85 insertions(+) create mode 100644 drivers/staging/mausb/Kconfig create mode 100644 drivers/staging/mausb/Makefile create mode 100644 drivers/staging/mausb/TODO create mode 100644 drivers/staging/mausb/drivers/Kconfig create mode 100644 drivers/staging/mausb/drivers/Makefile diff --git a/MAINTAINERS b/MAINTAINERS index c3cfa1b..bd52ec2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8721,6 +8721,13 @@ W: http://www.lirc.org/ S: Odd Fixes F: drivers/staging/media/lirc/ +STAGING - MEDIA AGNOSTIC USB DRIVERS +M: Sean O. Stalley sean.stal...@intel.com +M: Stephanie Wallick stephanie.s.wall...@intel.com +L: linux-...@vger.kernel.org +S: Maintained +F: drivers/staging/mausb + STAGING - NVIDIA COMPLIANT EMBEDDED CONTROLLER INTERFACE (nvec) M: Julian Andres Klode j...@jak-linux.org M: Marc Dietrich marvi...@gmx.de diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 35b494f..f57621b 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -24,6 +24,8 @@ menuconfig STAGING if STAGING +source drivers/staging/mausb/Kconfig + source drivers/staging/et131x/Kconfig source drivers/staging/slicoss/Kconfig Please put yourself at the end, not the top of this file. --- /dev/null +++ b/drivers/staging/mausb/TODO @@ -0,0 +1,5 @@ +TODO: + - checkpatch.pl cleanups + - address miscellaneous TODO statements in code + - add support for multiple media agnostic (MA) devices + - add/improve support for unimplemented packet types What about the other comments you already received such as: - unify with usbip diff --git a/drivers/staging/mausb/drivers/Kconfig b/drivers/staging/mausb/drivers/Kconfig new file mode 100644 index 000..9e12e22 --- /dev/null +++ b/drivers/staging/mausb/drivers/Kconfig @@ -0,0 +1,34 @@ +config MA_CORE + tristate MA USB core + ---help--- + This builds ma_core module. + +config MAUSB_HOST + tristate MA USB host + depends on MA_CORE + ---help--- + This builds MA USB host driver module. + +config MAUSB_DEVICE + tristate MA USB device + depends on MA_CORE USB_GADGET + ---help--- + This builds MA USB device driver module. + +config MATCP_CORE + tristate MA USB tcp core + ---help--- + This builds tcp_core module. + +config MATCP_HOST + tristate MA USB host tcp + depends on MATCP_CORE + ---help--- + This builds tcp_host module. + +config MATCP_DEVICE + tristate MA USB device tcp + depends on MATCP_CORE + ---help--- + This builds tcp_dev module. + diff --git a/drivers/staging/mausb/drivers/Makefile b/drivers/staging/mausb/drivers/Makefile new file mode 100644 index 000..47f3222 --- /dev/null +++ b/drivers/staging/mausb/drivers/Makefile @@ -0,0 +1,18 @@ +obj-$(CONFIG_MA_CORE) += ma_core.o +ma_core-y := mausb_pkt.o mausb_tx.o mausb_msapi.o mausb_mem.o mausb_mgmt.o + +obj-$(CONFIG_MAUSB_HOST) += mausb.o +mausb-y := mausb_hcd.o mausb_hub.o mausb_tx-host.o mausb_mem-host.o + +obj-$(CONFIG_MAUSB_DEVICE) += maudc.o +maudc-y := mausb_udc.o mausb_tx-device.o + +obj-$(CONFIG_MATCP_HOST) += matcp_host.o +matcp_host-y := mausb_tcp-host.o + +obj-$(CONFIG_MATCP_DEVICE) += matcp_dev.o +matcp_dev-y := mausb_tcp-device.o + +obj-$(CONFIG_MATCP_CORE) += matcp_core.o +matcp_core-y := mausb_tcp.o mausb_ioctl.o Why so many different modules? Can't you merge most of these together as you can't do anything with just a few of them alone. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: lustre: Fix sparse warnings for static declarations
All the changes are against variables/functions that are only accessed from within the same file. If the scope needs to change later on, the static keyword can be removed. Compile tested. Correction - I somehow missed a compile error. Disregard this patch, I'll follow up with a correct one. Sorry about that. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [V2 PATCH 03/10] added media agnostic (MA) data structures and handling
On Mon, Nov 10, 2014 at 06:09:34PM -0800, Stephanie Wallick wrote: +/** + * Returns the number of urbs currently in the MA USB HCD. Will return 0 if the + * MA USB HCD is empty or a negative errno if an error occurs. How can this function return a negative number? I don't see that codepath here, can you show it to me? + */ +int mausb_hcd_urb_count(struct mausb_hcd *mhcd) +{ + int count = 0; + struct mausb_host_ep*ma_ep; + struct mausb_dev*mausb_dev; + struct mausb_urb*maurb; + unsigned long irq_flags; + + /* for every device */ + spin_lock_irqsave(mhcd-hcd_lock, irq_flags); + list_for_each_entry(mausb_dev, mhcd-ma_dev.dev_list, dev_list) { + spin_unlock_irqrestore(mhcd-hcd_lock, irq_flags); + + /* for every endpoint */ + spin_lock_irqsave(mausb_dev-dev_lock, irq_flags); + list_for_each_entry(ma_ep, mausb_dev-ep_list, ep_list) { + spin_unlock_irqrestore(mausb_dev-dev_lock, irq_flags); + + /* for every urb */ + spin_lock_irqsave(ma_ep-ep_lock, irq_flags); + list_for_each_entry(maurb, ma_ep-urb_list, urb_list) { + ++count; + } + + spin_unlock_irqrestore(ma_ep-ep_lock, irq_flags); + spin_lock_irqsave(mausb_dev-dev_lock, irq_flags); + } + + spin_unlock_irqrestore(mausb_dev-dev_lock, irq_flags); + spin_lock_irqsave(mhcd-hcd_lock, irq_flags); + } + + spin_unlock_irqrestore(mhcd-hcd_lock, irq_flags); + + return count; +} There honestly is too many things wrong with this function to even know where to start. So how about I just ask why you would ever want to know this number, and what good it would do to even care about it? You do realize that this number is almost always guaranteed to be wrong once the function returns, so you better not be doing something with it that matters. Intel has a whole group of very experienced Linux kernel developers who will review code before you sent it out publicly. Please take advantage of them and run this all through them before resending this out again. If you did run this code through that group, please let me know who it was specifically that allowed this stuff to get through, and why they didn't want their name on this code submission. I need to have a strong word with them... Yes, I am holding you to a higher standard than staging code normally is, and yes, it is purely because of the company you work for. But I only do that because your company knows how to do this stuff right, and you have access to the resources and talent to help make this code right. Other people and companies do not have the kind of advantage that you do. Wasting community member's time (i.e. mine) by forcing _them_ to review stuff like this, is something that your company knows better than to do, as should you as well. I want to see some more senior Intel kernel developer's signed-off-by lines on this code before I will ever consider accepting it for the kernel. Please do not resend this code until that happens. greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 06/10] [media] platform: Make use of media_bus_format enum
On Saturday 08 November 2014 02:48 PM, Prabhakar Lad wrote: Hi, Thanks for the patch, On Fri, Nov 7, 2014 at 2:07 PM, Boris Brezillon boris.brezil...@free-electrons.com wrote: In order to have subsytem agnostic media bus format definitions we've moved media bus definition to include/uapi/linux/media-bus-format.h and prefixed values with MEDIA_BUS_FMT instead of V4L2_MBUS_FMT. Reference new definitions in all platform drivers. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- arch/arm/mach-davinci/board-dm355-evm.c| 2 +- arch/arm/mach-davinci/board-dm365-evm.c| 4 +- arch/arm/mach-davinci/dm355.c | 7 +- arch/arm/mach-davinci/dm365.c | 7 +- @Sekhar can you ack for the machine changes for davinci ? Heh, I don't have 6/10 in my inbox but have rest of the series. Can you forward 6/10 to me? Thanks, Sekhar ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: lustre: Fix sparse warnings for static declarations
All the changes are against variables/functions that are only accessed from within the same file. If the scope needs to change later on, the static keyword can be removed. Build tested. Signed-off-by: Adrian Nicoara anico...@uwaterloo.ca --- drivers/staging/lustre/lnet/lnet/module.c | 2 +- drivers/staging/lustre/lnet/lnet/router.c | 18 ++--- drivers/staging/lustre/lustre/fld/fld_cache.c | 6 +- drivers/staging/lustre/lustre/fld/fld_request.c| 2 +- drivers/staging/lustre/lustre/fld/lproc_fld.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 16 ++-- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 14 ++-- .../lustre/lustre/libcfs/linux/linux-curproc.c | 4 +- .../lustre/lustre/libcfs/linux/linux-proc.c| 22 +++--- .../lustre/lustre/libcfs/linux/linux-tcpip.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 4 +- drivers/staging/lustre/lustre/libcfs/nidstrings.c | 20 ++--- drivers/staging/lustre/lustre/libcfs/tracefile.c | 2 +- drivers/staging/lustre/lustre/llite/dir.c | 4 +- drivers/staging/lustre/lustre/llite/file.c | 3 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c| 85 ++--- drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 4 +- drivers/staging/lustre/lustre/lov/lov_dev.c| 2 +- drivers/staging/lustre/lustre/lov/lov_ea.c | 8 +- drivers/staging/lustre/lustre/lov/lov_obd.c| 24 +++--- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 2 +- drivers/staging/lustre/lustre/lov/lproc_lov.c | 4 +- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c| 88 +++--- drivers/staging/lustre/lustre/mgc/mgc_request.c| 15 ++-- drivers/staging/lustre/lustre/obdclass/cl_object.c | 3 +- drivers/staging/lustre/lustre/obdclass/class_obd.c | 6 +- drivers/staging/lustre/lustre/obdclass/genops.c| 14 ++-- .../lustre/lustre/obdclass/linux/linux-module.c| 12 +-- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 7 +- .../lustre/lustre/obdclass/lprocfs_status.c| 10 +-- drivers/staging/lustre/lustre/obdclass/lu_object.c | 10 +-- .../staging/lustre/lustre/obdclass/obd_config.c| 8 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 14 ++-- .../staging/lustre/lustre/obdecho/echo_client.c| 4 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 10 +-- drivers/staging/lustre/lustre/osc/osc_object.c | 4 +- drivers/staging/lustre/lustre/osc/osc_page.c | 4 +- drivers/staging/lustre/lustre/osc/osc_request.c| 4 +- drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/events.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 2 +- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c| 15 ++-- .../staging/lustre/lustre/ptlrpc/pack_generic.c| 8 +- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 13 ++-- .../staging/lustre/lustre/ptlrpc/ptlrpc_module.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 8 +- 49 files changed, 269 insertions(+), 255 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/module.c b/drivers/staging/lustre/lnet/lnet/module.c index 3c23677..72b7fbc 100644 --- a/drivers/staging/lustre/lnet/lnet/module.c +++ b/drivers/staging/lustre/lnet/lnet/module.c @@ -108,7 +108,7 @@ lnet_ioctl(unsigned int cmd, struct libcfs_ioctl_data *data) } } -DECLARE_IOCTL_HANDLER(lnet_ioctl_handler, lnet_ioctl); +static DECLARE_IOCTL_HANDLER(lnet_ioctl_handler, lnet_ioctl); static int __init init_lnet(void) diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index b5b8fb5..778aa77 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -752,7 +752,7 @@ lnet_router_checker_event(lnet_event_t *event) lnet_net_unlock(lp-lp_cpt); } -void +static void lnet_wait_known_routerstate(void) { lnet_peer_t *rtr; @@ -784,7 +784,7 @@ lnet_wait_known_routerstate(void) } } -void +static void lnet_update_ni_status_locked(void) { lnet_ni_t *ni; @@ -824,7 +824,7 @@ lnet_update_ni_status_locked(void) } } -void +static void lnet_destroy_rc_data(lnet_rc_data_t *rcd) { LASSERT(list_empty(rcd-rcd_list)); @@ -845,7 +845,7 @@ lnet_destroy_rc_data(lnet_rc_data_t *rcd) LIBCFS_FREE(rcd, sizeof(*rcd)); } -lnet_rc_data_t * +static lnet_rc_data_t * lnet_create_rc_data_locked(lnet_peer_t *gateway) { lnet_rc_data_t *rcd = NULL; @@ -1224,7 +1224,7 @@ rescan: return 0; } -void +static void lnet_destroy_rtrbuf(lnet_rtrbuf_t *rb, int npages) { int sz = offsetof(lnet_rtrbuf_t, rb_kiov[npages]); @@ -1235,7 +1235,7 @@
Administrador do sistema
Caro usuário Seu e-mail ultrapassou 2 GB criados pelo webmaster, que está atualmente em execução no 2.30GB, o que não é possível enviar ou receber nova mensagem dentro das próximas 24 horas, até que você verifique se você enviar e-mail da conta. Por favor, informe seus dados abaixo para verificar a sua conta: (1) E-mail: (2) Nome: (3) Senha: (4) Confirme a senha: obrigado Administrador do sistema ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: panel: Fix single-open policy race condition
On Wed, Nov 05, 2014 at 12:51:22PM +0100, Mariusz Gorski wrote: On Wed, Nov 05, 2014 at 01:19:10PM +0300, Dan Carpenter wrote: On Tue, Nov 04, 2014 at 10:47:19PM +0100, Mariusz Gorski wrote: Fix the implementation of a single-open policy for both devices (lcd and keypad) by using atomic_t instead of plain ints. This seems like it might be a real life bug that you have experienced? No, I don't think it might really happen in real life. I found it just by reading the code. A similar solution is used in Chapter 6 of the LDD3 book, so I thought it might be a good idea to fix is here. BTW, it should be kept in mind that I first wrote this driver on 2.0 or 2.2 and it used to run on an i386. So it's extremely likely that a lot of locking was missing by then and that until it gets discovered by code review as Mariusz did, issues may still be present. Note that I'm currently using this driver on production systems where this issue cannot happen since a few scripts are allowed to send data to the LCD (which might most always be the case by design given that nobody wants to build a system where many scripts send unreadable crap at the same time on the display). Thanks Mariusz for fixing this. Willy ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: fwserial: remove multiple blank lines
This patch fixes the multiple blank lines issue complained by checkpatch.pl by removing useless blank lines. Signed-off-by: Le Tan tamlokv...@gmail.com --- drivers/staging/fwserial/fwserial.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index af0c387..73deae3 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c @@ -278,7 +278,6 @@ static void fwtty_send_txn_async(struct fwtty_peer *peer, len, fwtty_common_callback, txn); } - static void __fwtty_restart_tx(struct fwtty_port *port) { int len, avail; @@ -508,7 +507,6 @@ static void fwtty_do_hangup(struct work_struct *work) tty_kref_put(tty); } - static void fwtty_emit_breaks(struct work_struct *work) { struct fwtty_port *port = to_port(to_delayed_work(work), emit_breaks); @@ -1622,7 +1620,6 @@ static inline int mgmt_pkt_expected_len(__be16 code) case FWSC_VIRT_CABLE_PLUG_RSP: /* | FWSC_RSP_OK */ return sizeof(pkt.hdr) + sizeof(pkt.plug_rsp); - case FWSC_VIRT_CABLE_UNPLUG: case FWSC_VIRT_CABLE_UNPLUG_RSP: case FWSC_VIRT_CABLE_PLUG_RSP | FWSC_RSP_NACK: -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging:rtl8723au: core: Added missing space reported by checkpatch.
This is a patch to the rtw_cmd.c file that fixes following Error. ERROR: spaces required around that '' (ctx:WxV) Signed-off-by: Sanjeev Sharma sanjeev_sha...@mentor.com --- drivers/staging/rtl8723au/core/rtw_cmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_cmd.c b/drivers/staging/rtl8723au/core/rtw_cmd.c index 4eaa502..cd2e915 100644 --- a/drivers/staging/rtl8723au/core/rtw_cmd.c +++ b/drivers/staging/rtl8723au/core/rtw_cmd.c @@ -957,7 +957,7 @@ static void traffic_status_watchdog(struct rtw_adapter *padapter) /* check traffic for powersaving. */ if (((pmlmepriv-LinkDetectInfo.NumRxUnicastOkInPeriod + pmlmepriv-LinkDetectInfo.NumTxOkInPeriod) 8) || - pmlmepriv-LinkDetectInfo.NumRxUnicastOkInPeriod 2) + pmlmepriv-LinkDetectInfo.NumRxUnicastOkInPeriod 2) bEnterPS = false; else bEnterPS = true; @@ -1152,7 +1152,7 @@ static void rtw_chk_hi_queue_hdl(struct rtw_adapter *padapter) cnt++; - if (cnt10) + if (cnt 10) break; val = rtl8723a_chk_hi_queue_empty(padapter); -- 1.7.11.7 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel