diff options
Diffstat (limited to 'drivers/usb/gadget')
143 files changed, 338 insertions, 832 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 5d061b3d8224..eec14e6ed20b 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1,12 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * composite.c - infrastructure for Composite USB Gadgets * * Copyright (C) 2006-2008 David Brownell - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* #define VERBOSE_DEBUG */ @@ -170,20 +166,20 @@ int config_ep_by_speed(struct usb_gadget *g, want_comp_desc = 1; break; } - /* else: Fall trough */ + /* fall through */ case USB_SPEED_SUPER: if (gadget_is_superspeed(g)) { speed_desc = f->ss_descriptors; want_comp_desc = 1; break; } - /* else: Fall trough */ + /* fall through */ case USB_SPEED_HIGH: if (gadget_is_dualspeed(g)) { speed_desc = f->hs_descriptors; break; } - /* else: fall through */ + /* fall through */ default: speed_desc = f->fs_descriptors; } @@ -224,6 +220,7 @@ ep_found: case USB_ENDPOINT_XFER_ISOC: /* mult: bits 1:0 of bmAttributes */ _ep->mult = (comp_desc->bmAttributes & 0x3) + 1; + /* fall through */ case USB_ENDPOINT_XFER_BULK: case USB_ENDPOINT_XFER_INT: _ep->maxburst = comp_desc->bMaxBurst + 1; diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c index 17a6077b89a4..2d115353424c 100644 --- a/drivers/usb/gadget/config.c +++ b/drivers/usb/gadget/config.c @@ -1,12 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * usb/gadget/config.c -- simplify building config descriptors * * Copyright (C) 2003 David Brownell - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/errno.h> diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index aeb9f3c40521..efba66ca0719 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/configfs.h> #include <linux/module.h> #include <linux/slab.h> @@ -505,13 +506,13 @@ static struct configfs_attribute *gadget_config_attrs[] = { NULL, }; -static struct config_item_type gadget_config_type = { +static const struct config_item_type gadget_config_type = { .ct_item_ops = &gadget_config_item_ops, .ct_attrs = gadget_config_attrs, .ct_owner = THIS_MODULE, }; -static struct config_item_type gadget_root_type = { +static const struct config_item_type gadget_root_type = { .ct_item_ops = &gadget_root_item_ops, .ct_attrs = gadget_root_attrs, .ct_owner = THIS_MODULE, @@ -593,7 +594,7 @@ static struct configfs_group_operations functions_ops = { .drop_item = &function_drop, }; -static struct config_item_type functions_type = { +static const struct config_item_type functions_type = { .ct_group_ops = &functions_ops, .ct_owner = THIS_MODULE, }; @@ -694,7 +695,7 @@ static struct configfs_group_operations config_desc_ops = { .drop_item = &config_desc_drop, }; -static struct config_item_type config_desc_type = { +static const struct config_item_type config_desc_type = { .ct_group_ops = &config_desc_ops, .ct_owner = THIS_MODULE, }; @@ -1476,7 +1477,7 @@ static struct configfs_group_operations gadgets_ops = { .drop_item = &gadgets_drop, }; -static struct config_item_type gadgets_type = { +static const struct config_item_type gadgets_type = { .ct_group_ops = &gadgets_ops, .ct_owner = THIS_MODULE, }; diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 30fdab0ae383..71b15c65b90f 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -1,12 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * epautoconf.c -- endpoint autoconfiguration for usb gadget drivers * * Copyright (C) 2004 David Brownell - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/kernel.h> diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c index 5e3828d9dac7..9fc98de83624 100644 --- a/drivers/usb/gadget/function/f_acm.c +++ b/drivers/usb/gadget/function/f_acm.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_acm.c -- USB CDC serial (ACM) function driver * @@ -6,10 +7,6 @@ * Copyright (C) 2008 by Nokia Corporation * Copyright (C) 2009 by Samsung Electronics * Author: Michal Nazarewicz (mina86@mina86.com) - * - * This software is distributed under the terms of the GNU General - * Public License ("GPL") as published by the Free Software Foundation, - * either version 2 of that License or (at your option) any later version. */ /* #define VERBOSE_DEBUG */ @@ -786,7 +783,7 @@ static struct configfs_attribute *acm_attrs[] = { NULL, }; -static struct config_item_type acm_func_type = { +static const struct config_item_type acm_func_type = { .ct_item_ops = &acm_item_ops, .ct_attrs = acm_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c index 4c488d15b6f6..b104ed0c1ab5 100644 --- a/drivers/usb/gadget/function/f_ecm.c +++ b/drivers/usb/gadget/function/f_ecm.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_ecm.c -- USB CDC Ethernet (ECM) link function driver * * Copyright (C) 2003-2005,2008 David Brownell * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* #define VERBOSE_DEBUG */ @@ -845,7 +841,7 @@ static struct configfs_attribute *ecm_attrs[] = { NULL, }; -static struct config_item_type ecm_func_type = { +static const struct config_item_type ecm_func_type = { .ct_item_ops = &ecm_item_ops, .ct_attrs = ecm_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c index 007ec6e4a5d4..37557651b600 100644 --- a/drivers/usb/gadget/function/f_eem.c +++ b/drivers/usb/gadget/function/f_eem.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_eem.c -- USB CDC Ethernet (EEM) link function driver * * Copyright (C) 2003-2005,2008 David Brownell * Copyright (C) 2008 Nokia Corporation * Copyright (C) 2009 EF Johnson Technologies - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/kernel.h> @@ -556,7 +552,7 @@ static struct configfs_attribute *eem_attrs[] = { NULL, }; -static struct config_item_type eem_func_type = { +static const struct config_item_type eem_func_type = { .ct_item_ops = &eem_item_ops, .ct_attrs = eem_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 8b342587f8ad..97ea059a7aa4 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_fs.c -- user mode file system API for USB composite function controllers * @@ -7,11 +8,6 @@ * Based on inode.c (GadgetFS) which was: * Copyright (C) 2003-2004 David Brownell * Copyright (C) 2003 Agilent Technologies - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ @@ -3385,7 +3381,7 @@ static struct configfs_item_operations ffs_item_ops = { .release = ffs_attr_release, }; -static struct config_item_type ffs_func_type = { +static const struct config_item_type ffs_func_type = { .ct_item_ops = &ffs_item_ops, .ct_owner = THIS_MODULE, }; @@ -3677,6 +3673,7 @@ static void ffs_closed(struct ffs_data *ffs) goto done; ffs_obj->desc_ready = false; + ffs_obj->ffs_data = NULL; if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags) && ffs_obj->ffs_closed_callback) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index d8e359ef6eb1..daae35318a3a 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c @@ -1,12 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_hid.c -- USB HID function driver * * Copyright (C) 2010 Fabien Chouteau <fabien.chouteau@barco.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/kernel.h> @@ -992,7 +988,7 @@ static struct configfs_attribute *hid_attrs[] = { NULL, }; -static struct config_item_type hid_func_type = { +static const struct config_item_type hid_func_type = { .ct_item_ops = &hidg_item_ops, .ct_attrs = hid_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_loopback.c b/drivers/usb/gadget/function/f_loopback.c index e70093835e14..1803646b3678 100644 --- a/drivers/usb/gadget/function/f_loopback.c +++ b/drivers/usb/gadget/function/f_loopback.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_loopback.c - USB peripheral loopback configuration driver * * Copyright (C) 2003-2008 David Brownell * Copyright (C) 2008 by Nokia Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* #define VERBOSE_DEBUG */ @@ -556,7 +552,7 @@ static struct configfs_attribute *lb_attrs[] = { NULL, }; -static struct config_item_type lb_func_type = { +static const struct config_item_type lb_func_type = { .ct_item_ops = &lb_item_ops, .ct_attrs = lb_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c index 5153e29870c3..acecd13dcbd9 100644 --- a/drivers/usb/gadget/function/f_mass_storage.c +++ b/drivers/usb/gadget/function/f_mass_storage.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) /* * f_mass_storage.c -- Mass Storage USB Composite Function * @@ -3140,7 +3141,7 @@ static struct configfs_attribute *fsg_lun_attrs[] = { NULL, }; -static struct config_item_type fsg_lun_type = { +static const struct config_item_type fsg_lun_type = { .ct_item_ops = &fsg_lun_item_ops, .ct_attrs = fsg_lun_attrs, .ct_owner = THIS_MODULE, @@ -3331,7 +3332,7 @@ static struct configfs_group_operations fsg_group_ops = { .drop_item = fsg_lun_drop, }; -static struct config_item_type fsg_func_type = { +static const struct config_item_type fsg_func_type = { .ct_item_ops = &fsg_item_ops, .ct_group_ops = &fsg_group_ops, .ct_attrs = fsg_attrs, diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 5d3d7941d2c2..4eb96b91cc40 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_midi.c -- USB MIDI class function driver * @@ -15,8 +16,6 @@ * and drivers/usb/gadget/midi.c, * Copyright (C) 2006 Thumtronics Pty Ltd. * Ben Williamson <ben.williamson@greyinnovation.com> - * - * Licensed under the GPL-2 or later. */ #include <linux/kernel.h> @@ -1189,7 +1188,7 @@ static struct configfs_attribute *midi_attrs[] = { NULL, }; -static struct config_item_type midi_func_type = { +static const struct config_item_type midi_func_type = { .ct_item_ops = &midi_item_ops, .ct_attrs = midi_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c index 45b334ceaf2e..c5bce8e22983 100644 --- a/drivers/usb/gadget/function/f_ncm.c +++ b/drivers/usb/gadget/function/f_ncm.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_ncm.c -- USB CDC Network (NCM) link function driver * @@ -8,11 +9,6 @@ * * Copyright (C) 2003-2005,2008 David Brownell * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/kernel.h> @@ -1568,7 +1564,7 @@ static struct configfs_attribute *ncm_attrs[] = { NULL, }; -static struct config_item_type ncm_func_type = { +static const struct config_item_type ncm_func_type = { .ct_item_ops = &ncm_item_ops, .ct_attrs = ncm_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_obex.c b/drivers/usb/gadget/function/f_obex.c index d43e86cea74f..55b7f57d2dc7 100644 --- a/drivers/usb/gadget/function/f_obex.c +++ b/drivers/usb/gadget/function/f_obex.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_obex.c -- USB CDC OBEX function driver * @@ -5,11 +6,6 @@ * Contact: Felipe Balbi <felipe.balbi@nokia.com> * * Based on f_acm.c by Al Borchers and David Brownell. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* #define VERBOSE_DEBUG */ @@ -411,7 +407,7 @@ static struct configfs_attribute *acm_attrs[] = { NULL, }; -static struct config_item_type obex_func_type = { +static const struct config_item_type obex_func_type = { .ct_item_ops = &obex_item_ops, .ct_attrs = acm_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_phonet.c b/drivers/usb/gadget/function/f_phonet.c index 9c4c58e4a1a2..7889bcc0509a 100644 --- a/drivers/usb/gadget/function/f_phonet.c +++ b/drivers/usb/gadget/function/f_phonet.c @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * f_phonet.c -- USB CDC Phonet function * * Copyright (C) 2007-2008 Nokia Corporation. All rights reserved. * * Author: Rémi Denis-Courmont - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation. */ #include <linux/mm.h> @@ -215,6 +212,7 @@ static void pn_tx_complete(struct usb_ep *ep, struct usb_request *req) case -ESHUTDOWN: /* disconnected */ case -ECONNRESET: /* disabled */ dev->stats.tx_aborted_errors++; + /* fall through */ default: dev->stats.tx_errors++; } @@ -362,6 +360,7 @@ static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req) /* Do resubmit in these cases: */ case -EOVERFLOW: /* request buffer overflow */ dev->stats.rx_over_errors++; + /* fall through */ default: dev->stats.rx_errors++; break; @@ -599,7 +598,7 @@ static struct configfs_attribute *phonet_attrs[] = { NULL, }; -static struct config_item_type phonet_func_type = { +static const struct config_item_type phonet_func_type = { .ct_item_ops = &phonet_item_ops, .ct_attrs = phonet_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c index ea0da35a44e2..dd607b99eb1d 100644 --- a/drivers/usb/gadget/function/f_printer.c +++ b/drivers/usb/gadget/function/f_printer.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_printer.c - USB printer function driver * @@ -8,11 +9,6 @@ * * Copyright (C) 2003-2005 David Brownell * Copyright (C) 2006 Craig W. Nadler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/module.h> @@ -1261,7 +1257,7 @@ static struct configfs_attribute *printer_attrs[] = { NULL, }; -static struct config_item_type printer_func_type = { +static const struct config_item_type printer_func_type = { .ct_item_ops = &printer_item_ops, .ct_attrs = printer_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c index c7c5b3ce1d98..d48df36622b7 100644 --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_rndis.c -- RNDIS link function driver * @@ -6,11 +7,6 @@ * Copyright (C) 2008 Nokia Corporation * Copyright (C) 2009 Samsung Electronics * Author: Michal Nazarewicz (mina86@mina86.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* #define VERBOSE_DEBUG */ @@ -890,7 +886,7 @@ static struct configfs_attribute *rndis_attrs[] = { NULL, }; -static struct config_item_type rndis_func_type = { +static const struct config_item_type rndis_func_type = { .ct_item_ops = &rndis_item_ops, .ct_attrs = rndis_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_serial.c b/drivers/usb/gadget/function/f_serial.c index cb00ada21d9c..c860f30a0ea2 100644 --- a/drivers/usb/gadget/function/f_serial.c +++ b/drivers/usb/gadget/function/f_serial.c @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_serial.c - generic USB serial function driver * * Copyright (C) 2003 Al Borchers (alborchers@steinerpoint.com) * Copyright (C) 2008 by David Brownell * Copyright (C) 2008 by Nokia Corporation - * - * This software is distributed under the terms of the GNU General - * Public License ("GPL") as published by the Free Software Foundation, - * either version 2 of that License or (at your option) any later version. */ #include <linux/slab.h> @@ -281,7 +278,7 @@ static struct configfs_attribute *acm_attrs[] = { NULL, }; -static struct config_item_type serial_func_type = { +static const struct config_item_type serial_func_type = { .ct_item_ops = &serial_item_ops, .ct_attrs = acm_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c index 8784fa12ea2c..9cdef108fb1b 100644 --- a/drivers/usb/gadget/function/f_sourcesink.c +++ b/drivers/usb/gadget/function/f_sourcesink.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_sourcesink.c - USB peripheral source/sink configuration driver * * Copyright (C) 2003-2008 David Brownell * Copyright (C) 2008 by Nokia Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* #define VERBOSE_DEBUG */ @@ -1230,7 +1226,7 @@ static struct configfs_attribute *ss_attrs[] = { NULL, }; -static struct config_item_type ss_func_type = { +static const struct config_item_type ss_func_type = { .ct_item_ops = &ss_item_ops, .ct_attrs = ss_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_subset.c b/drivers/usb/gadget/function/f_subset.c index 434b983f3b4c..4d945254905d 100644 --- a/drivers/usb/gadget/function/f_subset.c +++ b/drivers/usb/gadget/function/f_subset.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_subset.c -- "CDC Subset" Ethernet link function driver * * Copyright (C) 2003-2005,2008 David Brownell * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/slab.h> @@ -412,7 +408,7 @@ static struct configfs_attribute *gether_attrs[] = { NULL, }; -static struct config_item_type gether_func_type = { +static const struct config_item_type gether_func_type = { .ct_item_ops = &gether_item_ops, .ct_attrs = gether_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index a82e2bd5ea34..da81cf16b850 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1,10 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* Target based USB-Gadget * * UAS protocol handling, target callbacks, configfs handling, * BBB (USB Mass Storage Class Bulk-Only (BBB) and Transport protocol handling. * * Author: Sebastian Andrzej Siewior <bigeasy at linutronix dot de> - * License: GPLv2 as published by FSF. */ #include <linux/kernel.h> #include <linux/module.h> @@ -1145,6 +1145,7 @@ static int usbg_submit_command(struct f_uas *fu, default: pr_debug_once("Unsupported prio_attr: %02x.\n", cmd_iu->prio_attr); + /* fall through */ case UAS_SIMPLE_TAG: cmd->prio_attr = TCM_SIMPLE_TAG; break; @@ -2166,7 +2167,7 @@ static struct configfs_item_operations tcm_item_ops = { .release = tcm_attr_release, }; -static struct config_item_type tcm_func_type = { +static const struct config_item_type tcm_func_type = { .ct_item_ops = &tcm_item_ops, .ct_owner = THIS_MODULE, }; diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c index 29efbedc91f9..2746a926a8d9 100644 --- a/drivers/usb/gadget/function/f_uac1.c +++ b/drivers/usb/gadget/function/f_uac1.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_uac1.c -- USB Audio Class 1.0 Function (using u_audio API) * @@ -10,11 +11,6 @@ * This file is based on f_uac1.c which is * Copyright (C) 2008 Bryan Wu <cooloney@kernel.org> * Copyright (C) 2008 Analog Devices, Inc - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/usb/audio.h> @@ -709,7 +705,7 @@ static struct configfs_attribute *f_uac1_attrs[] = { NULL, }; -static struct config_item_type f_uac1_func_type = { +static const struct config_item_type f_uac1_func_type = { .ct_item_ops = &f_uac1_item_ops, .ct_attrs = f_uac1_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c index 5d229e72912e..04f4b2862256 100644 --- a/drivers/usb/gadget/function/f_uac1_legacy.c +++ b/drivers/usb/gadget/function/f_uac1_legacy.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_audio.c -- USB Audio class function driver * @@ -5,8 +6,6 @@ * Copyright (C) 2008 Analog Devices, Inc * * Enter bugs at http://blackfin.uclinux.org/ - * - * Licensed under the GPL-2 or later. */ #include <linux/slab.h> @@ -921,7 +920,7 @@ static struct configfs_attribute *f_uac1_attrs[] = { NULL, }; -static struct config_item_type f_uac1_func_type = { +static const struct config_item_type f_uac1_func_type = { .ct_item_ops = &f_uac1_item_ops, .ct_attrs = f_uac1_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index f05c3f3e6103..11fe788b4308 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_uac2.c -- USB Audio Class 2.0 Function * * Copyright (C) 2011 * Yadwinder Singh (yadi.brar01@gmail.com) * Jaswinder Singh (jaswinder.singh@linaro.org) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/usb/audio.h> @@ -921,7 +917,7 @@ static struct configfs_attribute *f_uac2_attrs[] = { NULL, }; -static struct config_item_type f_uac2_func_type = { +static const struct config_item_type f_uac2_func_type = { .ct_item_ops = &f_uac2_item_ops, .ct_attrs = f_uac2_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index f8a1881609a2..439eba660e95 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * uvc_gadget.c -- USB Video Class Gadget driver * * Copyright (C) 2009-2010 * Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/kernel.h> diff --git a/drivers/usb/gadget/function/f_uvc.h b/drivers/usb/gadget/function/f_uvc.h index d0a73bdcbba1..81defe4557fe 100644 --- a/drivers/usb/gadget/function/f_uvc.h +++ b/drivers/usb/gadget/function/f_uvc.h @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_uvc.h -- USB Video Class Gadget driver * * Copyright (C) 2009-2010 * Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #ifndef _F_UVC_H_ diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c index d6341045c631..51dd3e90b06c 100644 --- a/drivers/usb/gadget/function/rndis.c +++ b/drivers/usb/gadget/function/rndis.c @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * RNDIS MSG parser * * Authors: Benedikt Spranger, Pengutronix * Robert Schwebel, Pengutronix * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2, as published by the Free Software Foundation. - * * This software was originally developed in conformance with * Microsoft's Remote NDIS Specification License Agreement. * diff --git a/drivers/usb/gadget/function/rndis.h b/drivers/usb/gadget/function/rndis.h index 21e0430ffb98..c7e3a70ce6c1 100644 --- a/drivers/usb/gadget/function/rndis.h +++ b/drivers/usb/gadget/function/rndis.h @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * RNDIS Definitions for Remote NDIS * * Authors: Benedikt Spranger, Pengutronix * Robert Schwebel, Pengutronix * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2, as published by the Free Software Foundation. - * * This software was originally developed in conformance with * Microsoft's Remote NDIS Specification License Agreement. */ diff --git a/drivers/usb/gadget/function/storage_common.c b/drivers/usb/gadget/function/storage_common.c index 8fbf6861690d..f7e6c42558eb 100644 --- a/drivers/usb/gadget/function/storage_common.c +++ b/drivers/usb/gadget/function/storage_common.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * storage_common.c -- Common definitions for mass storage functionality * * Copyright (C) 2003-2008 Alan Stern * Copyeight (C) 2009 Samsung Electronics * Author: Michal Nazarewicz (mina86@mina86.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c index 3971bbab88bd..a72295c953bb 100644 --- a/drivers/usb/gadget/function/u_audio.c +++ b/drivers/usb/gadget/function/u_audio.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * u_audio.c -- interface to USB gadget "ALSA sound card" utilities * @@ -9,16 +10,6 @@ * Copyright (C) 2011 * Yadwinder Singh (yadi.brar01@gmail.com) * Jaswinder Singh (jaswinder.singh@linaro.org) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * 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. */ #include <linux/module.h> diff --git a/drivers/usb/gadget/function/u_audio.h b/drivers/usb/gadget/function/u_audio.h index 07e13784cbb8..81d3d4ed6dfb 100644 --- a/drivers/usb/gadget/function/u_audio.h +++ b/drivers/usb/gadget/function/u_audio.h @@ -1,19 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * u_audio.h -- interface to USB gadget "ALSA sound card" utilities * * Copyright (C) 2016 * Author: Ruslan Bilovol <ruslan.bilovol@gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * 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. - * */ #ifndef __U_AUDIO_H diff --git a/drivers/usb/gadget/function/u_ecm.h b/drivers/usb/gadget/function/u_ecm.h index 262cc03cc2c0..050aa672ee7f 100644 --- a/drivers/usb/gadget/function/u_ecm.h +++ b/drivers/usb/gadget/function/u_ecm.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_ecm.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef U_ECM_H diff --git a/drivers/usb/gadget/function/u_eem.h b/drivers/usb/gadget/function/u_eem.h index e3ae97874c4f..de3828d3e8f0 100644 --- a/drivers/usb/gadget/function/u_eem.h +++ b/drivers/usb/gadget/function/u_eem.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_eem.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef U_EEM_H diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index bdbc3fdc7c4f..6fcda62f55ea 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * u_ether.c -- Ethernet-over-USB link layer utilities for Gadget stack * * Copyright (C) 2003-2005,2008 David Brownell * Copyright (C) 2003-2004 Robert Schwebel, Benedikt Spranger * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* #define VERBOSE_DEBUG */ diff --git a/drivers/usb/gadget/function/u_ether.h b/drivers/usb/gadget/function/u_ether.h index c77145bd6b5b..332307d54292 100644 --- a/drivers/usb/gadget/function/u_ether.h +++ b/drivers/usb/gadget/function/u_ether.h @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * u_ether.h -- interface to USB gadget "ethernet link" utilities * * Copyright (C) 2003-2005,2008 David Brownell * Copyright (C) 2003-2004 Robert Schwebel, Benedikt Spranger * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #ifndef __U_ETHER_H diff --git a/drivers/usb/gadget/function/u_ether_configfs.h b/drivers/usb/gadget/function/u_ether_configfs.h index e4c3f84af4c3..cd33cee4d78b 100644 --- a/drivers/usb/gadget/function/u_ether_configfs.h +++ b/drivers/usb/gadget/function/u_ether_configfs.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_ether_configfs.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef __U_ETHER_CONFIGFS_H diff --git a/drivers/usb/gadget/function/u_fs.h b/drivers/usb/gadget/function/u_fs.h index 79f70ebf85dc..c3aba4dfa958 100644 --- a/drivers/usb/gadget/function/u_fs.h +++ b/drivers/usb/gadget/function/u_fs.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_fs.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef U_FFS_H diff --git a/drivers/usb/gadget/function/u_gether.h b/drivers/usb/gadget/function/u_gether.h index d4078426ba5d..5b7e2eb90336 100644 --- a/drivers/usb/gadget/function/u_gether.h +++ b/drivers/usb/gadget/function/u_gether.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_gether.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef U_GETHER_H diff --git a/drivers/usb/gadget/function/u_hid.h b/drivers/usb/gadget/function/u_hid.h index aaa0e368a159..2f5ca4bfa7ff 100644 --- a/drivers/usb/gadget/function/u_hid.h +++ b/drivers/usb/gadget/function/u_hid.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_hid.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef U_HID_H diff --git a/drivers/usb/gadget/function/u_midi.h b/drivers/usb/gadget/function/u_midi.h index 22510189758e..5599aa5fc977 100644 --- a/drivers/usb/gadget/function/u_midi.h +++ b/drivers/usb/gadget/function/u_midi.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_midi.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef U_MIDI_H diff --git a/drivers/usb/gadget/function/u_ncm.h b/drivers/usb/gadget/function/u_ncm.h index ce0f3a78ca13..67324f983343 100644 --- a/drivers/usb/gadget/function/u_ncm.h +++ b/drivers/usb/gadget/function/u_ncm.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_ncm.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef U_NCM_H diff --git a/drivers/usb/gadget/function/u_phonet.h b/drivers/usb/gadget/function/u_phonet.h index 98ced18779ea..12fb613f85d1 100644 --- a/drivers/usb/gadget/function/u_phonet.h +++ b/drivers/usb/gadget/function/u_phonet.h @@ -1,11 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * u_phonet.h - interface to Phonet * * Copyright (C) 2007-2008 by Nokia Corporation - * - * This software is distributed under the terms of the GNU General - * Public License ("GPL") as published by the Free Software Foundation, - * either version 2 of that License or (at your option) any later version. */ #ifndef __U_PHONET_H diff --git a/drivers/usb/gadget/function/u_printer.h b/drivers/usb/gadget/function/u_printer.h index 8d30b7577f87..6088ff744194 100644 --- a/drivers/usb/gadget/function/u_printer.h +++ b/drivers/usb/gadget/function/u_printer.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_printer.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef U_PRINTER_H diff --git a/drivers/usb/gadget/function/u_rndis.h b/drivers/usb/gadget/function/u_rndis.h index efdb7ac381d9..d65fb4ebac3c 100644 --- a/drivers/usb/gadget/function/u_rndis.h +++ b/drivers/usb/gadget/function/u_rndis.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_rndis.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef U_RNDIS_H diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index 4176216d54be..4d653d2960d4 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * u_serial.c - utilities for USB gadget "serial port"/TTY support * @@ -9,10 +10,6 @@ * Copyright (C) 1999 - 2002 Greg Kroah-Hartman (greg@kroah.com) * Copyright (C) 2000 Peter Berger (pberger@brimson.com) * Copyright (C) 2000 Al Borchers (alborchers@steinerpoint.com) - * - * This software is distributed under the terms of the GNU General - * Public License ("GPL") as published by the Free Software Foundation, - * either version 2 of that License or (at your option) any later version. */ /* #define VERBOSE_DEBUG */ @@ -1078,6 +1075,7 @@ static void gs_complete_out(struct usb_ep *ep, struct usb_request *req) default: pr_warn("%s: unexpected %s status %d\n", __func__, ep->name, req->status); + /* fall through */ case 0: /* normal completion */ spin_lock(&info->con_lock); diff --git a/drivers/usb/gadget/function/u_serial.h b/drivers/usb/gadget/function/u_serial.h index c20210c0babd..9acaac1cbb75 100644 --- a/drivers/usb/gadget/function/u_serial.h +++ b/drivers/usb/gadget/function/u_serial.h @@ -1,12 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * u_serial.h - interface to USB gadget "serial port"/TTY utilities * * Copyright (C) 2008 David Brownell * Copyright (C) 2008 by Nokia Corporation - * - * This software is distributed under the terms of the GNU General - * Public License ("GPL") as published by the Free Software Foundation, - * either version 2 of that License or (at your option) any later version. */ #ifndef __U_SERIAL_H diff --git a/drivers/usb/gadget/function/u_tcm.h b/drivers/usb/gadget/function/u_tcm.h index 0bd751e0483f..3f7ccecb0f9b 100644 --- a/drivers/usb/gadget/function/u_tcm.h +++ b/drivers/usb/gadget/function/u_tcm.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_tcm.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef U_TCM_H diff --git a/drivers/usb/gadget/function/u_uac1.h b/drivers/usb/gadget/function/u_uac1.h index 6f188fd8633f..6f1a9d73defe 100644 --- a/drivers/usb/gadget/function/u_uac1.h +++ b/drivers/usb/gadget/function/u_uac1.h @@ -1,11 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_uac1.h - Utility definitions for UAC1 function * * Copyright (C) 2016 Ruslan Bilovol <ruslan.bilovol@gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef __U_UAC1_H diff --git a/drivers/usb/gadget/function/u_uac1_legacy.c b/drivers/usb/gadget/function/u_uac1_legacy.c index fa4684a1c54c..cbc868d117af 100644 --- a/drivers/usb/gadget/function/u_uac1_legacy.c +++ b/drivers/usb/gadget/function/u_uac1_legacy.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * u_uac1.c -- ALSA audio utilities for Gadget stack * @@ -5,8 +6,6 @@ * Copyright (C) 2008 Analog Devices, Inc * * Enter bugs at http://blackfin.uclinux.org/ - * - * Licensed under the GPL-2 or later. */ #include <linux/kernel.h> diff --git a/drivers/usb/gadget/function/u_uac1_legacy.h b/drivers/usb/gadget/function/u_uac1_legacy.h index d715b1af56a4..dd69e408a3d9 100644 --- a/drivers/usb/gadget/function/u_uac1_legacy.h +++ b/drivers/usb/gadget/function/u_uac1_legacy.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * u_uac1.h -- interface to USB gadget "ALSA AUDIO" utilities * @@ -5,8 +6,6 @@ * Copyright (C) 2008 Analog Devices, Inc * * Enter bugs at http://blackfin.uclinux.org/ - * - * Licensed under the GPL-2 or later. */ #ifndef __U_UAC1_LEGACY_H diff --git a/drivers/usb/gadget/function/u_uac2.h b/drivers/usb/gadget/function/u_uac2.h index 19eeb83538a5..8362ee572e1e 100644 --- a/drivers/usb/gadget/function/u_uac2.h +++ b/drivers/usb/gadget/function/u_uac2.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_uac2.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef U_UAC2_H diff --git a/drivers/usb/gadget/function/u_uvc.h b/drivers/usb/gadget/function/u_uvc.h index 4676b60a5063..d00d3ded71c0 100644 --- a/drivers/usb/gadget/function/u_uvc.h +++ b/drivers/usb/gadget/function/u_uvc.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_uvc.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef U_UVC_H diff --git a/drivers/usb/gadget/function/uvc.h b/drivers/usb/gadget/function/uvc.h index 11d70dead32b..a64e07e61f8c 100644 --- a/drivers/usb/gadget/function/uvc.h +++ b/drivers/usb/gadget/function/uvc.h @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * uvc_gadget.h -- USB Video Class Gadget driver * * Copyright (C) 2009-2010 * Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #ifndef _UVC_GADGET_H_ diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c index 844cb738bafd..c9b8cc4aae5a 100644 --- a/drivers/usb/gadget/function/uvc_configfs.c +++ b/drivers/usb/gadget/function/uvc_configfs.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * uvc_configfs.c * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #include "u_uvc.h" #include "uvc_configfs.h" @@ -127,7 +124,7 @@ static struct configfs_attribute *uvcg_control_header_attrs[] = { NULL, }; -static struct config_item_type uvcg_control_header_type = { +static const struct config_item_type uvcg_control_header_type = { .ct_attrs = uvcg_control_header_attrs, .ct_owner = THIS_MODULE, }; @@ -170,7 +167,7 @@ static struct configfs_group_operations uvcg_control_header_grp_ops = { .drop_item = uvcg_control_header_drop, }; -static struct config_item_type uvcg_control_header_grp_type = { +static const struct config_item_type uvcg_control_header_grp_type = { .ct_group_ops = &uvcg_control_header_grp_ops, .ct_owner = THIS_MODULE, }; @@ -265,7 +262,7 @@ static struct configfs_attribute *uvcg_default_processing_attrs[] = { NULL, }; -static struct config_item_type uvcg_default_processing_type = { +static const struct config_item_type uvcg_default_processing_type = { .ct_attrs = uvcg_default_processing_attrs, .ct_owner = THIS_MODULE, }; @@ -277,7 +274,7 @@ static struct uvcg_processing_grp { struct config_group group; } uvcg_processing_grp; -static struct config_item_type uvcg_processing_grp_type = { +static const struct config_item_type uvcg_processing_grp_type = { .ct_owner = THIS_MODULE, }; @@ -382,7 +379,7 @@ static struct configfs_attribute *uvcg_default_camera_attrs[] = { NULL, }; -static struct config_item_type uvcg_default_camera_type = { +static const struct config_item_type uvcg_default_camera_type = { .ct_attrs = uvcg_default_camera_attrs, .ct_owner = THIS_MODULE, }; @@ -394,7 +391,7 @@ static struct uvcg_camera_grp { struct config_group group; } uvcg_camera_grp; -static struct config_item_type uvcg_camera_grp_type = { +static const struct config_item_type uvcg_camera_grp_type = { .ct_owner = THIS_MODULE, }; @@ -460,7 +457,7 @@ static struct configfs_attribute *uvcg_default_output_attrs[] = { NULL, }; -static struct config_item_type uvcg_default_output_type = { +static const struct config_item_type uvcg_default_output_type = { .ct_attrs = uvcg_default_output_attrs, .ct_owner = THIS_MODULE, }; @@ -472,7 +469,7 @@ static struct uvcg_output_grp { struct config_group group; } uvcg_output_grp; -static struct config_item_type uvcg_output_grp_type = { +static const struct config_item_type uvcg_output_grp_type = { .ct_owner = THIS_MODULE, }; @@ -481,7 +478,7 @@ static struct uvcg_terminal_grp { struct config_group group; } uvcg_terminal_grp; -static struct config_item_type uvcg_terminal_grp_type = { +static const struct config_item_type uvcg_terminal_grp_type = { .ct_owner = THIS_MODULE, }; @@ -586,7 +583,7 @@ static struct configfs_item_operations uvcg_control_class_item_ops = { .drop_link = uvcg_control_class_drop_link, }; -static struct config_item_type uvcg_control_class_type = { +static const struct config_item_type uvcg_control_class_type = { .ct_item_ops = &uvcg_control_class_item_ops, .ct_owner = THIS_MODULE, }; @@ -596,7 +593,7 @@ static struct uvcg_control_class_grp { struct config_group group; } uvcg_control_class_grp; -static struct config_item_type uvcg_control_class_grp_type = { +static const struct config_item_type uvcg_control_class_grp_type = { .ct_owner = THIS_MODULE, }; @@ -605,7 +602,7 @@ static struct uvcg_control_grp { struct config_group group; } uvcg_control_grp; -static struct config_item_type uvcg_control_grp_type = { +static const struct config_item_type uvcg_control_grp_type = { .ct_owner = THIS_MODULE, }; @@ -857,7 +854,7 @@ static struct configfs_attribute *uvcg_streaming_header_attrs[] = { NULL, }; -static struct config_item_type uvcg_streaming_header_type = { +static const struct config_item_type uvcg_streaming_header_type = { .ct_item_ops = &uvcg_streaming_header_item_ops, .ct_attrs = uvcg_streaming_header_attrs, .ct_owner = THIS_MODULE, @@ -901,7 +898,7 @@ static struct configfs_group_operations uvcg_streaming_header_grp_ops = { .drop_item = uvcg_streaming_header_drop, }; -static struct config_item_type uvcg_streaming_header_grp_type = { +static const struct config_item_type uvcg_streaming_header_grp_type = { .ct_group_ops = &uvcg_streaming_header_grp_ops, .ct_owner = THIS_MODULE, }; @@ -1150,7 +1147,7 @@ static struct configfs_attribute *uvcg_frame_attrs[] = { NULL, }; -static struct config_item_type uvcg_frame_type = { +static const struct config_item_type uvcg_frame_type = { .ct_attrs = uvcg_frame_attrs, .ct_owner = THIS_MODULE, }; @@ -1419,7 +1416,7 @@ static struct configfs_attribute *uvcg_uncompressed_attrs[] = { NULL, }; -static struct config_item_type uvcg_uncompressed_type = { +static const struct config_item_type uvcg_uncompressed_type = { .ct_group_ops = &uvcg_uncompressed_group_ops, .ct_attrs = uvcg_uncompressed_attrs, .ct_owner = THIS_MODULE, @@ -1469,7 +1466,7 @@ static struct configfs_group_operations uvcg_uncompressed_grp_ops = { .drop_item = uvcg_uncompressed_drop, }; -static struct config_item_type uvcg_uncompressed_grp_type = { +static const struct config_item_type uvcg_uncompressed_grp_type = { .ct_group_ops = &uvcg_uncompressed_grp_ops, .ct_owner = THIS_MODULE, }; @@ -1619,7 +1616,7 @@ static struct configfs_attribute *uvcg_mjpeg_attrs[] = { NULL, }; -static struct config_item_type uvcg_mjpeg_type = { +static const struct config_item_type uvcg_mjpeg_type = { .ct_group_ops = &uvcg_mjpeg_group_ops, .ct_attrs = uvcg_mjpeg_attrs, .ct_owner = THIS_MODULE, @@ -1663,7 +1660,7 @@ static struct configfs_group_operations uvcg_mjpeg_grp_ops = { .drop_item = uvcg_mjpeg_drop, }; -static struct config_item_type uvcg_mjpeg_grp_type = { +static const struct config_item_type uvcg_mjpeg_grp_type = { .ct_group_ops = &uvcg_mjpeg_grp_ops, .ct_owner = THIS_MODULE, }; @@ -1728,7 +1725,7 @@ static struct configfs_attribute *uvcg_default_color_matching_attrs[] = { NULL, }; -static struct config_item_type uvcg_default_color_matching_type = { +static const struct config_item_type uvcg_default_color_matching_type = { .ct_attrs = uvcg_default_color_matching_attrs, .ct_owner = THIS_MODULE, }; @@ -1740,7 +1737,7 @@ static struct uvcg_color_matching_grp { struct config_group group; } uvcg_color_matching_grp; -static struct config_item_type uvcg_color_matching_grp_type = { +static const struct config_item_type uvcg_color_matching_grp_type = { .ct_owner = THIS_MODULE, }; @@ -2085,7 +2082,7 @@ static struct configfs_item_operations uvcg_streaming_class_item_ops = { .drop_link = uvcg_streaming_class_drop_link, }; -static struct config_item_type uvcg_streaming_class_type = { +static const struct config_item_type uvcg_streaming_class_type = { .ct_item_ops = &uvcg_streaming_class_item_ops, .ct_owner = THIS_MODULE, }; @@ -2095,7 +2092,7 @@ static struct uvcg_streaming_class_grp { struct config_group group; } uvcg_streaming_class_grp; -static struct config_item_type uvcg_streaming_class_grp_type = { +static const struct config_item_type uvcg_streaming_class_grp_type = { .ct_owner = THIS_MODULE, }; @@ -2104,7 +2101,7 @@ static struct uvcg_streaming_grp { struct config_group group; } uvcg_streaming_grp; -static struct config_item_type uvcg_streaming_grp_type = { +static const struct config_item_type uvcg_streaming_grp_type = { .ct_owner = THIS_MODULE, }; @@ -2190,7 +2187,7 @@ static struct configfs_attribute *uvc_attrs[] = { NULL, }; -static struct config_item_type uvc_func_type = { +static const struct config_item_type uvc_func_type = { .ct_item_ops = &uvc_item_ops, .ct_attrs = uvc_attrs, .ct_owner = THIS_MODULE, diff --git a/drivers/usb/gadget/function/uvc_configfs.h b/drivers/usb/gadget/function/uvc_configfs.h index 085e67be7c71..8549c0b27b9d 100644 --- a/drivers/usb/gadget/function/uvc_configfs.h +++ b/drivers/usb/gadget/function/uvc_configfs.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * uvc_configfs.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef UVC_CONFIGFS_H #define UVC_CONFIGFS_H diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c index 6377e9fee6e5..278d50ff1eea 100644 --- a/drivers/usb/gadget/function/uvc_queue.c +++ b/drivers/usb/gadget/function/uvc_queue.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * uvc_queue.c -- USB Video Class driver - Buffers management * * Copyright (C) 2005-2010 * Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/atomic.h> diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/function/uvc_v4l2.c index 3e22b45687d3..f3069db6f08e 100644 --- a/drivers/usb/gadget/function/uvc_v4l2.c +++ b/drivers/usb/gadget/function/uvc_v4l2.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * uvc_v4l2.c -- USB Video Class Gadget driver * * Copyright (C) 2009-2010 * Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/kernel.h> @@ -354,7 +350,7 @@ static unsigned long uvcg_v4l2_get_unmapped_area(struct file *file, } #endif -struct v4l2_file_operations uvc_v4l2_fops = { +const struct v4l2_file_operations uvc_v4l2_fops = { .owner = THIS_MODULE, .open = uvc_v4l2_open, .release = uvc_v4l2_release, diff --git a/drivers/usb/gadget/function/uvc_v4l2.h b/drivers/usb/gadget/function/uvc_v4l2.h index 2683b92fda65..a75e9c397446 100644 --- a/drivers/usb/gadget/function/uvc_v4l2.h +++ b/drivers/usb/gadget/function/uvc_v4l2.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * uvc_v4l2.h -- USB Video Class Gadget driver * @@ -7,16 +8,12 @@ * Copyright (c) 2013 Samsung Electronics Co., Ltd. * http://www.samsung.com * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef __UVC_V4L2_H__ #define __UVC_V4L2_H__ extern const struct v4l2_ioctl_ops uvc_v4l2_ioctl_ops; -extern struct v4l2_file_operations uvc_v4l2_fops; +extern const struct v4l2_file_operations uvc_v4l2_fops; #endif /* __UVC_V4L2_H__ */ diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c index 0f01c04d7cbd..d3567b90343a 100644 --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * uvc_video.c -- USB Video Class Gadget driver * * Copyright (C) 2009-2010 * Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/kernel.h> diff --git a/drivers/usb/gadget/function/uvc_video.h b/drivers/usb/gadget/function/uvc_video.h index ef00f06fa00b..6c20aa75f966 100644 --- a/drivers/usb/gadget/function/uvc_video.h +++ b/drivers/usb/gadget/function/uvc_video.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * uvc_video.h -- USB Video Class Gadget driver * @@ -7,10 +8,6 @@ * Copyright (c) 2013 Samsung Electronics Co., Ltd. * http://www.samsung.com * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef __UVC_VIDEO_H__ #define __UVC_VIDEO_H__ diff --git a/drivers/usb/gadget/functions.c b/drivers/usb/gadget/functions.c index b13f839e7368..203361a64212 100644 --- a/drivers/usb/gadget/functions.c +++ b/drivers/usb/gadget/functions.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/kernel.h> #include <linux/slab.h> #include <linux/module.h> diff --git a/drivers/usb/gadget/legacy/acm_ms.c b/drivers/usb/gadget/legacy/acm_ms.c index c39de65a448b..af16672d5118 100644 --- a/drivers/usb/gadget/legacy/acm_ms.c +++ b/drivers/usb/gadget/legacy/acm_ms.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * acm_ms.c -- Composite driver, with ACM and mass storage support * @@ -7,11 +8,6 @@ * Modified: Klaus Schwarzkopf <schwarzkopf@sensortherm.de> * * Heavily based on multi.c and cdc2.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/kernel.h> diff --git a/drivers/usb/gadget/legacy/audio.c b/drivers/usb/gadget/legacy/audio.c index 1f5cdbe162df..7b11dce98b94 100644 --- a/drivers/usb/gadget/legacy/audio.c +++ b/drivers/usb/gadget/legacy/audio.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * audio.c -- Audio gadget driver * @@ -5,8 +6,6 @@ * Copyright (C) 2008 Analog Devices, Inc * * Enter bugs at http://blackfin.uclinux.org/ - * - * Licensed under the GPL-2 or later. */ /* #define VERBOSE_DEBUG */ diff --git a/drivers/usb/gadget/legacy/cdc2.c b/drivers/usb/gadget/legacy/cdc2.c index 51c08682de84..da1c37933ca1 100644 --- a/drivers/usb/gadget/legacy/cdc2.c +++ b/drivers/usb/gadget/legacy/cdc2.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * cdc2.c -- CDC Composite driver, with ECM and ACM support * * Copyright (C) 2008 David Brownell * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/kernel.h> diff --git a/drivers/usb/gadget/legacy/dbgp.c b/drivers/usb/gadget/legacy/dbgp.c index 99ca3dabc4f3..e1d566c9918a 100644 --- a/drivers/usb/gadget/legacy/dbgp.c +++ b/drivers/usb/gadget/legacy/dbgp.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * dbgp.c -- EHCI Debug Port device gadget * diff --git a/drivers/usb/gadget/legacy/ether.c b/drivers/usb/gadget/legacy/ether.c index 25a2c2e48592..30313b233680 100644 --- a/drivers/usb/gadget/legacy/ether.c +++ b/drivers/usb/gadget/legacy/ether.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * ether.c -- Ethernet gadget driver, with CDC and non-CDC options * * Copyright (C) 2003-2005,2008 David Brownell * Copyright (C) 2003-2004 Robert Schwebel, Benedikt Spranger * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* #define VERBOSE_DEBUG */ diff --git a/drivers/usb/gadget/legacy/g_ffs.c b/drivers/usb/gadget/legacy/g_ffs.c index 6da7316f8e87..b640ed3fcf70 100644 --- a/drivers/usb/gadget/legacy/g_ffs.c +++ b/drivers/usb/gadget/legacy/g_ffs.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * g_ffs.c -- user mode file system API for USB composite function controllers * * Copyright (C) 2010 Samsung Electronics * Author: Michal Nazarewicz <mina86@mina86.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #define pr_fmt(fmt) "g_ffs: " fmt diff --git a/drivers/usb/gadget/legacy/gmidi.c b/drivers/usb/gadget/legacy/gmidi.c index 0bf39c3ccdb1..9eea2d18f2bf 100644 --- a/drivers/usb/gadget/legacy/gmidi.c +++ b/drivers/usb/gadget/legacy/gmidi.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * gmidi.c -- USB MIDI Gadget Driver * @@ -5,9 +6,6 @@ * Developed for Thumtronics by Grey Innovation * Ben Williamson <ben.williamson@greyinnovation.com> * - * This software is distributed under the terms of the GNU General Public - * License ("GPL") version 2, as published by the Free Software Foundation. - * * This code is based in part on: * * Gadget Zero driver, Copyright (C) 2003-2004 David Brownell. diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c index a71a884f79fc..c4eda7fe7ab4 100644 --- a/drivers/usb/gadget/legacy/hid.c +++ b/drivers/usb/gadget/legacy/hid.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * hid.c -- HID Composite driver * * Based on multi.c * * Copyright (C) 2010 Fabien Chouteau <fabien.chouteau@barco.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index 5c28bee327e1..9343ec436485 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * inode.c -- user mode filesystem api for usb gadget controllers * * Copyright (C) 2003-2004 David Brownell * Copyright (C) 2003 Agilent Technologies - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ diff --git a/drivers/usb/gadget/legacy/mass_storage.c b/drivers/usb/gadget/legacy/mass_storage.c index fcba59782f26..ef3d25259b0e 100644 --- a/drivers/usb/gadget/legacy/mass_storage.c +++ b/drivers/usb/gadget/legacy/mass_storage.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * mass_storage.c -- Mass Storage USB Gadget * @@ -5,11 +6,6 @@ * Copyright (C) 2009 Samsung Electronics * Author: Michal Nazarewicz <mina86@mina86.com> * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ diff --git a/drivers/usb/gadget/legacy/multi.c b/drivers/usb/gadget/legacy/multi.c index a70a406580ea..50515f9e1022 100644 --- a/drivers/usb/gadget/legacy/multi.c +++ b/drivers/usb/gadget/legacy/multi.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * multi.c -- Multifunction Composite driver * @@ -5,11 +6,6 @@ * Copyright (C) 2008 Nokia Corporation * Copyright (C) 2009 Samsung Electronics * Author: Michal Nazarewicz (mina86@mina86.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ diff --git a/drivers/usb/gadget/legacy/ncm.c b/drivers/usb/gadget/legacy/ncm.c index 0aba68253e3d..fcee1ee0bf66 100644 --- a/drivers/usb/gadget/legacy/ncm.c +++ b/drivers/usb/gadget/legacy/ncm.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * ncm.c -- NCM gadget driver * @@ -9,11 +10,6 @@ * Copyright (C) 2003-2005,2008 David Brownell * Copyright (C) 2003-2004 Robert Schwebel, Benedikt Spranger * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* #define DEBUG */ diff --git a/drivers/usb/gadget/legacy/nokia.c b/drivers/usb/gadget/legacy/nokia.c index b1e535f4022e..978c1a34a932 100644 --- a/drivers/usb/gadget/legacy/nokia.c +++ b/drivers/usb/gadget/legacy/nokia.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * nokia.c -- Nokia Composite Gadget Driver * @@ -9,10 +10,6 @@ * Copyright (C) 2003 Al Borchers (alborchers@steinerpoint.com) * Copyright (C) 2008 by David Brownell * Copyright (C) 2008 by Nokia Corporation - * - * This software is distributed under the terms of the GNU General - * Public License ("GPL") as published by the Free Software Foundation, - * version 2 of that License. */ #include <linux/kernel.h> diff --git a/drivers/usb/gadget/legacy/printer.c b/drivers/usb/gadget/legacy/printer.c index 4c9cfff34a03..57858f0c2b6c 100644 --- a/drivers/usb/gadget/legacy/printer.c +++ b/drivers/usb/gadget/legacy/printer.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * printer.c -- Printer gadget driver * * Copyright (C) 2003-2005 David Brownell * Copyright (C) 2006 Craig W. Nadler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/module.h> diff --git a/drivers/usb/gadget/legacy/serial.c b/drivers/usb/gadget/legacy/serial.c index 9d89adce756d..de30d7628eef 100644 --- a/drivers/usb/gadget/legacy/serial.c +++ b/drivers/usb/gadget/legacy/serial.c @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * serial.c -- USB gadget serial driver * * Copyright (C) 2003 Al Borchers (alborchers@steinerpoint.com) * Copyright (C) 2008 by David Brownell * Copyright (C) 2008 by Nokia Corporation - * - * This software is distributed under the terms of the GNU General - * Public License ("GPL") as published by the Free Software Foundation, - * either version 2 of that License or (at your option) any later version. */ #include <linux/kernel.h> diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c b/drivers/usb/gadget/legacy/tcm_usb_gadget.c index 0b0bb98319cd..682bf99dcf76 100644 --- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c +++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c @@ -1,10 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* Target based USB-Gadget * * UAS protocol handling, target callbacks, configfs handling, * BBB (USB Mass Storage Class Bulk-Only (BBB) and Transport protocol handling. * * Author: Sebastian Andrzej Siewior <bigeasy at linutronix dot de> - * License: GPLv2 as published by FSF. */ #include <linux/kernel.h> #include <linux/module.h> diff --git a/drivers/usb/gadget/legacy/webcam.c b/drivers/usb/gadget/legacy/webcam.c index 82c13fce9232..6b86568c9157 100644 --- a/drivers/usb/gadget/legacy/webcam.c +++ b/drivers/usb/gadget/legacy/webcam.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * webcam.c -- USB webcam gadget driver * * Copyright (C) 2009-2010 * Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/kernel.h> diff --git a/drivers/usb/gadget/legacy/zero.c b/drivers/usb/gadget/legacy/zero.c index d02e2ce73ea5..6e84b44c8a3b 100644 --- a/drivers/usb/gadget/legacy/zero.c +++ b/drivers/usb/gadget/legacy/zero.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * zero.c -- Gadget Zero, for USB development * * Copyright (C) 2003-2008 David Brownell * Copyright (C) 2008 by Nokia Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* @@ -154,10 +150,11 @@ static struct usb_gadget_strings *dev_strings[] = { /*-------------------------------------------------------------------------*/ static struct timer_list autoresume_timer; +static struct usb_composite_dev *autoresume_cdev; -static void zero_autoresume(unsigned long _c) +static void zero_autoresume(struct timer_list *unused) { - struct usb_composite_dev *cdev = (void *)_c; + struct usb_composite_dev *cdev = autoresume_cdev; struct usb_gadget *g = cdev->gadget; /* unconfigured devices can't issue wakeups */ @@ -282,7 +279,8 @@ static int zero_bind(struct usb_composite_dev *cdev) device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id; device_desc.iSerialNumber = strings_dev[USB_GADGET_SERIAL_IDX].id; - setup_timer(&autoresume_timer, zero_autoresume, (unsigned long) cdev); + autoresume_cdev = cdev; + timer_setup(&autoresume_timer, zero_autoresume, 0); func_inst_ss = usb_get_function_instance("SourceSink"); if (IS_ERR(func_inst_ss)) diff --git a/drivers/usb/gadget/u_f.c b/drivers/usb/gadget/u_f.c index 18839732c840..dbaa46eee853 100644 --- a/drivers/usb/gadget/u_f.c +++ b/drivers/usb/gadget/u_f.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_f.c -- USB function utilities for Gadget stack * @@ -5,10 +6,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #include "u_f.h" diff --git a/drivers/usb/gadget/u_f.h b/drivers/usb/gadget/u_f.h index 7d53a4773d1a..c3fbef2bb5db 100644 --- a/drivers/usb/gadget/u_f.h +++ b/drivers/usb/gadget/u_f.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_f.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef __U_F_H__ diff --git a/drivers/usb/gadget/u_os_desc.h b/drivers/usb/gadget/u_os_desc.h index 947b7ddff691..8acd21779ac8 100644 --- a/drivers/usb/gadget/u_os_desc.h +++ b/drivers/usb/gadget/u_os_desc.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * u_os_desc.h * @@ -7,10 +8,6 @@ * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef __U_OS_DESC_H__ diff --git a/drivers/usb/gadget/udc/amd5536udc.h b/drivers/usb/gadget/udc/amd5536udc.h index 4fe22d432af2..dfdef6a28904 100644 --- a/drivers/usb/gadget/udc/amd5536udc.h +++ b/drivers/usb/gadget/udc/amd5536udc.h @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * amd5536.h -- header for AMD 5536 UDC high/full speed USB device controller * * Copyright (C) 2007 AMD (http://www.amd.com) * Author: Thomas Dahlmann - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #ifndef AMD5536UDC_H diff --git a/drivers/usb/gadget/udc/amd5536udc_pci.c b/drivers/usb/gadget/udc/amd5536udc_pci.c index 57a13f080a79..57b6f66331cf 100644 --- a/drivers/usb/gadget/udc/amd5536udc_pci.c +++ b/drivers/usb/gadget/udc/amd5536udc_pci.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * amd5536udc_pci.c -- AMD 5536 UDC high/full speed USB device controller * * Copyright (C) 2005-2007 AMD (http://www.amd.com) * Author: Thomas Dahlmann - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index 8bc78418d40e..bfe278294e88 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * at91_udc -- driver for at91-series USB peripheral controller * * Copyright (C) 2004 by Thomas Rathbone * Copyright (C) 2005 by HP Labs * Copyright (C) 2005 by David Brownell - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #undef VERBOSE_DEBUG diff --git a/drivers/usb/gadget/udc/at91_udc.h b/drivers/usb/gadget/udc/at91_udc.h index 9bbe72764f31..fd58c5b81826 100644 --- a/drivers/usb/gadget/udc/at91_udc.h +++ b/drivers/usb/gadget/udc/at91_udc.h @@ -1,12 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2004 by Thomas Rathbone, HP Labs * Copyright (C) 2005 by Ivan Kokshaysky * Copyright (C) 2006 by SAN People - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #ifndef AT91_UDC_H diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index a884c022df7a..075eaaa8a408 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -1,11 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Driver for the Atmel USBA high speed USB device controller * * Copyright (C) 2005-2007 Atmel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #include <linux/clk.h> #include <linux/clk/at91_pmc.h> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h index f8ebe0389bd4..860a00a6fdd0 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.h +++ b/drivers/usb/gadget/udc/atmel_usba_udc.h @@ -1,11 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Driver for the Atmel USBA high speed USB device controller * * Copyright (C) 2005-2007 Atmel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef __LINUX_USB_GADGET_USBA_UDC_H__ #define __LINUX_USB_GADGET_USBA_UDC_H__ diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c index f78503203f42..29f254793592 100644 --- a/drivers/usb/gadget/udc/bcm63xx_udc.c +++ b/drivers/usb/gadget/udc/bcm63xx_udc.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * bcm63xx_udc.c -- BCM63xx UDC high/full speed USB device controller * * Copyright (C) 2012 Kevin Cernekee <cernekee@gmail.com> * Copyright (C) 2012 Broadcom Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/bitops.h> diff --git a/drivers/usb/gadget/udc/bdc/bdc.h b/drivers/usb/gadget/udc/bdc/bdc.h index 6df0352cdc50..6e1e881dc51e 100644 --- a/drivers/usb/gadget/udc/bdc/bdc.h +++ b/drivers/usb/gadget/udc/bdc/bdc.h @@ -1,15 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * bdc.h - header for the BRCM BDC USB3.0 device controller * * Copyright (C) 2014 Broadcom Corporation * * Author: Ashwini Pahuja - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * */ #ifndef __LINUX_BDC_H__ diff --git a/drivers/usb/gadget/udc/bdc/bdc_cmd.c b/drivers/usb/gadget/udc/bdc/bdc_cmd.c index 6e920f1dce02..6305bf2c8b59 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_cmd.c +++ b/drivers/usb/gadget/udc/bdc/bdc_cmd.c @@ -1,15 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * bdc_cmd.c - BRCM BDC USB3.0 device controller * * Copyright (C) 2014 Broadcom Corporation * * Author: Ashwini Pahuja - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * */ #include <linux/scatterlist.h> #include <linux/slab.h> diff --git a/drivers/usb/gadget/udc/bdc/bdc_cmd.h b/drivers/usb/gadget/udc/bdc/bdc_cmd.h index 61d0e3bf9853..29cc988a671a 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_cmd.h +++ b/drivers/usb/gadget/udc/bdc/bdc_cmd.h @@ -1,15 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * bdc_cmd.h - header for the BDC debug functions * * Copyright (C) 2014 Broadcom Corporation * * Author: Ashwini Pahuja - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * */ #ifndef __LINUX_BDC_CMD_H__ #define __LINUX_BDC_CMD_H__ diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c index 7a8af4b916cf..d39f070acbd7 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_core.c +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c @@ -1,15 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * bdc_core.c - BRCM BDC USB3.0 device controller core operations * * Copyright (C) 2014 Broadcom Corporation * * Author: Ashwini Pahuja - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * */ #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/usb/gadget/udc/bdc/bdc_dbg.c b/drivers/usb/gadget/udc/bdc/bdc_dbg.c index ac98f6f681b7..7ba7448ad743 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_dbg.c +++ b/drivers/usb/gadget/udc/bdc/bdc_dbg.c @@ -1,15 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * bdc_dbg.c - BRCM BDC USB3.0 device controller debug functions * * Copyright (C) 2014 Broadcom Corporation * * Author: Ashwini Pahuja - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * */ #include "bdc.h" diff --git a/drivers/usb/gadget/udc/bdc/bdc_dbg.h b/drivers/usb/gadget/udc/bdc/bdc_dbg.h index 338a6c701315..373d5abffbb8 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_dbg.h +++ b/drivers/usb/gadget/udc/bdc/bdc_dbg.h @@ -1,15 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * bdc_dbg.h - header for the BDC debug functions * * Copyright (C) 2014 Broadcom Corporation * * Author: Ashwini Pahuja - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * */ #ifndef __LINUX_BDC_DBG_H__ #define __LINUX_BDC_DBG_H__ diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c index bfd8f7ade935..f40d4c13cfa4 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_ep.c +++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * bdc_ep.c - BRCM BDC USB3.0 device controller endpoint related functions * @@ -6,12 +7,6 @@ * Author: Ashwini Pahuja * * Based on drivers under drivers/usb/ - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * */ #include <linux/module.h> #include <linux/pci.h> diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.h b/drivers/usb/gadget/udc/bdc/bdc_ep.h index 8a6b36cbf2ea..a37ff8033b4f 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_ep.h +++ b/drivers/usb/gadget/udc/bdc/bdc_ep.h @@ -1,15 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * bdc_ep.h - header for the BDC debug functions * * Copyright (C) 2014 Broadcom Corporation * * Author: Ashwini Pahuja - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * */ #ifndef __LINUX_BDC_EP_H__ #define __LINUX_BDC_EP_H__ diff --git a/drivers/usb/gadget/udc/bdc/bdc_pci.c b/drivers/usb/gadget/udc/bdc/bdc_pci.c index 02968842b359..1e940f054cb8 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_pci.c +++ b/drivers/usb/gadget/udc/bdc/bdc_pci.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * bdc_pci.c - BRCM BDC USB3.0 device controller PCI interface file. * @@ -6,12 +7,6 @@ * Author: Ashwini Pahuja * * Based on drivers under drivers/usb/ - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * */ #include <linux/kernel.h> diff --git a/drivers/usb/gadget/udc/bdc/bdc_udc.c b/drivers/usb/gadget/udc/bdc/bdc_udc.c index c84346146456..7bfd58c846f7 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_udc.c +++ b/drivers/usb/gadget/udc/bdc/bdc_udc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * bdc_udc.c - BRCM BDC USB3.0 device controller gagdet ops * @@ -6,12 +7,6 @@ * Author: Ashwini Pahuja * * Based on drivers under drivers/usb/gadget/udc/ - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * */ #include <linux/module.h> #include <linux/pci.h> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index d41d07aae0ce..61422d624ad0 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -1,20 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 /** * udc.c - Core UDC Framework * * Copyright (C) 2010 Texas Instruments * Author: Felipe Balbi <balbi@ti.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 of - * the 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <linux/kernel.h> @@ -912,7 +901,7 @@ int usb_gadget_ep_match_desc(struct usb_gadget *gadget, return 0; type = usb_endpoint_type(desc); - max = 0x7ff & usb_endpoint_maxp(desc); + max = usb_endpoint_maxp(desc); if (usb_endpoint_dir_in(desc) && !ep->caps.dir_in) return 0; diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c index f04e91ef9e7c..4f1b1809472c 100644 --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * dummy_hcd.c -- Dummy/Loopback USB host and device emulator driver. * @@ -5,11 +6,6 @@ * * Copyright (C) 2003 David Brownell * Copyright (C) 2003-2005 Alan Stern - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ @@ -23,6 +19,8 @@ * * Having this all in one kernel can help some stages of development, * bypassing some hardware (and driver) issues. UML could help too. + * + * Note: The emulation does not include isochronous transfers! */ #include <linux/module.h> @@ -137,6 +135,9 @@ static const struct { .caps = _caps, \ } +/* we don't provide isochronous endpoints since we don't support them */ +#define TYPE_BULK_OR_INT (USB_EP_CAPS_TYPE_BULK | USB_EP_CAPS_TYPE_INT) + /* everyone has ep0 */ EP_INFO(ep0name, USB_EP_CAPS(USB_EP_CAPS_TYPE_CONTROL, USB_EP_CAPS_DIR_ALL)), @@ -145,64 +146,72 @@ static const struct { USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_IN)), EP_INFO("ep2out-bulk", USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_OUT)), +/* EP_INFO("ep3in-iso", USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_IN)), EP_INFO("ep4out-iso", USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_OUT)), +*/ EP_INFO("ep5in-int", USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, USB_EP_CAPS_DIR_IN)), EP_INFO("ep6in-bulk", USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_IN)), EP_INFO("ep7out-bulk", USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_OUT)), +/* EP_INFO("ep8in-iso", USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_IN)), EP_INFO("ep9out-iso", USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_OUT)), +*/ EP_INFO("ep10in-int", USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, USB_EP_CAPS_DIR_IN)), EP_INFO("ep11in-bulk", USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_IN)), EP_INFO("ep12out-bulk", USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_OUT)), +/* EP_INFO("ep13in-iso", USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_IN)), EP_INFO("ep14out-iso", USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_OUT)), +*/ EP_INFO("ep15in-int", USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, USB_EP_CAPS_DIR_IN)), + /* or like sa1100: two fixed function endpoints */ EP_INFO("ep1out-bulk", USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_OUT)), EP_INFO("ep2in-bulk", USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_IN)), + /* and now some generic EPs so we have enough in multi config */ EP_INFO("ep3out", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_OUT)), + USB_EP_CAPS(TYPE_BULK_OR_INT, USB_EP_CAPS_DIR_OUT)), EP_INFO("ep4in", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_IN)), + USB_EP_CAPS(TYPE_BULK_OR_INT, USB_EP_CAPS_DIR_IN)), EP_INFO("ep5out", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_OUT)), + USB_EP_CAPS(TYPE_BULK_OR_INT, USB_EP_CAPS_DIR_OUT)), EP_INFO("ep6out", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_OUT)), + USB_EP_CAPS(TYPE_BULK_OR_INT, USB_EP_CAPS_DIR_OUT)), EP_INFO("ep7in", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_IN)), + USB_EP_CAPS(TYPE_BULK_OR_INT, USB_EP_CAPS_DIR_IN)), EP_INFO("ep8out", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_OUT)), + USB_EP_CAPS(TYPE_BULK_OR_INT, USB_EP_CAPS_DIR_OUT)), EP_INFO("ep9in", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_IN)), + USB_EP_CAPS(TYPE_BULK_OR_INT, USB_EP_CAPS_DIR_IN)), EP_INFO("ep10out", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_OUT)), + USB_EP_CAPS(TYPE_BULK_OR_INT, USB_EP_CAPS_DIR_OUT)), EP_INFO("ep11out", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_OUT)), + USB_EP_CAPS(TYPE_BULK_OR_INT, USB_EP_CAPS_DIR_OUT)), EP_INFO("ep12in", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_IN)), + USB_EP_CAPS(TYPE_BULK_OR_INT, USB_EP_CAPS_DIR_IN)), EP_INFO("ep13out", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_OUT)), + USB_EP_CAPS(TYPE_BULK_OR_INT, USB_EP_CAPS_DIR_OUT)), EP_INFO("ep14in", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_IN)), + USB_EP_CAPS(TYPE_BULK_OR_INT, USB_EP_CAPS_DIR_IN)), EP_INFO("ep15out", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_OUT)), + USB_EP_CAPS(TYPE_BULK_OR_INT, USB_EP_CAPS_DIR_OUT)), #undef EP_INFO }; @@ -556,10 +565,12 @@ static int dummy_enable(struct usb_ep *_ep, if (max <= 1024) break; /* save a return statement */ + /* fall through */ case USB_SPEED_FULL: if (max <= 64) break; /* save a return statement */ + /* fall through */ default: if (max <= 8) break; @@ -577,6 +588,7 @@ static int dummy_enable(struct usb_ep *_ep, if (max <= 1024) break; /* save a return statement */ + /* fall through */ case USB_SPEED_FULL: if (max <= 1023) break; @@ -1769,6 +1781,7 @@ static void dummy_timer(unsigned long _dum_hcd) int i; /* simplistic model for one frame's bandwidth */ + /* FIXME: account for transaction and packet overhead */ switch (dum->gadget.speed) { case USB_SPEED_LOW: total = 8/*bytes*/ * 12/*packets*/; @@ -1813,7 +1826,6 @@ restart: struct dummy_request *req; u8 address; struct dummy_ep *ep = NULL; - int type; int status = -EINPROGRESS; /* stop when we reach URBs queued after the timer interrupt */ @@ -1825,14 +1837,10 @@ restart: goto return_urb; else if (dum_hcd->rh_state != DUMMY_RH_RUNNING) continue; - type = usb_pipetype(urb->pipe); - /* used up this frame's non-periodic bandwidth? - * FIXME there's infinite bandwidth for control and - * periodic transfers ... unrealistic. - */ - if (total <= 0 && type == PIPE_BULK) - continue; + /* Used up this frame's bandwidth? */ + if (total <= 0) + break; /* find the gadget's ep for this request (if configured) */ address = usb_pipeendpoint (urb->pipe); @@ -1930,13 +1938,17 @@ restart: limit = total; switch (usb_pipetype(urb->pipe)) { case PIPE_ISOCHRONOUS: - /* FIXME is it urb->interval since the last xfer? - * use urb->iso_frame_desc[i]. - * complete whether or not ep has requests queued. - * report random errors, to debug drivers. + /* + * We don't support isochronous. But if we did, + * here are some of the issues we'd have to face: + * + * Is it urb->interval since the last xfer? + * Use urb->iso_frame_desc[i]. + * Complete whether or not ep has requests queued. + * Report random errors, to debug drivers. */ limit = max(limit, periodic_bytes(dum, ep)); - status = -ENOSYS; + status = -EINVAL; /* fail all xfers */ break; case PIPE_INTERRUPT: @@ -2433,9 +2445,7 @@ static DEVICE_ATTR_RO(urbs); static int dummy_start_ss(struct dummy_hcd *dum_hcd) { - init_timer(&dum_hcd->timer); - dum_hcd->timer.function = dummy_timer; - dum_hcd->timer.data = (unsigned long)dum_hcd; + setup_timer(&dum_hcd->timer, dummy_timer, (unsigned long)dum_hcd); dum_hcd->rh_state = DUMMY_RH_RUNNING; dum_hcd->stream_en_ep = 0; INIT_LIST_HEAD(&dum_hcd->urbp_list); @@ -2464,9 +2474,7 @@ static int dummy_start(struct usb_hcd *hcd) return dummy_start_ss(dum_hcd); spin_lock_init(&dum_hcd->dum->lock); - init_timer(&dum_hcd->timer); - dum_hcd->timer.function = dummy_timer; - dum_hcd->timer.data = (unsigned long)dum_hcd; + setup_timer(&dum_hcd->timer, dummy_timer, (unsigned long)dum_hcd); dum_hcd->rh_state = DUMMY_RH_RUNNING; INIT_LIST_HEAD(&dum_hcd->urbp_list); diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c index 78d0204e3e20..53a48f561458 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * FOTG210 UDC Driver supports Bulk transfer so far * * Copyright (C) 2013 Faraday Technology Corporation * * Author : Yuan-Hsin Chen <yhchen@faraday-tech.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. */ #include <linux/dma-mapping.h> diff --git a/drivers/usb/gadget/udc/fotg210.h b/drivers/usb/gadget/udc/fotg210.h index bbf991bcbe7c..08c32957503b 100644 --- a/drivers/usb/gadget/udc/fotg210.h +++ b/drivers/usb/gadget/udc/fotg210.h @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Faraday FOTG210 USB OTG controller * * Copyright (C) 2013 Faraday Technology Corporation * Author: Yuan-Hsin Chen <yhchen@faraday-tech.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/kernel.h> diff --git a/drivers/usb/gadget/udc/fsl_mxc_udc.c b/drivers/usb/gadget/udc/fsl_mxc_udc.c index f16e149c5b3e..f29cf5c6160c 100644 --- a/drivers/usb/gadget/udc/fsl_mxc_udc.c +++ b/drivers/usb/gadget/udc/fsl_mxc_udc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2009 * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de> @@ -5,11 +6,6 @@ * Description: * Helper routines for i.MX3x SoCs from Freescale, needed by the fsl_usb2_udc.c * driver to function correctly on these systems. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. */ #include <linux/clk.h> #include <linux/delay.h> diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c index a3e72d690eef..2707be628298 100644 --- a/drivers/usb/gadget/udc/fsl_qe_udc.c +++ b/drivers/usb/gadget/udc/fsl_qe_udc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * driver/usb/gadget/fsl_qe_udc.c * @@ -11,11 +12,6 @@ * Freescle QE/CPM USB Pheripheral Controller Driver * The controller can be found on MPC8360, MPC8272, and etc. * MPC8360 Rev 1.1 may need QE mircocode update - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. */ #undef USB_TRACE diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.h b/drivers/usb/gadget/udc/fsl_qe_udc.h index 7026919fc901..2c537a904ee7 100644 --- a/drivers/usb/gadget/udc/fsl_qe_udc.h +++ b/drivers/usb/gadget/udc/fsl_qe_udc.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * drivers/usb/gadget/qe_udc.h * @@ -8,11 +9,6 @@ * * Description: * Freescale USB device/endpoint management registers - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. */ #ifndef __FSL_QE_UDC_H diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c index 6f2f71c054be..d606d4f13098 100644 --- a/drivers/usb/gadget/udc/fsl_udc_core.c +++ b/drivers/usb/gadget/udc/fsl_udc_core.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2004-2007,2011-2012 Freescale Semiconductor, Inc. * All rights reserved. @@ -10,11 +11,6 @@ * This can be found on MPC8349E/MPC8313E/MPC5121E cpus. * The driver is previously named as mpc_udc. Based on bare board * code from Dave Liu and Shlomi Gridish. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. */ #undef VERBOSE diff --git a/drivers/usb/gadget/udc/fsl_usb2_udc.h b/drivers/usb/gadget/udc/fsl_usb2_udc.h index e92b8408b6f6..4ba651ae9048 100644 --- a/drivers/usb/gadget/udc/fsl_usb2_udc.h +++ b/drivers/usb/gadget/udc/fsl_usb2_udc.h @@ -1,12 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2004,2012 Freescale Semiconductor, Inc * All rights reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * * Freescale USB device/endpoint management registers */ #ifndef __FSL_USB2_UDC_H diff --git a/drivers/usb/gadget/udc/fusb300_udc.c b/drivers/usb/gadget/udc/fusb300_udc.c index e0c1b0099265..263804d154a7 100644 --- a/drivers/usb/gadget/udc/fusb300_udc.c +++ b/drivers/usb/gadget/udc/fusb300_udc.c @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Fusb300 UDC (USB gadget) * * Copyright (C) 2010 Faraday Technology Corp. * * Author : Yuan-hsin Chen <yhchen@faraday-tech.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. */ #include <linux/dma-mapping.h> #include <linux/err.h> diff --git a/drivers/usb/gadget/udc/fusb300_udc.h b/drivers/usb/gadget/udc/fusb300_udc.h index ad39f892d200..eb3d6d379ba7 100644 --- a/drivers/usb/gadget/udc/fusb300_udc.h +++ b/drivers/usb/gadget/udc/fusb300_udc.h @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Fusb300 UDC (USB gadget) * * Copyright (C) 2010 Faraday Technology Corp. * * Author : Yuan-hsin Chen <yhchen@faraday-tech.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. */ diff --git a/drivers/usb/gadget/udc/goku_udc.c b/drivers/usb/gadget/udc/goku_udc.c index 8433c22900dc..4504d0b202db 100644 --- a/drivers/usb/gadget/udc/goku_udc.c +++ b/drivers/usb/gadget/udc/goku_udc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Toshiba TC86C001 ("Goku-S") USB Device Controller driver * @@ -5,10 +6,6 @@ * by Stuart Lynne, Tom Rushworth, and Bruce Balden * Copyright (C) 2002 Toshiba Corporation * Copyright (C) 2003 MontaVista Software (source@mvista.com) - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. */ /* @@ -127,11 +124,15 @@ goku_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) mode = 0; max = get_unaligned_le16(&desc->wMaxPacketSize); switch (max) { - case 64: mode++; - case 32: mode++; - case 16: mode++; - case 8: mode <<= 3; - break; + case 64: + mode++; /* fall through */ + case 32: + mode++; /* fall through */ + case 16: + mode++; /* fall through */ + case 8: + mode <<= 3; + break; default: return -EINVAL; } diff --git a/drivers/usb/gadget/udc/goku_udc.h b/drivers/usb/gadget/udc/goku_udc.h index 86d2adafe149..26601bf4e7a9 100644 --- a/drivers/usb/gadget/udc/goku_udc.h +++ b/drivers/usb/gadget/udc/goku_udc.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Toshiba TC86C001 ("Goku-S") USB Device Controller driver * @@ -5,10 +6,6 @@ * by Stuart Lynne, Tom Rushworth, and Bruce Balden * Copyright (C) 2002 Toshiba Corporation * Copyright (C) 2003 MontaVista Software (source@mvista.com) - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. */ /* diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c index 0b59fa50aa30..b3fb1bbdb854 100644 --- a/drivers/usb/gadget/udc/gr_udc.c +++ b/drivers/usb/gadget/udc/gr_udc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * USB Peripheral Controller driver for Aeroflex Gaisler GRUSBDC. * @@ -9,11 +10,6 @@ * Full documentation of the GRUSBDC core can be found here: * http://www.gaisler.com/products/grlib/grip.pdf * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * * Contributors: * - Andreas Larsson <andreas@gaisler.com> * - Marko Isomaki @@ -1538,7 +1534,7 @@ static int gr_ep_enable(struct usb_ep *_ep, * Bits 10-0 set the max payload. 12-11 set the number of * additional transactions. */ - max = 0x7ff & usb_endpoint_maxp(desc); + max = usb_endpoint_maxp(desc); nt = usb_endpoint_maxp_mult(desc) - 1; buffer_size = GR_BUFFER_SIZE(epctrl); if (nt && (mode == 0 || mode == 2)) { diff --git a/drivers/usb/gadget/udc/gr_udc.h b/drivers/usb/gadget/udc/gr_udc.h index 4297c4e8021f..3e913268c8c5 100644 --- a/drivers/usb/gadget/udc/gr_udc.h +++ b/drivers/usb/gadget/udc/gr_udc.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * USB Peripheral Controller driver for Aeroflex Gaisler GRUSBDC. * @@ -9,11 +10,6 @@ * Full documentation of the GRUSBDC core can be found here: * http://www.gaisler.com/products/grlib/grip.pdf * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * * Contributors: * - Andreas Larsson <andreas@gaisler.com> * - Marko Isomaki diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c index 8f32b5ee7734..b0781771704e 100644 --- a/drivers/usb/gadget/udc/lpc32xx_udc.c +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * USB Gadget driver for LPC32xx * @@ -12,20 +13,6 @@ * * Note: This driver is based on original work done by Mike James for * the LPC3180. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * 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 */ #include <linux/clk.h> diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c index 46ce7bc15f2b..f19e6282a688 100644 --- a/drivers/usb/gadget/udc/m66592-udc.c +++ b/drivers/usb/gadget/udc/m66592-udc.c @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * M66592 UDC (USB gadget) * * Copyright (C) 2006-2007 Renesas Solutions Corp. * * Author : Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. */ #include <linux/module.h> @@ -1592,9 +1589,7 @@ static int m66592_probe(struct platform_device *pdev) m66592->gadget.max_speed = USB_SPEED_HIGH; m66592->gadget.name = udc_name; - init_timer(&m66592->timer); - m66592->timer.function = m66592_timer; - m66592->timer.data = (unsigned long)m66592; + setup_timer(&m66592->timer, m66592_timer, (unsigned long)m66592); m66592->reg = reg; ret = request_irq(ires->start, m66592_irq, IRQF_SHARED, diff --git a/drivers/usb/gadget/udc/m66592-udc.h b/drivers/usb/gadget/udc/m66592-udc.h index 96d49d7bfb6b..01a64685b8a3 100644 --- a/drivers/usb/gadget/udc/m66592-udc.h +++ b/drivers/usb/gadget/udc/m66592-udc.h @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * M66592 UDC (USB gadget) * * Copyright (C) 2006-2007 Renesas Solutions Corp. * * Author : Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. */ #ifndef __M66592_UDC_H__ diff --git a/drivers/usb/gadget/udc/mv_u3d.h b/drivers/usb/gadget/udc/mv_u3d.h index e32a787ac373..982625b7197a 100644 --- a/drivers/usb/gadget/udc/mv_u3d.h +++ b/drivers/usb/gadget/udc/mv_u3d.h @@ -1,9 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2011 Marvell International Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. */ #ifndef __MV_U3D_H diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/udc/mv_u3d_core.c index 772049afe166..35e02a8d0091 100644 --- a/drivers/usb/gadget/udc/mv_u3d_core.c +++ b/drivers/usb/gadget/udc/mv_u3d_core.c @@ -1,9 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2011 Marvell International Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. */ #include <linux/module.h> diff --git a/drivers/usb/gadget/udc/mv_udc.h b/drivers/usb/gadget/udc/mv_udc.h index be77f207dbaf..b3f759c0962c 100644 --- a/drivers/usb/gadget/udc/mv_udc.h +++ b/drivers/usb/gadget/udc/mv_udc.h @@ -1,10 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2011 Marvell International Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. */ #ifndef __MV_UDC_H diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c index 4103bf7cf52a..95f52232493b 100644 --- a/drivers/usb/gadget/udc/mv_udc_core.c +++ b/drivers/usb/gadget/udc/mv_udc_core.c @@ -1,12 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2011 Marvell International Ltd. All rights reserved. * Author: Chao Xie <chao.xie@marvell.com> * Neil Zhang <zhangwm@marvell.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. */ #include <linux/module.h> diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c index 8f85a51bd2b3..660878a19505 100644 --- a/drivers/usb/gadget/udc/net2272.c +++ b/drivers/usb/gadget/udc/net2272.c @@ -1,22 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Driver for PLX NET2272 USB device controller * * Copyright (C) 2005-2006 PLX Technology, Inc. * Copyright (C) 2006-2011 Analog Devices, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * 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 */ #include <linux/delay.h> diff --git a/drivers/usb/gadget/udc/net2272.h b/drivers/usb/gadget/udc/net2272.h index 69bc9c3c6ce4..8e644627992d 100644 --- a/drivers/usb/gadget/udc/net2272.h +++ b/drivers/usb/gadget/udc/net2272.h @@ -1,22 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * PLX NET2272 high/full speed USB device controller * * Copyright (C) 2005-2006 PLX Technology, Inc. * Copyright (C) 2006-2011 Analog Devices, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * 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 */ #ifndef __NET2272_H__ diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c index f608c1f85e61..318246d8b2e2 100644 --- a/drivers/usb/gadget/udc/net2280.c +++ b/drivers/usb/gadget/udc/net2280.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Driver for the PLX NET2280 USB device controller. * Specs and errata are available from <http://www.plxtech.com>. @@ -31,11 +32,6 @@ * * Modified Ricardo Ribalda Qtechnology AS to provide compatibility * with usb 338x chip. Based on PLX driver - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/module.h> diff --git a/drivers/usb/gadget/udc/net2280.h b/drivers/usb/gadget/udc/net2280.h index 1088c3745999..b65a797544d7 100644 --- a/drivers/usb/gadget/udc/net2280.h +++ b/drivers/usb/gadget/udc/net2280.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * NetChip 2280 high/full speed USB device controller. * Unlike many such controllers, this one talks PCI. @@ -7,11 +8,6 @@ * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com) * Copyright (C) 2003 David Brownell * Copyright (C) 2014 Ricardo Ribalda - Qtechnology/AS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/usb/net2280.h> diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c index f05ba6825bfe..fc7f810baef7 100644 --- a/drivers/usb/gadget/udc/omap_udc.c +++ b/drivers/usb/gadget/udc/omap_udc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * omap_udc.c -- for OMAP full speed udc; most chips support OTG. * @@ -5,11 +6,6 @@ * Copyright (C) 2004-2005 David Brownell * * OMAP2 & DMA support by Kyungmin Park <kyungmin.park@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #undef DEBUG diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c index 84dcbcd756f0..afaea11ec771 100644 --- a/drivers/usb/gadget/udc/pch_udc.c +++ b/drivers/usb/gadget/udc/pch_udc.c @@ -1,9 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2011 LAPIS Semiconductor Co., Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/kernel.h> diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c index a238da906115..8f135d9fa245 100644 --- a/drivers/usb/gadget/udc/pxa25x_udc.c +++ b/drivers/usb/gadget/udc/pxa25x_udc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Intel PXA25x and IXP4xx on-chip full speed USB device controllers * @@ -6,11 +7,6 @@ * Copyright (C) 2003 Benedikt Spranger, Pengutronix * Copyright (C) 2003 David Brownell * Copyright (C) 2003 Joshua Wise - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* #define VERBOSE_DEBUG */ @@ -2417,9 +2413,7 @@ static int pxa25x_udc_probe(struct platform_device *pdev) gpio_direction_output(dev->mach->gpio_pullup, 0); } - init_timer(&dev->timer); - dev->timer.function = udc_watchdog; - dev->timer.data = (unsigned long) dev; + setup_timer(&dev->timer, udc_watchdog, (unsigned long)dev); the_controller = dev; platform_set_drvdata(pdev, dev); diff --git a/drivers/usb/gadget/udc/pxa25x_udc.h b/drivers/usb/gadget/udc/pxa25x_udc.h index a458bec2536d..ccc6b921f067 100644 --- a/drivers/usb/gadget/udc/pxa25x_udc.h +++ b/drivers/usb/gadget/udc/pxa25x_udc.h @@ -1,14 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Intel PXA25x on-chip full speed USB device controller * * Copyright (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix * Copyright (C) 2003 David Brownell - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #ifndef __LINUX_USB_GADGET_PXA25X_H diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c index d48e239660c3..be2761f1b3f5 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Handles the Intel 27x USB Device Controller (UDC) * * Inspired by original driver by Frank Becker, David Brownell, and others. * Copyright (C) 2008 Robert Jarzmik - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/usb/gadget/udc/pxa27x_udc.h b/drivers/usb/gadget/udc/pxa27x_udc.h index cea2cb79b30c..1128d39a4255 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.h +++ b/drivers/usb/gadget/udc/pxa27x_udc.h @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * linux/drivers/usb/gadget/pxa27x_udc.h * Intel PXA27x on-chip full speed USB device controller * * Inspired by original driver by Frank Becker, David Brownell, and others. * Copyright (C) 2008 Robert Jarzmik - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #ifndef __LINUX_USB_GADGET_PXA27X_H diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c index 118ad70f1af0..143122ed3c66 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * R8A66597 UDC (USB gadget) * * Copyright (C) 2006-2009 Renesas Solutions Corp. * * Author : Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. */ #include <linux/module.h> @@ -1877,9 +1874,7 @@ static int r8a66597_probe(struct platform_device *pdev) r8a66597->gadget.max_speed = USB_SPEED_HIGH; r8a66597->gadget.name = udc_name; - init_timer(&r8a66597->timer); - r8a66597->timer.function = r8a66597_timer; - r8a66597->timer.data = (unsigned long)r8a66597; + setup_timer(&r8a66597->timer, r8a66597_timer, (unsigned long)r8a66597); r8a66597->reg = reg; if (r8a66597->pdata->on_chip) { diff --git a/drivers/usb/gadget/udc/r8a66597-udc.h b/drivers/usb/gadget/udc/r8a66597-udc.h index 45c4b2df1785..9a115caba661 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.h +++ b/drivers/usb/gadget/udc/r8a66597-udc.h @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * R8A66597 UDC * * Copyright (C) 2007-2009 Renesas Solutions Corp. * * Author : Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. */ #ifndef __R8A66597_H__ diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c index 63a206122058..bc37f40baacf 100644 --- a/drivers/usb/gadget/udc/renesas_usb3.c +++ b/drivers/usb/gadget/udc/renesas_usb3.c @@ -1,22 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Renesas USB3.0 Peripheral driver (USB gadget) * - * Copyright (C) 2015 Renesas Electronics Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * Copyright (C) 2015-2017 Renesas Electronics Corporation */ #include <linux/debugfs.h> #include <linux/delay.h> #include <linux/dma-mapping.h> #include <linux/err.h> -#include <linux/extcon.h> +#include <linux/extcon-provider.h> #include <linux/interrupt.h> #include <linux/io.h> #include <linux/module.h> #include <linux/of_device.h> +#include <linux/phy/phy.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/sizes.h> @@ -334,6 +332,7 @@ struct renesas_usb3 { struct usb_gadget_driver *driver; struct extcon_dev *extcon; struct work_struct extcon_work; + struct phy *phy; struct renesas_usb3_ep *usb3_ep; int num_usb3_eps; @@ -2056,7 +2055,7 @@ static u32 usb3_calc_rammap_val(struct renesas_usb3_ep *usb3_ep, const struct usb_endpoint_descriptor *desc) { int i; - const u32 max_packet_array[] = {8, 16, 32, 64, 512}; + static const u32 max_packet_array[] = {8, 16, 32, 64, 512}; u32 mpkt = PN_RAMMAP_MPKT(1024); for (i = 0; i < ARRAY_SIZE(max_packet_array); i++) { @@ -2239,7 +2238,9 @@ static int renesas_usb3_start(struct usb_gadget *gadget, /* hook up the driver */ usb3->driver = driver; - pm_runtime_enable(usb3_to_dev(usb3)); + if (usb3->phy) + phy_init(usb3->phy); + pm_runtime_get_sync(usb3_to_dev(usb3)); renesas_usb3_init_controller(usb3); @@ -2256,8 +2257,10 @@ static int renesas_usb3_stop(struct usb_gadget *gadget) usb3->driver = NULL; renesas_usb3_stop_controller(usb3); + if (usb3->phy) + phy_exit(usb3->phy); + pm_runtime_put(usb3_to_dev(usb3)); - pm_runtime_disable(usb3_to_dev(usb3)); return 0; } @@ -2405,6 +2408,9 @@ static int renesas_usb3_remove(struct platform_device *pdev) renesas_usb3_dma_free_prd(usb3, &pdev->dev); __renesas_usb3_ep_free_request(usb3->ep0_req); + if (usb3->phy) + phy_put(usb3->phy); + pm_runtime_disable(usb3_to_dev(usb3)); return 0; } @@ -2560,20 +2566,15 @@ static int renesas_usb3_probe(struct platform_device *pdev) { struct renesas_usb3 *usb3; struct resource *res; - const struct of_device_id *match; int irq, ret; const struct renesas_usb3_priv *priv; const struct soc_device_attribute *attr; - match = of_match_node(usb3_of_match, pdev->dev.of_node); - if (!match) - return -ENODEV; - attr = soc_device_match(renesas_usb3_quirks_match); if (attr) priv = attr->data; else - priv = match->data; + priv = of_device_get_match_data(&pdev->dev); irq = platform_get_irq(pdev, 0); if (irq < 0) { @@ -2635,11 +2636,20 @@ static int renesas_usb3_probe(struct platform_device *pdev) if (ret < 0) goto err_dev_create; + /* + * This is an optional. So, if this driver cannot get a phy, + * this driver will not handle a phy anymore. + */ + usb3->phy = devm_phy_get(&pdev->dev, "usb"); + if (IS_ERR(usb3->phy)) + usb3->phy = NULL; + usb3->workaround_for_vbus = priv->workaround_for_vbus; renesas_usb3_debugfs_init(usb3, &pdev->dev); - dev_info(&pdev->dev, "probed\n"); + dev_info(&pdev->dev, "probed%s\n", usb3->phy ? " with phy" : ""); + pm_runtime_enable(usb3_to_dev(usb3)); return 0; @@ -2655,11 +2665,49 @@ err_alloc_prd: return ret; } +#ifdef CONFIG_PM_SLEEP +static int renesas_usb3_suspend(struct device *dev) +{ + struct renesas_usb3 *usb3 = dev_get_drvdata(dev); + + /* Not started */ + if (!usb3->driver) + return 0; + + renesas_usb3_stop_controller(usb3); + if (usb3->phy) + phy_exit(usb3->phy); + pm_runtime_put(dev); + + return 0; +} + +static int renesas_usb3_resume(struct device *dev) +{ + struct renesas_usb3 *usb3 = dev_get_drvdata(dev); + + /* Not started */ + if (!usb3->driver) + return 0; + + if (usb3->phy) + phy_init(usb3->phy); + pm_runtime_get_sync(dev); + renesas_usb3_init_controller(usb3); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(renesas_usb3_pm_ops, renesas_usb3_suspend, + renesas_usb3_resume); + static struct platform_driver renesas_usb3_driver = { .probe = renesas_usb3_probe, .remove = renesas_usb3_remove, .driver = { .name = (char *)udc_name, + .pm = &renesas_usb3_pm_ops, .of_match_table = of_match_ptr(usb3_of_match), }, }; diff --git a/drivers/usb/gadget/udc/s3c-hsudc.c b/drivers/usb/gadget/udc/s3c-hsudc.c index 42587b738a1f..31c7c5587cf9 100644 --- a/drivers/usb/gadget/udc/s3c-hsudc.c +++ b/drivers/usb/gadget/udc/s3c-hsudc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* linux/drivers/usb/gadget/s3c-hsudc.c * * Copyright (c) 2010 Samsung Electronics Co., Ltd. @@ -8,11 +9,7 @@ * The S3C24XX USB 2.0 high-speed USB controller supports upto 9 endpoints. * Each endpoint can be configured as either in or out endpoint. Endpoints * can be configured for Bulk or Interrupt transfer mode. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. -*/ + */ #include <linux/kernel.h> #include <linux/module.h> diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c index 394abd5d65c0..f154f49e98c8 100644 --- a/drivers/usb/gadget/udc/s3c2410_udc.c +++ b/drivers/usb/gadget/udc/s3c2410_udc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * linux/drivers/usb/gadget/s3c2410_udc.c * @@ -5,11 +6,6 @@ * * Copyright (C) 2004-2007 Herbert Pötzl - Arnaud Patard * Additional cleanups by Ben Dooks <ben-linux@fluff.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #define pr_fmt(fmt) "s3c2410_udc: " fmt diff --git a/drivers/usb/gadget/udc/s3c2410_udc.h b/drivers/usb/gadget/udc/s3c2410_udc.h index 93bf225f1969..bdcaa8dd300f 100644 --- a/drivers/usb/gadget/udc/s3c2410_udc.h +++ b/drivers/usb/gadget/udc/s3c2410_udc.h @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * linux/drivers/usb/gadget/s3c2410_udc.h * Samsung on-chip full speed USB device controllers * * Copyright (C) 2004-2007 Herbert Pötzl - Arnaud Patard * Additional cleanups by Ben Dooks <ben-linux@fluff.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #ifndef _S3C2410_UDC_H diff --git a/drivers/usb/gadget/udc/snps_udc_core.c b/drivers/usb/gadget/udc/snps_udc_core.c index 38a165dbf924..d4da47f4f6f4 100644 --- a/drivers/usb/gadget/udc/snps_udc_core.c +++ b/drivers/usb/gadget/udc/snps_udc_core.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * amd5536.c -- AMD 5536 UDC high/full speed USB device controller * * Copyright (C) 2005-2007 AMD (http://www.amd.com) * Author: Thomas Dahlmann - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ /* @@ -1733,7 +1729,7 @@ static void udc_soft_reset(struct udc *dev) } /* RDE timer callback to set RDE bit */ -static void udc_timer_function(unsigned long v) +static void udc_timer_function(struct timer_list *unused) { u32 tmp; @@ -1813,7 +1809,7 @@ static void udc_handle_halt_state(struct udc_ep *ep) } /* Stall timer callback to poll S bit and set it again after */ -static void udc_pollstall_timer_function(unsigned long v) +static void udc_pollstall_timer_function(struct timer_list *unused) { struct udc_ep *ep; int halted = 0; @@ -3067,14 +3063,12 @@ void udc_remove(struct udc *dev) stop_timer++; if (timer_pending(&udc_timer)) wait_for_completion(&on_exit); - if (udc_timer.data) - del_timer_sync(&udc_timer); + del_timer_sync(&udc_timer); /* remove pollstall timer */ stop_pollstall_timer++; if (timer_pending(&udc_pollstall_timer)) wait_for_completion(&on_pollstall_exit); - if (udc_pollstall_timer.data) - del_timer_sync(&udc_pollstall_timer); + del_timer_sync(&udc_pollstall_timer); udc = NULL; } EXPORT_SYMBOL_GPL(udc_remove); @@ -3164,10 +3158,6 @@ int udc_probe(struct udc *dev) u32 reg; int retval; - /* mark timer as not initialized */ - udc_timer.data = 0; - udc_pollstall_timer.data = 0; - /* device struct setup */ dev->gadget.ops = &udc_ops; @@ -3207,13 +3197,8 @@ int udc_probe(struct udc *dev) goto finished; /* timer init */ - init_timer(&udc_timer); - udc_timer.function = udc_timer_function; - udc_timer.data = 1; - /* timer pollstall init */ - init_timer(&udc_pollstall_timer); - udc_pollstall_timer.function = udc_pollstall_timer_function; - udc_pollstall_timer.data = 1; + timer_setup(&udc_timer, udc_timer_function, 0); + timer_setup(&udc_pollstall_timer, udc_pollstall_timer_function, 0); /* set SD */ reg = readl(&dev->regs->ctl); diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c b/drivers/usb/gadget/udc/snps_udc_plat.c index e8a5fdaee37d..32f1d3e90c26 100644 --- a/drivers/usb/gadget/udc/snps_udc_plat.c +++ b/drivers/usb/gadget/udc/snps_udc_plat.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * snps_udc_plat.c - Synopsys UDC Platform Driver * * Copyright (C) 2016 Broadcom - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation version 2. - * - * This program is distributed "as is" WITHOUT ANY WARRANTY of any - * kind, whether express or implied; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. */ #include <linux/extcon.h> diff --git a/drivers/usb/gadget/udc/trace.c b/drivers/usb/gadget/udc/trace.c index 8c551ab91ad8..7430624c0bd7 100644 --- a/drivers/usb/gadget/udc/trace.c +++ b/drivers/usb/gadget/udc/trace.c @@ -1,17 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 /** * trace.c - USB Gadget Framework Trace Support * * Copyright (C) 2016 Intel Corporation * Author: Felipe Balbi <felipe.balbi@linux.intel.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 of - * the 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. */ #define CREATE_TRACE_POINTS diff --git a/drivers/usb/gadget/udc/trace.h b/drivers/usb/gadget/udc/trace.h index da29874b5366..f07ddb3f4bb9 100644 --- a/drivers/usb/gadget/udc/trace.h +++ b/drivers/usb/gadget/udc/trace.h @@ -1,20 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 /** * udc.c - Core UDC Framework * * Copyright (C) 2016 Intel Corporation * Author: Felipe Balbi <felipe.balbi@linux.intel.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 of - * the 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #undef TRACE_SYSTEM diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c index de207a90571e..7da2b9ce8cb3 100644 --- a/drivers/usb/gadget/udc/udc-xilinx.c +++ b/drivers/usb/gadget/udc/udc-xilinx.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Xilinx USB peripheral controller driver * @@ -8,12 +9,6 @@ * * Some parts of this driver code is based on the driver for at91-series * USB peripheral controller (at91_udc.c). - * - * This program is free software; you can redistribute it - * and/or modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; - * either version 2 of the License, or (at your option) any - * later version. */ #include <linux/delay.h> diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c index 73a4dfba0edb..566ab261e8b7 100644 --- a/drivers/usb/gadget/usbstring.c +++ b/drivers/usb/gadget/usbstring.c @@ -1,10 +1,6 @@ +// SPDX-License-Identifier: LGPL-2.1+ /* * Copyright (C) 2003 David Brownell - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. */ #include <linux/errno.h> |