| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * E3C EC168 DVB USB driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2009 Antti Palosaari <crope@iki.fi> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | | - * |
|---|
| 16 | 6 | */ |
|---|
| 17 | 7 | |
|---|
| 18 | 8 | #include "ec168.h" |
|---|
| .. | .. |
|---|
| 125 | 115 | while (i < num) { |
|---|
| 126 | 116 | if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) { |
|---|
| 127 | 117 | if (msg[i].addr == ec168_ec100_config.demod_address) { |
|---|
| 118 | + if (msg[i].len < 1) { |
|---|
| 119 | + i = -EOPNOTSUPP; |
|---|
| 120 | + break; |
|---|
| 121 | + } |
|---|
| 128 | 122 | req.cmd = READ_DEMOD; |
|---|
| 129 | 123 | req.value = 0; |
|---|
| 130 | 124 | req.index = 0xff00 + msg[i].buf[0]; /* reg */ |
|---|
| .. | .. |
|---|
| 141 | 135 | } |
|---|
| 142 | 136 | } else { |
|---|
| 143 | 137 | if (msg[i].addr == ec168_ec100_config.demod_address) { |
|---|
| 138 | + if (msg[i].len < 1) { |
|---|
| 139 | + i = -EOPNOTSUPP; |
|---|
| 140 | + break; |
|---|
| 141 | + } |
|---|
| 144 | 142 | req.cmd = WRITE_DEMOD; |
|---|
| 145 | 143 | req.value = msg[i].buf[1]; /* val */ |
|---|
| 146 | 144 | req.index = 0xff00 + msg[i].buf[0]; /* reg */ |
|---|
| .. | .. |
|---|
| 149 | 147 | ret = ec168_ctrl_msg(d, &req); |
|---|
| 150 | 148 | i += 1; |
|---|
| 151 | 149 | } else { |
|---|
| 150 | + if (msg[i].len < 1) { |
|---|
| 151 | + i = -EOPNOTSUPP; |
|---|
| 152 | + break; |
|---|
| 153 | + } |
|---|
| 152 | 154 | req.cmd = WRITE_I2C; |
|---|
| 153 | 155 | req.value = msg[i].buf[0]; /* val */ |
|---|
| 154 | 156 | req.index = 0x0100 + msg[i].addr; /* I2C addr */ |
|---|
| .. | .. |
|---|
| 319 | 321 | /* DVB USB Driver stuff */ |
|---|
| 320 | 322 | /* bInterfaceNumber 0 is HID |
|---|
| 321 | 323 | * bInterfaceNumber 1 is DVB-T */ |
|---|
| 322 | | -static struct dvb_usb_device_properties ec168_props = { |
|---|
| 324 | +static const struct dvb_usb_device_properties ec168_props = { |
|---|
| 323 | 325 | .driver_name = KBUILD_MODNAME, |
|---|
| 324 | 326 | .owner = THIS_MODULE, |
|---|
| 325 | 327 | .adapter_nr = adapter_nr, |
|---|
| .. | .. |
|---|
| 342 | 344 | }, |
|---|
| 343 | 345 | }; |
|---|
| 344 | 346 | |
|---|
| 345 | | -static const struct dvb_usb_driver_info ec168_driver_info = { |
|---|
| 346 | | - .name = "E3C EC168 reference design", |
|---|
| 347 | | - .props = &ec168_props, |
|---|
| 348 | | -}; |
|---|
| 349 | | - |
|---|
| 350 | 347 | static const struct usb_device_id ec168_id[] = { |
|---|
| 351 | | - { USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168), |
|---|
| 352 | | - .driver_info = (kernel_ulong_t) &ec168_driver_info }, |
|---|
| 353 | | - { USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_2), |
|---|
| 354 | | - .driver_info = (kernel_ulong_t) &ec168_driver_info }, |
|---|
| 355 | | - { USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_3), |
|---|
| 356 | | - .driver_info = (kernel_ulong_t) &ec168_driver_info }, |
|---|
| 357 | | - { USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_4), |
|---|
| 358 | | - .driver_info = (kernel_ulong_t) &ec168_driver_info }, |
|---|
| 359 | | - { USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_5), |
|---|
| 360 | | - .driver_info = (kernel_ulong_t) &ec168_driver_info }, |
|---|
| 348 | + { DVB_USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168, |
|---|
| 349 | + &ec168_props, "E3C EC168 reference design", NULL)}, |
|---|
| 350 | + { DVB_USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_2, |
|---|
| 351 | + &ec168_props, "E3C EC168 reference design", NULL)}, |
|---|
| 352 | + { DVB_USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_3, |
|---|
| 353 | + &ec168_props, "E3C EC168 reference design", NULL)}, |
|---|
| 354 | + { DVB_USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_4, |
|---|
| 355 | + &ec168_props, "E3C EC168 reference design", NULL)}, |
|---|
| 356 | + { DVB_USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_5, |
|---|
| 357 | + &ec168_props, "E3C EC168 reference design", NULL)}, |
|---|
| 361 | 358 | {} |
|---|
| 362 | 359 | }; |
|---|
| 363 | 360 | MODULE_DEVICE_TABLE(usb, ec168_id); |
|---|