| .. | .. |
|---|
| 1 | | -// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) |
|---|
| 2 | | -/*- |
|---|
| 1 | +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause) |
|---|
| 2 | +/* |
|---|
| 3 | 3 | * Copyright (c) 2003, 2004 |
|---|
| 4 | 4 | * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. |
|---|
| 5 | 5 | * |
|---|
| 6 | 6 | * Copyright (c) 2005-2007 Matthieu Castet <castet.matthieu@free.fr> |
|---|
| 7 | 7 | * 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 | | - * |
|---|
| 52 | 8 | * |
|---|
| 53 | 9 | * HISTORY : some part of the code was base on ueagle 1.3 BSD driver, |
|---|
| 54 | 10 | * Damien Bergamini agree to put his code under a DUAL GPL/BSD license. |
|---|
| .. | .. |
|---|
| 394 | 350 | u8 string_header[E4_L1_STRING_HEADER]; |
|---|
| 395 | 351 | u8 page_number_to_block_index[E4_MAX_PAGE_NUMBER]; |
|---|
| 396 | 352 | struct block_index page_header[E4_NO_SWAPPAGE_HEADERS]; |
|---|
| 397 | | - u8 code[0]; |
|---|
| 353 | + u8 code[]; |
|---|
| 398 | 354 | } __packed; |
|---|
| 399 | 355 | |
|---|
| 400 | 356 | /* structures describing a block within a DSP page */ |
|---|
| .. | .. |
|---|
| 614 | 570 | #define LOAD_INTERNAL 0xA0 |
|---|
| 615 | 571 | #define F8051_USBCS 0x7f92 |
|---|
| 616 | 572 | |
|---|
| 617 | | -/** |
|---|
| 573 | +/* |
|---|
| 618 | 574 | * uea_send_modem_cmd - Send a command for pre-firmware devices. |
|---|
| 619 | 575 | */ |
|---|
| 620 | 576 | static int uea_send_modem_cmd(struct usb_device *usb, |
|---|
| .. | .. |
|---|
| 716 | 672 | uea_leaves(usb); |
|---|
| 717 | 673 | } |
|---|
| 718 | 674 | |
|---|
| 719 | | -/** |
|---|
| 675 | +/* |
|---|
| 720 | 676 | * uea_load_firmware - Load usb firmware for pre-firmware devices. |
|---|
| 721 | 677 | */ |
|---|
| 722 | 678 | static int uea_load_firmware(struct usb_device *usb, unsigned int ver) |
|---|
| .. | .. |
|---|
| 2508 | 2464 | return ret; |
|---|
| 2509 | 2465 | } |
|---|
| 2510 | 2466 | |
|---|
| 2511 | | -static struct attribute *attrs[] = { |
|---|
| 2467 | +static struct attribute *uea_attrs[] = { |
|---|
| 2512 | 2468 | &dev_attr_stat_status.attr, |
|---|
| 2513 | 2469 | &dev_attr_stat_mflags.attr, |
|---|
| 2514 | 2470 | &dev_attr_stat_human_status.attr, |
|---|
| .. | .. |
|---|
| 2529 | 2485 | &dev_attr_stat_firmid.attr, |
|---|
| 2530 | 2486 | NULL, |
|---|
| 2531 | 2487 | }; |
|---|
| 2532 | | -static const struct attribute_group attr_grp = { |
|---|
| 2533 | | - .attrs = attrs, |
|---|
| 2534 | | -}; |
|---|
| 2488 | +ATTRIBUTE_GROUPS(uea); |
|---|
| 2535 | 2489 | |
|---|
| 2536 | 2490 | static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, |
|---|
| 2537 | 2491 | const struct usb_device_id *id) |
|---|
| .. | .. |
|---|
| 2600 | 2554 | } |
|---|
| 2601 | 2555 | } |
|---|
| 2602 | 2556 | |
|---|
| 2603 | | - ret = sysfs_create_group(&intf->dev.kobj, &attr_grp); |
|---|
| 2557 | + ret = uea_boot(sc, intf); |
|---|
| 2604 | 2558 | if (ret < 0) |
|---|
| 2605 | 2559 | goto error; |
|---|
| 2606 | 2560 | |
|---|
| 2607 | | - ret = uea_boot(sc, intf); |
|---|
| 2608 | | - if (ret < 0) |
|---|
| 2609 | | - goto error_rm_grp; |
|---|
| 2610 | | - |
|---|
| 2611 | 2561 | return 0; |
|---|
| 2612 | 2562 | |
|---|
| 2613 | | -error_rm_grp: |
|---|
| 2614 | | - sysfs_remove_group(&intf->dev.kobj, &attr_grp); |
|---|
| 2615 | 2563 | error: |
|---|
| 2616 | 2564 | kfree(sc); |
|---|
| 2617 | 2565 | return ret; |
|---|
| .. | .. |
|---|
| 2621 | 2569 | { |
|---|
| 2622 | 2570 | struct uea_softc *sc = usbatm->driver_data; |
|---|
| 2623 | 2571 | |
|---|
| 2624 | | - sysfs_remove_group(&intf->dev.kobj, &attr_grp); |
|---|
| 2625 | 2572 | uea_stop(sc); |
|---|
| 2626 | 2573 | kfree(sc); |
|---|
| 2627 | 2574 | } |
|---|
| .. | .. |
|---|
| 2771 | 2718 | .id_table = uea_ids, |
|---|
| 2772 | 2719 | .probe = uea_probe, |
|---|
| 2773 | 2720 | .disconnect = uea_disconnect, |
|---|
| 2721 | + .dev_groups = uea_groups, |
|---|
| 2774 | 2722 | }; |
|---|
| 2775 | 2723 | |
|---|
| 2776 | 2724 | MODULE_DEVICE_TABLE(usb, uea_ids); |
|---|