aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoderick Colenbrander <roderick.colenbrander@sony.com>2016-10-07 15:39:35 -0400
committerJiri Kosina <jkosina@suse.cz>2016-10-10 04:43:24 -0400
commit2c159de05082a70d3b3e75d8e167f4b5ca996405 (patch)
tree37762bb8b2618348658cd538e2d814982d4e9bc4
parente1bc84d0071f59c8b38232e2cb093c47c47e4f9f (diff)
HID: sony: Adjust HID report size name definitions
Put the report type (feature / output) in the report size definitions. This prevents name collisions later on for other different reports, which use the same report id, but have a different size. Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-sony.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index afa82198defb..43bb24cc5fc3 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1019,10 +1019,10 @@ struct motion_output_report_02 {
1019 u8 rumble; 1019 u8 rumble;
1020}; 1020};
1021 1021
1022#define DS4_REPORT_0x02_SIZE 37 1022#define DS4_FEATURE_REPORT_0x02_SIZE 37
1023#define DS4_REPORT_0x05_SIZE 32 1023#define DS4_FEATURE_REPORT_0x81_SIZE 7
1024#define DS4_REPORT_0x11_SIZE 78 1024#define DS4_OUTPUT_REPORT_0x05_SIZE 32
1025#define DS4_REPORT_0x81_SIZE 7 1025#define DS4_OUTPUT_REPORT_0x11_SIZE 78
1026#define SIXAXIS_REPORT_0xF2_SIZE 17 1026#define SIXAXIS_REPORT_0xF2_SIZE 17
1027#define SIXAXIS_REPORT_0xF5_SIZE 8 1027#define SIXAXIS_REPORT_0xF5_SIZE 8
1028#define MOTION_REPORT_0x02_SIZE 49 1028#define MOTION_REPORT_0x02_SIZE 49
@@ -1461,11 +1461,11 @@ static int dualshock4_set_operational_bt(struct hid_device *hdev)
1461 u8 *buf; 1461 u8 *buf;
1462 int ret; 1462 int ret;
1463 1463
1464 buf = kmalloc(DS4_REPORT_0x02_SIZE, GFP_KERNEL); 1464 buf = kmalloc(DS4_FEATURE_REPORT_0x02_SIZE, GFP_KERNEL);
1465 if (!buf) 1465 if (!buf)
1466 return -ENOMEM; 1466 return -ENOMEM;
1467 1467
1468 ret = hid_hw_raw_request(hdev, 0x02, buf, DS4_REPORT_0x02_SIZE, 1468 ret = hid_hw_raw_request(hdev, 0x02, buf, DS4_FEATURE_REPORT_0x02_SIZE,
1469 HID_FEATURE_REPORT, HID_REQ_GET_REPORT); 1469 HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
1470 1470
1471 kfree(buf); 1471 kfree(buf);
@@ -1870,12 +1870,12 @@ static void dualshock4_send_output_report(struct sony_sc *sc)
1870 * 0xD0 - 66hz 1870 * 0xD0 - 66hz
1871 */ 1871 */
1872 if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) { 1872 if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) {
1873 memset(buf, 0, DS4_REPORT_0x05_SIZE); 1873 memset(buf, 0, DS4_OUTPUT_REPORT_0x05_SIZE);
1874 buf[0] = 0x05; 1874 buf[0] = 0x05;
1875 buf[1] = 0xFF; 1875 buf[1] = 0xFF;
1876 offset = 4; 1876 offset = 4;
1877 } else { 1877 } else {
1878 memset(buf, 0, DS4_REPORT_0x11_SIZE); 1878 memset(buf, 0, DS4_OUTPUT_REPORT_0x11_SIZE);
1879 buf[0] = 0x11; 1879 buf[0] = 0x11;
1880 buf[1] = 0x80; 1880 buf[1] = 0x80;
1881 buf[3] = 0x0F; 1881 buf[3] = 0x0F;
@@ -1903,9 +1903,9 @@ static void dualshock4_send_output_report(struct sony_sc *sc)
1903 buf[offset++] = sc->led_delay_off[3]; 1903 buf[offset++] = sc->led_delay_off[3];
1904 1904
1905 if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) 1905 if (sc->quirks & DUALSHOCK4_CONTROLLER_USB)
1906 hid_hw_output_report(hdev, buf, DS4_REPORT_0x05_SIZE); 1906 hid_hw_output_report(hdev, buf, DS4_OUTPUT_REPORT_0x05_SIZE);
1907 else 1907 else
1908 hid_hw_raw_request(hdev, 0x11, buf, DS4_REPORT_0x11_SIZE, 1908 hid_hw_raw_request(hdev, 0x11, buf, DS4_OUTPUT_REPORT_0x11_SIZE,
1909 HID_OUTPUT_REPORT, HID_REQ_SET_REPORT); 1909 HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
1910} 1910}
1911 1911
@@ -1950,10 +1950,10 @@ static int sony_allocate_output_report(struct sony_sc *sc)
1950 kmalloc(sizeof(union sixaxis_output_report_01), 1950 kmalloc(sizeof(union sixaxis_output_report_01),
1951 GFP_KERNEL); 1951 GFP_KERNEL);
1952 else if (sc->quirks & DUALSHOCK4_CONTROLLER_BT) 1952 else if (sc->quirks & DUALSHOCK4_CONTROLLER_BT)
1953 sc->output_report_dmabuf = kmalloc(DS4_REPORT_0x11_SIZE, 1953 sc->output_report_dmabuf = kmalloc(DS4_OUTPUT_REPORT_0x11_SIZE,
1954 GFP_KERNEL); 1954 GFP_KERNEL);
1955 else if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) 1955 else if (sc->quirks & DUALSHOCK4_CONTROLLER_USB)
1956 sc->output_report_dmabuf = kmalloc(DS4_REPORT_0x05_SIZE, 1956 sc->output_report_dmabuf = kmalloc(DS4_OUTPUT_REPORT_0x05_SIZE,
1957 GFP_KERNEL); 1957 GFP_KERNEL);
1958 else if (sc->quirks & MOTION_CONTROLLER) 1958 else if (sc->quirks & MOTION_CONTROLLER)
1959 sc->output_report_dmabuf = kmalloc(MOTION_REPORT_0x02_SIZE, 1959 sc->output_report_dmabuf = kmalloc(MOTION_REPORT_0x02_SIZE,
@@ -2198,7 +2198,7 @@ static int sony_check_add(struct sony_sc *sc)
2198 return 0; 2198 return 0;
2199 } 2199 }
2200 } else if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) { 2200 } else if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) {
2201 buf = kmalloc(DS4_REPORT_0x81_SIZE, GFP_KERNEL); 2201 buf = kmalloc(DS4_FEATURE_REPORT_0x81_SIZE, GFP_KERNEL);
2202 if (!buf) 2202 if (!buf)
2203 return -ENOMEM; 2203 return -ENOMEM;
2204 2204
@@ -2208,10 +2208,10 @@ static int sony_check_add(struct sony_sc *sc)
2208 * offset 1. 2208 * offset 1.
2209 */ 2209 */
2210 ret = hid_hw_raw_request(sc->hdev, 0x81, buf, 2210 ret = hid_hw_raw_request(sc->hdev, 0x81, buf,
2211 DS4_REPORT_0x81_SIZE, HID_FEATURE_REPORT, 2211 DS4_FEATURE_REPORT_0x81_SIZE, HID_FEATURE_REPORT,
2212 HID_REQ_GET_REPORT); 2212 HID_REQ_GET_REPORT);
2213 2213
2214 if (ret != DS4_REPORT_0x81_SIZE) { 2214 if (ret != DS4_FEATURE_REPORT_0x81_SIZE) {
2215 hid_err(sc->hdev, "failed to retrieve feature report 0x81 with the DualShock 4 MAC address\n"); 2215 hid_err(sc->hdev, "failed to retrieve feature report 0x81 with the DualShock 4 MAC address\n");
2216 ret = ret < 0 ? ret : -EINVAL; 2216 ret = ret < 0 ? ret : -EINVAL;
2217 goto out_free; 2217 goto out_free;