mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
Merge branch 'for-6.13/core' into for-linus
- assorted cleanups and small code fixes (Dmitry Torokhov, Yan Zhen, Nathan Chancellor, Andy Shevchenko)
This commit is contained in:
commit
22380b5f03
@ -1183,7 +1183,7 @@ static const __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
|
||||
|
||||
if (drvdata->quirks & QUIRK_G752_KEYBOARD &&
|
||||
*rsize == 75 && rdesc[61] == 0x15 && rdesc[62] == 0x00) {
|
||||
/* report is missing usage mninum and maximum */
|
||||
/* report is missing usage minimum and maximum */
|
||||
__u8 *new_rdesc;
|
||||
size_t new_size = *rsize + sizeof(asus_g752_fixed_rdesc);
|
||||
|
||||
|
@ -45,6 +45,34 @@ static int hid_ignore_special_drivers = 0;
|
||||
module_param_named(ignore_special_drivers, hid_ignore_special_drivers, int, 0600);
|
||||
MODULE_PARM_DESC(ignore_special_drivers, "Ignore any special drivers and handle all devices by generic driver");
|
||||
|
||||
/*
|
||||
* Convert a signed n-bit integer to signed 32-bit integer.
|
||||
*/
|
||||
|
||||
static s32 snto32(__u32 value, unsigned int n)
|
||||
{
|
||||
if (!value || !n)
|
||||
return 0;
|
||||
|
||||
if (n > 32)
|
||||
n = 32;
|
||||
|
||||
return sign_extend32(value, n - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a signed 32-bit integer to a signed n-bit integer.
|
||||
*/
|
||||
|
||||
static u32 s32ton(__s32 value, unsigned int n)
|
||||
{
|
||||
s32 a = value >> (n - 1);
|
||||
|
||||
if (a && a != -1)
|
||||
return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1;
|
||||
return value & ((1 << n) - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Register a new report for a device.
|
||||
*/
|
||||
@ -425,7 +453,7 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
|
||||
* both this and the standard encoding. */
|
||||
raw_value = item_sdata(item);
|
||||
if (!(raw_value & 0xfffffff0))
|
||||
parser->global.unit_exponent = hid_snto32(raw_value, 4);
|
||||
parser->global.unit_exponent = snto32(raw_value, 4);
|
||||
else
|
||||
parser->global.unit_exponent = raw_value;
|
||||
return 0;
|
||||
@ -754,35 +782,29 @@ static const u8 *fetch_item(const __u8 *start, const __u8 *end, struct hid_item
|
||||
}
|
||||
|
||||
item->format = HID_ITEM_FORMAT_SHORT;
|
||||
item->size = b & 3;
|
||||
item->size = BIT(b & 3) >> 1; /* 0, 1, 2, 3 -> 0, 1, 2, 4 */
|
||||
|
||||
if (end - start < item->size)
|
||||
return NULL;
|
||||
|
||||
switch (item->size) {
|
||||
case 0:
|
||||
return start;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if ((end - start) < 1)
|
||||
return NULL;
|
||||
item->data.u8 = *start++;
|
||||
return start;
|
||||
item->data.u8 = *start;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if ((end - start) < 2)
|
||||
return NULL;
|
||||
item->data.u16 = get_unaligned_le16(start);
|
||||
start = (__u8 *)((__le16 *)start + 1);
|
||||
return start;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
item->size++;
|
||||
if ((end - start) < 4)
|
||||
return NULL;
|
||||
case 4:
|
||||
item->data.u32 = get_unaligned_le32(start);
|
||||
start = (__u8 *)((__le32 *)start + 1);
|
||||
return start;
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return start + item->size;
|
||||
}
|
||||
|
||||
static void hid_scan_input_usage(struct hid_parser *parser, u32 usage)
|
||||
@ -1315,46 +1337,6 @@ int hid_open_report(struct hid_device *device)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(hid_open_report);
|
||||
|
||||
/*
|
||||
* Convert a signed n-bit integer to signed 32-bit integer. Common
|
||||
* cases are done through the compiler, the screwed things has to be
|
||||
* done by hand.
|
||||
*/
|
||||
|
||||
static s32 snto32(__u32 value, unsigned n)
|
||||
{
|
||||
if (!value || !n)
|
||||
return 0;
|
||||
|
||||
if (n > 32)
|
||||
n = 32;
|
||||
|
||||
switch (n) {
|
||||
case 8: return ((__s8)value);
|
||||
case 16: return ((__s16)value);
|
||||
case 32: return ((__s32)value);
|
||||
}
|
||||
return value & (1 << (n - 1)) ? value | (~0U << n) : value;
|
||||
}
|
||||
|
||||
s32 hid_snto32(__u32 value, unsigned n)
|
||||
{
|
||||
return snto32(value, n);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(hid_snto32);
|
||||
|
||||
/*
|
||||
* Convert a signed 32-bit integer to a signed n-bit integer.
|
||||
*/
|
||||
|
||||
static u32 s32ton(__s32 value, unsigned n)
|
||||
{
|
||||
s32 a = value >> (n - 1);
|
||||
if (a && a != -1)
|
||||
return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1;
|
||||
return value & ((1 << n) - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract/implement a data field from/to a little endian report (bit array).
|
||||
*
|
||||
|
@ -3309,9 +3309,9 @@ static const char *keys[KEY_MAX + 1] = {
|
||||
[KEY_EPG] = "EPG", [KEY_PVR] = "PVR",
|
||||
[KEY_MHP] = "MHP", [KEY_LANGUAGE] = "Language",
|
||||
[KEY_TITLE] = "Title", [KEY_SUBTITLE] = "Subtitle",
|
||||
[KEY_ANGLE] = "Angle", [KEY_ZOOM] = "Zoom",
|
||||
[KEY_ANGLE] = "Angle",
|
||||
[KEY_MODE] = "Mode", [KEY_KEYBOARD] = "Keyboard",
|
||||
[KEY_SCREEN] = "Screen", [KEY_PC] = "PC",
|
||||
[KEY_PC] = "PC",
|
||||
[KEY_TV] = "TV", [KEY_TV2] = "TV2",
|
||||
[KEY_VCR] = "VCR", [KEY_VCR2] = "VCR2",
|
||||
[KEY_SAT] = "Sat", [KEY_SAT2] = "Sat2",
|
||||
@ -3409,8 +3409,7 @@ static const char *keys[KEY_MAX + 1] = {
|
||||
[BTN_TRIGGER_HAPPY35] = "TriggerHappy35", [BTN_TRIGGER_HAPPY36] = "TriggerHappy36",
|
||||
[BTN_TRIGGER_HAPPY37] = "TriggerHappy37", [BTN_TRIGGER_HAPPY38] = "TriggerHappy38",
|
||||
[BTN_TRIGGER_HAPPY39] = "TriggerHappy39", [BTN_TRIGGER_HAPPY40] = "TriggerHappy40",
|
||||
[BTN_DIGI] = "Digi", [BTN_STYLUS3] = "Stylus3",
|
||||
[BTN_TOOL_QUINTTAP] = "ToolQuintTap", [BTN_WHEEL] = "Wheel",
|
||||
[BTN_STYLUS3] = "Stylus3", [BTN_TOOL_QUINTTAP] = "ToolQuintTap",
|
||||
[KEY_10CHANNELSDOWN] = "10ChannelsDown",
|
||||
[KEY_10CHANNELSUP] = "10ChannelsUp",
|
||||
[KEY_3D_MODE] = "3DMode", [KEY_ADDRESSBOOK] = "Addressbook",
|
||||
@ -3440,7 +3439,7 @@ static const char *keys[KEY_MAX + 1] = {
|
||||
[KEY_FN_RIGHT_SHIFT] = "FnRightShift", [KEY_FRAMEBACK] = "FrameBack",
|
||||
[KEY_FRAMEFORWARD] = "FrameForward", [KEY_FULL_SCREEN] = "FullScreen",
|
||||
[KEY_GAMES] = "Games", [KEY_GRAPHICSEDITOR] = "GraphicsEditor",
|
||||
[KEY_HANGEUL] = "HanGeul", [KEY_HANGUP_PHONE] = "HangUpPhone",
|
||||
[KEY_HANGUP_PHONE] = "HangUpPhone",
|
||||
[KEY_IMAGES] = "Images", [KEY_KBD_LCD_MENU1] = "KbdLcdMenu1",
|
||||
[KEY_KBD_LCD_MENU2] = "KbdLcdMenu2", [KEY_KBD_LCD_MENU3] = "KbdLcdMenu3",
|
||||
[KEY_KBD_LCD_MENU4] = "KbdLcdMenu4", [KEY_KBD_LCD_MENU5] = "KbdLcdMenu5",
|
||||
|
@ -2498,7 +2498,7 @@ static void hidpp_ff_work_handler(struct work_struct *w)
|
||||
/* regular effect destroyed */
|
||||
data->effect_ids[wd->params[0]-1] = -1;
|
||||
else if (wd->effect_id >= HIDPP_FF_EFFECTID_AUTOCENTER)
|
||||
/* autocenter spring destoyed */
|
||||
/* autocenter spring destroyed */
|
||||
data->slot_autocenter = 0;
|
||||
break;
|
||||
case HIDPP_FF_SET_GLOBAL_GAINS:
|
||||
@ -3271,13 +3271,13 @@ static int m560_raw_event(struct hid_device *hdev, u8 *data, int size)
|
||||
120);
|
||||
}
|
||||
|
||||
v = hid_snto32(hid_field_extract(hdev, data+3, 0, 12), 12);
|
||||
v = sign_extend32(hid_field_extract(hdev, data + 3, 0, 12), 11);
|
||||
input_report_rel(hidpp->input, REL_X, v);
|
||||
|
||||
v = hid_snto32(hid_field_extract(hdev, data+3, 12, 12), 12);
|
||||
v = sign_extend32(hid_field_extract(hdev, data + 3, 12, 12), 11);
|
||||
input_report_rel(hidpp->input, REL_Y, v);
|
||||
|
||||
v = hid_snto32(data[6], 8);
|
||||
v = sign_extend32(data[6], 7);
|
||||
if (v != 0)
|
||||
hidpp_scroll_counter_handle_scroll(hidpp->input,
|
||||
&hidpp->vertical_wheel_counter, v);
|
||||
|
@ -296,7 +296,7 @@ static void picolcd_fb_destroy(struct fb_info *info)
|
||||
/* make sure no work is deferred */
|
||||
fb_deferred_io_cleanup(info);
|
||||
|
||||
/* No thridparty should ever unregister our framebuffer! */
|
||||
/* No thirdparty should ever unregister our framebuffer! */
|
||||
WARN_ON(fbdata->picolcd != NULL);
|
||||
|
||||
vfree((u8 *)info->fix.smem_start);
|
||||
|
@ -946,7 +946,7 @@ hid_sensor_register_platform_device(struct platform_device *pdev,
|
||||
|
||||
memcpy(real_usage, match->luid, 4);
|
||||
|
||||
/* usage id are all lowcase */
|
||||
/* usage id are all lowercase */
|
||||
for (c = real_usage; *c != '\0'; c++)
|
||||
*c = tolower(*c);
|
||||
|
||||
|
@ -253,7 +253,7 @@ enum
|
||||
ID_CONTROLLER_DECK_STATE = 9
|
||||
};
|
||||
|
||||
/* String attribute idenitifiers */
|
||||
/* String attribute identifiers */
|
||||
enum {
|
||||
ATTRIB_STR_BOARD_SERIAL,
|
||||
ATTRIB_STR_UNIT_SERIAL,
|
||||
|
@ -793,7 +793,7 @@ static int load_fw_from_host(struct ishtp_cl_data *client_data)
|
||||
if (rv < 0)
|
||||
goto end_err_fw_release;
|
||||
|
||||
/* Step 3: Start ISH main firmware exeuction */
|
||||
/* Step 3: Start ISH main firmware execution */
|
||||
|
||||
rv = ish_fw_start(client_data);
|
||||
if (rv < 0)
|
||||
|
@ -863,7 +863,7 @@ static void ipc_tx_send(void *prm)
|
||||
/* Send ipc fragment */
|
||||
ishtp_hdr.length = dev->mtu;
|
||||
ishtp_hdr.msg_complete = 0;
|
||||
/* All fregments submitted to IPC queue with no callback */
|
||||
/* All fragments submitted to IPC queue with no callback */
|
||||
ishtp_write_message(dev, &ishtp_hdr, pmsg);
|
||||
cl->tx_offs += dev->mtu;
|
||||
rem = cl_msg->send_buf.size - cl->tx_offs;
|
||||
|
@ -1100,7 +1100,7 @@ static int usbhid_start(struct hid_device *hid)
|
||||
|
||||
interval = endpoint->bInterval;
|
||||
|
||||
/* Some vendors give fullspeed interval on highspeed devides */
|
||||
/* Some vendors give fullspeed interval on highspeed devices */
|
||||
if (hid->quirks & HID_QUIRK_FULLSPEED_INTERVAL &&
|
||||
dev->speed == USB_SPEED_HIGH) {
|
||||
interval = fls(endpoint->bInterval*8);
|
||||
|
@ -974,7 +974,6 @@ const struct hid_device_id *hid_match_device(struct hid_device *hdev,
|
||||
struct hid_driver *hdrv);
|
||||
bool hid_compare_device_paths(struct hid_device *hdev_a,
|
||||
struct hid_device *hdev_b, char separator);
|
||||
s32 hid_snto32(__u32 value, unsigned n);
|
||||
__u32 hid_field_extract(const struct hid_device *hid, __u8 *report,
|
||||
unsigned offset, unsigned n);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user