summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_ncm.c
AgeCommit message (Collapse)Author
2013-12-17usb: gadget: f_ncm: Fix sparse warningJingoo Han
Make local symbol static in order to fix the following sparse warning. drivers/usb/gadget/f_ncm.c:1389:21: warning: symbol 'ncm_alloc' was not declared. Should it be static? Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-07-25usb/gadget: free opts struct on error recoveryAndrzej Pietrasiewicz
Fix memory leaks introduced in commits: 40d133d7f542616cf9538508a372306e626a16e9 usb: gadget: f_ncm: convert to new function interface with backward compatibility fee562a6450b7806f1fbbe1469a67b5395b5c10a usb: gadget: f_ecm: convert to new function interface with backward compatibility fcbdf12ebef73a6069e2a1aada1e546fb578a4aa usb: gadget: f_phonet: convert to new function interface with backward compatibility b29002a157940752dfed2c488b2011f63f007d71 usb: gadget: f_eem: convert to new function interface with backward compatibility 8cedba7c73af1369599b1111639cfeb66fe13aaa usb: gadget: f_subset: convert to new function interface with backward compatibility f466c6353819326873fa48a02c6f2d7c903240d6 usb: gadget: f_rndis: convert to new function interface with backward compatibility Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-18usb: gadget: f_ncm: fix missing unlock on error in ncm_alloc()Wei Yongjun
Add the missing unlock before return from function ncm_alloc() in the error handling case. Introduced by commit e730660378be92b83288b59b824ccdace5cd2652. (usb: gadget: f_ncm: add configfs support) Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-10usb: gadget: add helpers for configfs support for USB EthernetAndrzej Pietrasiewicz
All USB Ethernet functions will have very similar attributes in configfs. This patch provides helper definitions to ease writing the functions and reduce source code duplication. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-06-10usb: gadget: f_ncm: add configfs supportAndrzej Pietrasiewicz
Add configfs support to the NCM function driver so that we can, eventually, get rid of kernel-based gadget drivers. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-06-10usb: gadget: f_ncm: use usb_gstrings_attachAndrzej Pietrasiewicz
Trivial patch making use of the new usb_gstrings_attach interface. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-06-10usb: gadget: f_ncm: remove compatibility layerAndrzej Pietrasiewicz
There are no old function interface users left, so the old interface can be removed. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-06-10usb: gadget: f_ncm: convert to new function interface with backward ↵Andrzej Pietrasiewicz
compatibility Converting ncm to the new function interface requires converting the USB ncm's function code and its users. This patch converts the f_ncm.c to the new function interface. The file is now compiled into a separate usb_f_ncm.ko module. The old function interface is provided by means of a preprocessor conditional directives. After all users are converted, the old interface can be removed. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03usb: gadget: move the global the_dev variable to their usersSebastian Andrzej Siewior
the u_ether.c file has a global variable named the_dev which keeps a pointer to the network device after it has been created via gether_setup_name(). It is only used internally by u_ether. This patches moves the variable to its users and passes it via the port.ioport where it is saved later anyway. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-01-10usb: gadget: ncm: make global variable ndp*_opts read onlySebastian Andrzej Siewior
There is ndp16_opts and ndp32_opts which are both global and only one member is ever written. This patch makes the variable read-only and moves the one member that is ever written into the private struct f_ncm. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-11-08usb: gadget: ncm: correct endianess conversionDmytro Milinevskyy
Convert USB descriptor's fields to CPU byte order before using locally in USB NCM gadget driver. Tested on MIPS32 big-endian device. Signed-off-by: Dmytro Milinevskyy <milinevskyy@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-31usb: gadget: let f_* use usb_string_ids_tab() where it makes senseSebastian Andrzej Siewior
Instead of calling usb_string_id() multiple times I replace it with one usb_string_ids_tab(). The NULL pointer in struct usb_string with "" and are not overwritten in fail or unbind case. The conditional assignment remains because some gadgets recycle the string ID because the same descriptor (and string ID) is used if we have more than one config descriptor. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-31usb: gadget: always update HS/SS descriptors and create a copy of themSebastian Andrzej Siewior
HS and SS descriptors are staticaly created. They are updated during the bind process with the endpoint address, string id or interface numbers. After that, the descriptor chain is linked to struct usb_function which is used by composite in order to serve the GET_DESCRIPTOR requests, number of available configs and so on. There is no need to assign the HS descriptor only if the UDC supports HS speed because composite won't report those to the host if HS support has not been reached. The same reasoning is valid for SS. This patch makes sure each function updates HS/SS descriptors unconditionally and uses the newly introduced helper function to create a copy the descriptors for the speed which is supported by the UDC. While at that, also rename f->descriptors to f->fs_descriptors in order to make it more explicit what that means. Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-31usb: gadget: network: fix bind() error pathSebastian Andrzej Siewior
I think this is wrong since 72c973dd ("usb: gadget: add usb_endpoint_descriptor to struct usb_ep"). If we fail to allocate an ep or bail out early we shouldn't check for the descriptor which is assigned at ep_enable() time. Cc: Tatyana Brokhman <tlinder@codeaurora.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-31usb: gadget: use a computation macro for INT endpoint intervalSebastian Andrzej Siewior
The 5+4 magic for HS tries to aim 32ms which is also what is intended with 1 << 5 for FS. This little macro should make this easier to understand. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-08-23usb: gadget: use %pm to print mac addressesAndy Shevchenko
%pm already provides pretty print for mac addresses, let's use that and drop homebrew mac address printing. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-09-09usb gadget: clean up FSF boilerplate textKlaus Schwarzkopf
remove the following two paragraphs as they are not needed: 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. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc.,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Signed-off-by: Klaus Schwarzkopf <schwarzkopf@sensortherm.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28usb: gadget: use config_ep_by_speed() instead of ep_choose()Tatyana Brokhman
Remove obsolete functions: 1. ep_choose() 2. usb_find_endpoint() Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28usb: gadget: add usb_endpoint_descriptor to struct usb_epTatyana Brokhman
Change usb_ep_enable() prototype to use endpoint descriptor from usb_ep. This optimization spares the FDs from saving the endpoint chosen descriptor. This optimization is not full though. To fully exploit this change, one needs to update all the UDCs as well since in the current implementation each of them saves the endpoint descriptor in it's internal (and extended) endpoint structure. Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2010-12-10usb: gadget: f_ncm.c addedYauheni Kaliuta
Initial submittion of NCM link function driver. The driver's logic is based on f_ecm driver and does not use most of the NCM advantages like frame grouping and alignment. Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>