aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-sensor-hub.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-03 07:53:39 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-03 07:53:39 +0100
commit44c94100b6fa83488337fe639eb7baba7dd93a91 (patch)
treeffc60bdfe3a3f2f20359d2a7df8389f3ecf51d82 /drivers/hid/hid-sensor-hub.c
parent77df6d8d7298fd3fae12a646fd368fdcdb86152c (diff)
parent2595646791c319cadfdbf271563aac97d0843dc7 (diff)
downloadkernel_replicant_linux-44c94100b6fa83488337fe639eb7baba7dd93a91.tar.gz
kernel_replicant_linux-44c94100b6fa83488337fe639eb7baba7dd93a91.tar.bz2
kernel_replicant_linux-44c94100b6fa83488337fe639eb7baba7dd93a91.zip
Merge 4.20-rc5 into usb-next
We need the USB fixes into usb-next. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hid/hid-sensor-hub.c')
-rw-r--r--drivers/hid/hid-sensor-hub.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 2b63487057c2..4256fdc5cd6d 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -299,7 +299,8 @@ EXPORT_SYMBOL_GPL(sensor_hub_get_feature);
int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
u32 usage_id,
u32 attr_usage_id, u32 report_id,
- enum sensor_hub_read_flags flag)
+ enum sensor_hub_read_flags flag,
+ bool is_signed)
{
struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
unsigned long flags;
@@ -331,10 +332,16 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
&hsdev->pending.ready, HZ*5);
switch (hsdev->pending.raw_size) {
case 1:
- ret_val = *(u8 *)hsdev->pending.raw_data;
+ if (is_signed)
+ ret_val = *(s8 *)hsdev->pending.raw_data;
+ else
+ ret_val = *(u8 *)hsdev->pending.raw_data;
break;
case 2:
- ret_val = *(u16 *)hsdev->pending.raw_data;
+ if (is_signed)
+ ret_val = *(s16 *)hsdev->pending.raw_data;
+ else
+ ret_val = *(u16 *)hsdev->pending.raw_data;
break;
case 4:
ret_val = *(u32 *)hsdev->pending.raw_data;