hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/usb/atm/ueagle-atm.c
....@@ -1,54 +1,10 @@
1
-// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2
-/*-
1
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause)
2
+/*
33 * Copyright (c) 2003, 2004
44 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
55 *
66 * Copyright (c) 2005-2007 Matthieu Castet <castet.matthieu@free.fr>
77 * Copyright (c) 2005-2007 Stanislaw Gruszka <stf_xl@wp.pl>
8
- *
9
- * This software is available to you under a choice of one of two
10
- * licenses. You may choose to be licensed under the terms of the GNU
11
- * General Public License (GPL) Version 2, available from the file
12
- * COPYING in the main directory of this source tree, or the
13
- * BSD license below:
14
- *
15
- * Redistribution and use in source and binary forms, with or without
16
- * modification, are permitted provided that the following conditions
17
- * are met:
18
- * 1. Redistributions of source code must retain the above copyright
19
- * notice unmodified, this list of conditions, and the following
20
- * disclaimer.
21
- * 2. Redistributions in binary form must reproduce the above copyright
22
- * notice, this list of conditions and the following disclaimer in the
23
- * documentation and/or other materials provided with the distribution.
24
- *
25
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
26
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
29
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35
- * SUCH DAMAGE.
36
- *
37
- * GPL license :
38
- * This program is free software; you can redistribute it and/or
39
- * modify it under the terms of the GNU General Public License
40
- * as published by the Free Software Foundation; either version 2
41
- * of the License, or (at your option) any later version.
42
- *
43
- * This program is distributed in the hope that it will be useful,
44
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
45
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46
- * GNU General Public License for more details.
47
- *
48
- * You should have received a copy of the GNU General Public License
49
- * along with this program; if not, write to the Free Software
50
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
51
- *
528 *
539 * HISTORY : some part of the code was base on ueagle 1.3 BSD driver,
5410 * Damien Bergamini agree to put his code under a DUAL GPL/BSD license.
....@@ -394,7 +350,7 @@
394350 u8 string_header[E4_L1_STRING_HEADER];
395351 u8 page_number_to_block_index[E4_MAX_PAGE_NUMBER];
396352 struct block_index page_header[E4_NO_SWAPPAGE_HEADERS];
397
- u8 code[0];
353
+ u8 code[];
398354 } __packed;
399355
400356 /* structures describing a block within a DSP page */
....@@ -614,7 +570,7 @@
614570 #define LOAD_INTERNAL 0xA0
615571 #define F8051_USBCS 0x7f92
616572
617
-/**
573
+/*
618574 * uea_send_modem_cmd - Send a command for pre-firmware devices.
619575 */
620576 static int uea_send_modem_cmd(struct usb_device *usb,
....@@ -716,7 +672,7 @@
716672 uea_leaves(usb);
717673 }
718674
719
-/**
675
+/*
720676 * uea_load_firmware - Load usb firmware for pre-firmware devices.
721677 */
722678 static int uea_load_firmware(struct usb_device *usb, unsigned int ver)
....@@ -2508,7 +2464,7 @@
25082464 return ret;
25092465 }
25102466
2511
-static struct attribute *attrs[] = {
2467
+static struct attribute *uea_attrs[] = {
25122468 &dev_attr_stat_status.attr,
25132469 &dev_attr_stat_mflags.attr,
25142470 &dev_attr_stat_human_status.attr,
....@@ -2529,9 +2485,7 @@
25292485 &dev_attr_stat_firmid.attr,
25302486 NULL,
25312487 };
2532
-static const struct attribute_group attr_grp = {
2533
- .attrs = attrs,
2534
-};
2488
+ATTRIBUTE_GROUPS(uea);
25352489
25362490 static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
25372491 const struct usb_device_id *id)
....@@ -2600,18 +2554,12 @@
26002554 }
26012555 }
26022556
2603
- ret = sysfs_create_group(&intf->dev.kobj, &attr_grp);
2557
+ ret = uea_boot(sc, intf);
26042558 if (ret < 0)
26052559 goto error;
26062560
2607
- ret = uea_boot(sc, intf);
2608
- if (ret < 0)
2609
- goto error_rm_grp;
2610
-
26112561 return 0;
26122562
2613
-error_rm_grp:
2614
- sysfs_remove_group(&intf->dev.kobj, &attr_grp);
26152563 error:
26162564 kfree(sc);
26172565 return ret;
....@@ -2621,7 +2569,6 @@
26212569 {
26222570 struct uea_softc *sc = usbatm->driver_data;
26232571
2624
- sysfs_remove_group(&intf->dev.kobj, &attr_grp);
26252572 uea_stop(sc);
26262573 kfree(sc);
26272574 }
....@@ -2771,6 +2718,7 @@
27712718 .id_table = uea_ids,
27722719 .probe = uea_probe,
27732720 .disconnect = uea_disconnect,
2721
+ .dev_groups = uea_groups,
27742722 };
27752723
27762724 MODULE_DEVICE_TABLE(usb, uea_ids);