| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | |
|---|
| 2 | 3 | /* |
|---|
| 3 | 4 | * Hauppauge HD PVR USB driver |
|---|
| .. | .. |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * IR device registration code is |
|---|
| 8 | 9 | * Copyright (C) 2010 Andy Walls <awalls@md.metrocast.net> |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or |
|---|
| 11 | | - * modify it under the terms of the GNU General Public License as |
|---|
| 12 | | - * published by the Free Software Foundation, version 2. |
|---|
| 13 | | - * |
|---|
| 14 | 10 | */ |
|---|
| 15 | 11 | |
|---|
| 16 | 12 | #if IS_ENABLED(CONFIG_I2C) |
|---|
| .. | .. |
|---|
| 48 | 44 | init_data->polling_interval = 405; /* ms, duplicated from Windows */ |
|---|
| 49 | 45 | info.platform_data = init_data; |
|---|
| 50 | 46 | |
|---|
| 51 | | - return i2c_new_device(&dev->i2c_adapter, &info); |
|---|
| 47 | + return i2c_new_client_device(&dev->i2c_adapter, &info); |
|---|
| 52 | 48 | } |
|---|
| 53 | 49 | |
|---|
| 54 | 50 | static int hdpvr_i2c_read(struct hdpvr_device *dev, int bus, |
|---|
| .. | .. |
|---|
| 61 | 57 | return -EINVAL; |
|---|
| 62 | 58 | |
|---|
| 63 | 59 | if (wlen) { |
|---|
| 64 | | - memcpy(&dev->i2c_buf, wdata, wlen); |
|---|
| 60 | + memcpy(dev->i2c_buf, wdata, wlen); |
|---|
| 65 | 61 | ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), |
|---|
| 66 | 62 | REQTYPE_I2C_WRITE, CTRL_WRITE_REQUEST, |
|---|
| 67 | | - (bus << 8) | addr, 0, &dev->i2c_buf, |
|---|
| 63 | + (bus << 8) | addr, 0, dev->i2c_buf, |
|---|
| 68 | 64 | wlen, 1000); |
|---|
| 69 | 65 | if (ret < 0) |
|---|
| 70 | 66 | return ret; |
|---|
| .. | .. |
|---|
| 72 | 68 | |
|---|
| 73 | 69 | ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), |
|---|
| 74 | 70 | REQTYPE_I2C_READ, CTRL_READ_REQUEST, |
|---|
| 75 | | - (bus << 8) | addr, 0, &dev->i2c_buf, len, 1000); |
|---|
| 71 | + (bus << 8) | addr, 0, dev->i2c_buf, len, 1000); |
|---|
| 76 | 72 | |
|---|
| 77 | 73 | if (ret == len) { |
|---|
| 78 | | - memcpy(data, &dev->i2c_buf, len); |
|---|
| 74 | + memcpy(data, dev->i2c_buf, len); |
|---|
| 79 | 75 | ret = 0; |
|---|
| 80 | 76 | } else if (ret >= 0) |
|---|
| 81 | 77 | ret = -EIO; |
|---|
| .. | .. |
|---|
| 91 | 87 | if (len > sizeof(dev->i2c_buf)) |
|---|
| 92 | 88 | return -EINVAL; |
|---|
| 93 | 89 | |
|---|
| 94 | | - memcpy(&dev->i2c_buf, data, len); |
|---|
| 90 | + memcpy(dev->i2c_buf, data, len); |
|---|
| 95 | 91 | ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), |
|---|
| 96 | 92 | REQTYPE_I2C_WRITE, CTRL_WRITE_REQUEST, |
|---|
| 97 | | - (bus << 8) | addr, 0, &dev->i2c_buf, len, 1000); |
|---|
| 93 | + (bus << 8) | addr, 0, dev->i2c_buf, len, 1000); |
|---|
| 98 | 94 | |
|---|
| 99 | 95 | if (ret < 0) |
|---|
| 100 | 96 | return ret; |
|---|
| 101 | 97 | |
|---|
| 102 | 98 | ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), |
|---|
| 103 | 99 | REQTYPE_I2C_WRITE_STATT, CTRL_READ_REQUEST, |
|---|
| 104 | | - 0, 0, &dev->i2c_buf, 2, 1000); |
|---|
| 100 | + 0, 0, dev->i2c_buf, 2, 1000); |
|---|
| 105 | 101 | |
|---|
| 106 | 102 | if ((ret == 2) && (dev->i2c_buf[1] == (len - 1))) |
|---|
| 107 | 103 | ret = 0; |
|---|
| .. | .. |
|---|
| 197 | 193 | |
|---|
| 198 | 194 | int hdpvr_register_i2c_adapter(struct hdpvr_device *dev) |
|---|
| 199 | 195 | { |
|---|
| 200 | | - int retval = -ENOMEM; |
|---|
| 201 | | - |
|---|
| 202 | 196 | hdpvr_activate_ir(dev); |
|---|
| 203 | 197 | |
|---|
| 204 | 198 | dev->i2c_adapter = hdpvr_i2c_adapter_template; |
|---|
| .. | .. |
|---|
| 206 | 200 | |
|---|
| 207 | 201 | i2c_set_adapdata(&dev->i2c_adapter, dev); |
|---|
| 208 | 202 | |
|---|
| 209 | | - retval = i2c_add_adapter(&dev->i2c_adapter); |
|---|
| 210 | | - |
|---|
| 211 | | - return retval; |
|---|
| 203 | + return i2c_add_adapter(&dev->i2c_adapter); |
|---|
| 212 | 204 | } |
|---|
| 213 | 205 | |
|---|
| 214 | 206 | #endif |
|---|