aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-11-30 15:23:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-11-30 15:23:44 -0500
commitcd9a0433238da43611179e44b1d71ad24998b107 (patch)
tree89f620156314493a26670f9095d4ed6155466458
parent40ebba2ad7e1a3f024479e633da5ca5694524767 (diff)
parentc648284f6c9606f1854816086593eeae5556845a (diff)
Merge tag 'staging-4.20-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging and IIO driver fixes from Greg KH: "Here are some small IIO and staging driver fixes for 4.20-rc5. Nothing major, the IIO fix ended up touching the HID drivers at the same time, but the HID maintainer acked it. The staging fixes are all minor patches for reported issues and regressions, full details are in the shortlog. All of these have been in linux-next for a while with no reported issues" * tag 'staging-4.20-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers staging: vchiq_arm: fix compat VCHIQ_IOC_AWAIT_COMPLETION staging: mt7621-pinctrl: fix uninitialized variable ngroups staging: rtl8723bs: Add missing return for cfg80211_rtw_get_station staging: most: use format specifier "%s" in snprintf staging: rtl8723bs: Fix incorrect sense of ether_addr_equal staging: mt7621-dma: fix potentially dereferencing uninitialized 'tx_desc' staging: comedi: clarify/unify macros for NI macro-defined terminals drivers: staging: cedrus: find ctx before dereferencing it ctx staging: rtl8723bs: Fix the return value in case of error in 'rtw_wx_read32()' staging: comedi: ni_mio_common: scale ao INSN_CONFIG_GET_CMD_TIMING_CONSTRAINTS iio:st_magn: Fix enable device after trigger
-rw-r--r--drivers/hid/hid-sensor-custom.c2
-rw-r--r--drivers/hid/hid-sensor-hub.c13
-rw-r--r--drivers/iio/accel/hid-sensor-accel-3d.c5
-rw-r--r--drivers/iio/gyro/hid-sensor-gyro-3d.c5
-rw-r--r--drivers/iio/humidity/hid-sensor-humidity.c3
-rw-r--r--drivers/iio/light/hid-sensor-als.c8
-rw-r--r--drivers/iio/light/hid-sensor-prox.c8
-rw-r--r--drivers/iio/magnetometer/hid-sensor-magn-3d.c8
-rw-r--r--drivers/iio/magnetometer/st_magn_buffer.c12
-rw-r--r--drivers/iio/orientation/hid-sensor-incl-3d.c8
-rw-r--r--drivers/iio/pressure/hid-sensor-press.c8
-rw-r--r--drivers/iio/temperature/hid-sensor-temperature.c3
-rw-r--r--drivers/rtc/rtc-hid-sensor-time.c2
-rw-r--r--drivers/staging/comedi/comedi.h39
-rw-r--r--drivers/staging/comedi/drivers/ni_mio_common.c3
-rw-r--r--drivers/staging/media/sunxi/cedrus/cedrus.c22
-rw-r--r--drivers/staging/most/core.c2
-rw-r--r--drivers/staging/mt7621-dma/mtk-hsdma.c3
-rw-r--r--drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c2
-rw-r--r--drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c4
-rw-r--r--drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c2
-rw-r--r--drivers/staging/rtl8723bs/os_dep/ioctl_linux.c2
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c7
-rw-r--r--include/linux/hid-sensor-hub.h4
24 files changed, 103 insertions, 72 deletions
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index e8a114157f87..bb012bc032e0 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -358,7 +358,7 @@ static ssize_t show_value(struct device *dev, struct device_attribute *attr,
358 sensor_inst->hsdev, 358 sensor_inst->hsdev,
359 sensor_inst->hsdev->usage, 359 sensor_inst->hsdev->usage,
360 usage, report_id, 360 usage, report_id,
361 SENSOR_HUB_SYNC); 361 SENSOR_HUB_SYNC, false);
362 } else if (!strncmp(name, "units", strlen("units"))) 362 } else if (!strncmp(name, "units", strlen("units")))
363 value = sensor_inst->fields[field_index].attribute.units; 363 value = sensor_inst->fields[field_index].attribute.units;
364 else if (!strncmp(name, "unit-expo", strlen("unit-expo"))) 364 else if (!strncmp(name, "unit-expo", strlen("unit-expo")))
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);
299int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, 299int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
300 u32 usage_id, 300 u32 usage_id,
301 u32 attr_usage_id, u32 report_id, 301 u32 attr_usage_id, u32 report_id,
302 enum sensor_hub_read_flags flag) 302 enum sensor_hub_read_flags flag,
303 bool is_signed)
303{ 304{
304 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); 305 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
305 unsigned long flags; 306 unsigned long flags;
@@ -331,10 +332,16 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
331 &hsdev->pending.ready, HZ*5); 332 &hsdev->pending.ready, HZ*5);
332 switch (hsdev->pending.raw_size) { 333 switch (hsdev->pending.raw_size) {
333 case 1: 334 case 1:
334 ret_val = *(u8 *)hsdev->pending.raw_data; 335 if (is_signed)
336 ret_val = *(s8 *)hsdev->pending.raw_data;
337 else
338 ret_val = *(u8 *)hsdev->pending.raw_data;
335 break; 339 break;
336 case 2: 340 case 2:
337 ret_val = *(u16 *)hsdev->pending.raw_data; 341 if (is_signed)
342 ret_val = *(s16 *)hsdev->pending.raw_data;
343 else
344 ret_val = *(u16 *)hsdev->pending.raw_data;
338 break; 345 break;
339 case 4: 346 case 4:
340 ret_val = *(u32 *)hsdev->pending.raw_data; 347 ret_val = *(u32 *)hsdev->pending.raw_data;
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
index 41d97faf5013..38ff374a3ca4 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -149,6 +149,7 @@ static int accel_3d_read_raw(struct iio_dev *indio_dev,
149 int report_id = -1; 149 int report_id = -1;
150 u32 address; 150 u32 address;
151 int ret_type; 151 int ret_type;
152 s32 min;
152 struct hid_sensor_hub_device *hsdev = 153 struct hid_sensor_hub_device *hsdev =
153 accel_state->common_attributes.hsdev; 154 accel_state->common_attributes.hsdev;
154 155
@@ -158,12 +159,14 @@ static int accel_3d_read_raw(struct iio_dev *indio_dev,
158 case IIO_CHAN_INFO_RAW: 159 case IIO_CHAN_INFO_RAW:
159 hid_sensor_power_state(&accel_state->common_attributes, true); 160 hid_sensor_power_state(&accel_state->common_attributes, true);
160 report_id = accel_state->accel[chan->scan_index].report_id; 161 report_id = accel_state->accel[chan->scan_index].report_id;
162 min = accel_state->accel[chan->scan_index].logical_minimum;
161 address = accel_3d_addresses[chan->scan_index]; 163 address = accel_3d_addresses[chan->scan_index];
162 if (report_id >= 0) 164 if (report_id >= 0)
163 *val = sensor_hub_input_attr_get_raw_value( 165 *val = sensor_hub_input_attr_get_raw_value(
164 accel_state->common_attributes.hsdev, 166 accel_state->common_attributes.hsdev,
165 hsdev->usage, address, report_id, 167 hsdev->usage, address, report_id,
166 SENSOR_HUB_SYNC); 168 SENSOR_HUB_SYNC,
169 min < 0);
167 else { 170 else {
168 *val = 0; 171 *val = 0;
169 hid_sensor_power_state(&accel_state->common_attributes, 172 hid_sensor_power_state(&accel_state->common_attributes,
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index 36941e69f959..88e857c4baf4 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -111,6 +111,7 @@ static int gyro_3d_read_raw(struct iio_dev *indio_dev,
111 int report_id = -1; 111 int report_id = -1;
112 u32 address; 112 u32 address;
113 int ret_type; 113 int ret_type;
114 s32 min;
114 115
115 *val = 0; 116 *val = 0;
116 *val2 = 0; 117 *val2 = 0;
@@ -118,13 +119,15 @@ static int gyro_3d_read_raw(struct iio_dev *indio_dev,
118 case IIO_CHAN_INFO_RAW: 119 case IIO_CHAN_INFO_RAW:
119 hid_sensor_power_state(&gyro_state->common_attributes, true); 120 hid_sensor_power_state(&gyro_state->common_attributes, true);
120 report_id = gyro_state->gyro[chan->scan_index].report_id; 121 report_id = gyro_state->gyro[chan->scan_index].report_id;
122 min = gyro_state->gyro[chan->scan_index].logical_minimum;
121 address = gyro_3d_addresses[chan->scan_index]; 123 address = gyro_3d_addresses[chan->scan_index];
122 if (report_id >= 0) 124 if (report_id >= 0)
123 *val = sensor_hub_input_attr_get_raw_value( 125 *val = sensor_hub_input_attr_get_raw_value(
124 gyro_state->common_attributes.hsdev, 126 gyro_state->common_attributes.hsdev,
125 HID_USAGE_SENSOR_GYRO_3D, address, 127 HID_USAGE_SENSOR_GYRO_3D, address,
126 report_id, 128 report_id,
127 SENSOR_HUB_SYNC); 129 SENSOR_HUB_SYNC,
130 min < 0);
128 else { 131 else {
129 *val = 0; 132 *val = 0;
130 hid_sensor_power_state(&gyro_state->common_attributes, 133 hid_sensor_power_state(&gyro_state->common_attributes,
diff --git a/drivers/iio/humidity/hid-sensor-humidity.c b/drivers/iio/humidity/hid-sensor-humidity.c
index beab6d6fd6e1..4bc95f31c730 100644
--- a/drivers/iio/humidity/hid-sensor-humidity.c
+++ b/drivers/iio/humidity/hid-sensor-humidity.c
@@ -75,7 +75,8 @@ static int humidity_read_raw(struct iio_dev *indio_dev,
75 HID_USAGE_SENSOR_HUMIDITY, 75 HID_USAGE_SENSOR_HUMIDITY,
76 HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY, 76 HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY,
77 humid_st->humidity_attr.report_id, 77 humid_st->humidity_attr.report_id,
78 SENSOR_HUB_SYNC); 78 SENSOR_HUB_SYNC,
79 humid_st->humidity_attr.logical_minimum < 0);
79 hid_sensor_power_state(&humid_st->common_attributes, false); 80 hid_sensor_power_state(&humid_st->common_attributes, false);
80 81
81 return IIO_VAL_INT; 82 return IIO_VAL_INT;
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index 406caaee9a3c..94f33250ba5a 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -93,6 +93,7 @@ static int als_read_raw(struct iio_dev *indio_dev,
93 int report_id = -1; 93 int report_id = -1;
94 u32 address; 94 u32 address;
95 int ret_type; 95 int ret_type;
96 s32 min;
96 97
97 *val = 0; 98 *val = 0;
98 *val2 = 0; 99 *val2 = 0;
@@ -102,8 +103,8 @@ static int als_read_raw(struct iio_dev *indio_dev,
102 case CHANNEL_SCAN_INDEX_INTENSITY: 103 case CHANNEL_SCAN_INDEX_INTENSITY:
103 case CHANNEL_SCAN_INDEX_ILLUM: 104 case CHANNEL_SCAN_INDEX_ILLUM:
104 report_id = als_state->als_illum.report_id; 105 report_id = als_state->als_illum.report_id;
105 address = 106 min = als_state->als_illum.logical_minimum;
106 HID_USAGE_SENSOR_LIGHT_ILLUM; 107 address = HID_USAGE_SENSOR_LIGHT_ILLUM;
107 break; 108 break;
108 default: 109 default:
109 report_id = -1; 110 report_id = -1;
@@ -116,7 +117,8 @@ static int als_read_raw(struct iio_dev *indio_dev,
116 als_state->common_attributes.hsdev, 117 als_state->common_attributes.hsdev,
117 HID_USAGE_SENSOR_ALS, address, 118 HID_USAGE_SENSOR_ALS, address,
118 report_id, 119 report_id,
119 SENSOR_HUB_SYNC); 120 SENSOR_HUB_SYNC,
121 min < 0);
120 hid_sensor_power_state(&als_state->common_attributes, 122 hid_sensor_power_state(&als_state->common_attributes,
121 false); 123 false);
122 } else { 124 } else {
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index 45107f7537b5..cf5a0c242609 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -73,6 +73,7 @@ static int prox_read_raw(struct iio_dev *indio_dev,
73 int report_id = -1; 73 int report_id = -1;
74 u32 address; 74 u32 address;
75 int ret_type; 75 int ret_type;
76 s32 min;
76 77
77 *val = 0; 78 *val = 0;
78 *val2 = 0; 79 *val2 = 0;
@@ -81,8 +82,8 @@ static int prox_read_raw(struct iio_dev *indio_dev,
81 switch (chan->scan_index) { 82 switch (chan->scan_index) {
82 case CHANNEL_SCAN_INDEX_PRESENCE: 83 case CHANNEL_SCAN_INDEX_PRESENCE:
83 report_id = prox_state->prox_attr.report_id; 84 report_id = prox_state->prox_attr.report_id;
84 address = 85 min = prox_state->prox_attr.logical_minimum;
85 HID_USAGE_SENSOR_HUMAN_PRESENCE; 86 address = HID_USAGE_SENSOR_HUMAN_PRESENCE;
86 break; 87 break;
87 default: 88 default:
88 report_id = -1; 89 report_id = -1;
@@ -95,7 +96,8 @@ static int prox_read_raw(struct iio_dev *indio_dev,
95 prox_state->common_attributes.hsdev, 96 prox_state->common_attributes.hsdev,
96 HID_USAGE_SENSOR_PROX, address, 97 HID_USAGE_SENSOR_PROX, address,
97 report_id, 98 report_id,
98 SENSOR_HUB_SYNC); 99 SENSOR_HUB_SYNC,
100 min < 0);
99 hid_sensor_power_state(&prox_state->common_attributes, 101 hid_sensor_power_state(&prox_state->common_attributes,
100 false); 102 false);
101 } else { 103 } else {
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
index d55c4885211a..f3c0d41e5a8c 100644
--- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
+++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
@@ -163,21 +163,23 @@ static int magn_3d_read_raw(struct iio_dev *indio_dev,
163 int report_id = -1; 163 int report_id = -1;
164 u32 address; 164 u32 address;
165 int ret_type; 165 int ret_type;
166 s32 min;
166 167
167 *val = 0; 168 *val = 0;
168 *val2 = 0; 169 *val2 = 0;
169 switch (mask) { 170 switch (mask) {
170 case IIO_CHAN_INFO_RAW: 171 case IIO_CHAN_INFO_RAW:
171 hid_sensor_power_state(&magn_state->magn_flux_attributes, true); 172 hid_sensor_power_state(&magn_state->magn_flux_attributes, true);
172 report_id = 173 report_id = magn_state->magn[chan->address].report_id;
173 magn_state->magn[chan->address].report_id; 174 min = magn_state->magn[chan->address].logical_minimum;
174 address = magn_3d_addresses[chan->address]; 175 address = magn_3d_addresses[chan->address];
175 if (report_id >= 0) 176 if (report_id >= 0)
176 *val = sensor_hub_input_attr_get_raw_value( 177 *val = sensor_hub_input_attr_get_raw_value(
177 magn_state->magn_flux_attributes.hsdev, 178 magn_state->magn_flux_attributes.hsdev,
178 HID_USAGE_SENSOR_COMPASS_3D, address, 179 HID_USAGE_SENSOR_COMPASS_3D, address,
179 report_id, 180 report_id,
180 SENSOR_HUB_SYNC); 181 SENSOR_HUB_SYNC,
182 min < 0);
181 else { 183 else {
182 *val = 0; 184 *val = 0;
183 hid_sensor_power_state( 185 hid_sensor_power_state(
diff --git a/drivers/iio/magnetometer/st_magn_buffer.c b/drivers/iio/magnetometer/st_magn_buffer.c
index 0a9e8fadfa9d..37ab30566464 100644
--- a/drivers/iio/magnetometer/st_magn_buffer.c
+++ b/drivers/iio/magnetometer/st_magn_buffer.c
@@ -30,11 +30,6 @@ int st_magn_trig_set_state(struct iio_trigger *trig, bool state)
30 return st_sensors_set_dataready_irq(indio_dev, state); 30 return st_sensors_set_dataready_irq(indio_dev, state);
31} 31}
32 32
33static int st_magn_buffer_preenable(struct iio_dev *indio_dev)
34{
35 return st_sensors_set_enable(indio_dev, true);
36}
37
38static int st_magn_buffer_postenable(struct iio_dev *indio_dev) 33static int st_magn_buffer_postenable(struct iio_dev *indio_dev)
39{ 34{
40 int err; 35 int err;
@@ -50,7 +45,7 @@ static int st_magn_buffer_postenable(struct iio_dev *indio_dev)
50 if (err < 0) 45 if (err < 0)
51 goto st_magn_buffer_postenable_error; 46 goto st_magn_buffer_postenable_error;
52 47
53 return err; 48 return st_sensors_set_enable(indio_dev, true);
54 49
55st_magn_buffer_postenable_error: 50st_magn_buffer_postenable_error:
56 kfree(mdata->buffer_data); 51 kfree(mdata->buffer_data);
@@ -63,11 +58,11 @@ static int st_magn_buffer_predisable(struct iio_dev *indio_dev)
63 int err; 58 int err;
64 struct st_sensor_data *mdata = iio_priv(indio_dev); 59 struct st_sensor_data *mdata = iio_priv(indio_dev);
65 60
66 err = iio_triggered_buffer_predisable(indio_dev); 61 err = st_sensors_set_enable(indio_dev, false);
67 if (err < 0) 62 if (err < 0)
68 goto st_magn_buffer_predisable_error; 63 goto st_magn_buffer_predisable_error;
69 64
70 err = st_sensors_set_enable(indio_dev, false); 65 err = iio_triggered_buffer_predisable(indio_dev);
71 66
72st_magn_buffer_predisable_error: 67st_magn_buffer_predisable_error:
73 kfree(mdata->buffer_data); 68 kfree(mdata->buffer_data);
@@ -75,7 +70,6 @@ st_magn_buffer_predisable_error:
75} 70}
76 71
77static const struct iio_buffer_setup_ops st_magn_buffer_setup_ops = { 72static const struct iio_buffer_setup_ops st_magn_buffer_setup_ops = {
78 .preenable = &st_magn_buffer_preenable,
79 .postenable = &st_magn_buffer_postenable, 73 .postenable = &st_magn_buffer_postenable,
80 .predisable = &st_magn_buffer_predisable, 74 .predisable = &st_magn_buffer_predisable,
81}; 75};
diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c b/drivers/iio/orientation/hid-sensor-incl-3d.c
index 1e5451d1ff88..bdc5e4554ee4 100644
--- a/drivers/iio/orientation/hid-sensor-incl-3d.c
+++ b/drivers/iio/orientation/hid-sensor-incl-3d.c
@@ -111,21 +111,23 @@ static int incl_3d_read_raw(struct iio_dev *indio_dev,
111 int report_id = -1; 111 int report_id = -1;
112 u32 address; 112 u32 address;
113 int ret_type; 113 int ret_type;
114 s32 min;
114 115
115 *val = 0; 116 *val = 0;
116 *val2 = 0; 117 *val2 = 0;
117 switch (mask) { 118 switch (mask) {
118 case IIO_CHAN_INFO_RAW: 119 case IIO_CHAN_INFO_RAW:
119 hid_sensor_power_state(&incl_state->common_attributes, true); 120 hid_sensor_power_state(&incl_state->common_attributes, true);
120 report_id = 121 report_id = incl_state->incl[chan->scan_index].report_id;
121 incl_state->incl[chan->scan_index].report_id; 122 min = incl_state->incl[chan->scan_index].logical_minimum;
122 address = incl_3d_addresses[chan->scan_index]; 123 address = incl_3d_addresses[chan->scan_index];
123 if (report_id >= 0) 124 if (report_id >= 0)
124 *val = sensor_hub_input_attr_get_raw_value( 125 *val = sensor_hub_input_attr_get_raw_value(
125 incl_state->common_attributes.hsdev, 126 incl_state->common_attributes.hsdev,
126 HID_USAGE_SENSOR_INCLINOMETER_3D, address, 127 HID_USAGE_SENSOR_INCLINOMETER_3D, address,
127 report_id, 128 report_id,
128 SENSOR_HUB_SYNC); 129 SENSOR_HUB_SYNC,
130 min < 0);
129 else { 131 else {
130 hid_sensor_power_state(&incl_state->common_attributes, 132 hid_sensor_power_state(&incl_state->common_attributes,
131 false); 133 false);
diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c
index 4c437918f1d2..d7b1c00ceb4d 100644
--- a/drivers/iio/pressure/hid-sensor-press.c
+++ b/drivers/iio/pressure/hid-sensor-press.c
@@ -77,6 +77,7 @@ static int press_read_raw(struct iio_dev *indio_dev,
77 int report_id = -1; 77 int report_id = -1;
78 u32 address; 78 u32 address;
79 int ret_type; 79 int ret_type;
80 s32 min;
80 81
81 *val = 0; 82 *val = 0;
82 *val2 = 0; 83 *val2 = 0;
@@ -85,8 +86,8 @@ static int press_read_raw(struct iio_dev *indio_dev,
85 switch (chan->scan_index) { 86 switch (chan->scan_index) {
86 case CHANNEL_SCAN_INDEX_PRESSURE: 87 case CHANNEL_SCAN_INDEX_PRESSURE:
87 report_id = press_state->press_attr.report_id; 88 report_id = press_state->press_attr.report_id;
88 address = 89 min = press_state->press_attr.logical_minimum;
89 HID_USAGE_SENSOR_ATMOSPHERIC_PRESSURE; 90 address = HID_USAGE_SENSOR_ATMOSPHERIC_PRESSURE;
90 break; 91 break;
91 default: 92 default:
92 report_id = -1; 93 report_id = -1;
@@ -99,7 +100,8 @@ static int press_read_raw(struct iio_dev *indio_dev,
99 press_state->common_attributes.hsdev, 100 press_state->common_attributes.hsdev,
100 HID_USAGE_SENSOR_PRESSURE, address, 101 HID_USAGE_SENSOR_PRESSURE, address,
101 report_id, 102 report_id,
102 SENSOR_HUB_SYNC); 103 SENSOR_HUB_SYNC,
104 min < 0);
103 hid_sensor_power_state(&press_state->common_attributes, 105 hid_sensor_power_state(&press_state->common_attributes,
104 false); 106 false);
105 } else { 107 } else {
diff --git a/drivers/iio/temperature/hid-sensor-temperature.c b/drivers/iio/temperature/hid-sensor-temperature.c
index beaf6fd3e337..b592fc4f007e 100644
--- a/drivers/iio/temperature/hid-sensor-temperature.c
+++ b/drivers/iio/temperature/hid-sensor-temperature.c
@@ -76,7 +76,8 @@ static int temperature_read_raw(struct iio_dev *indio_dev,
76 HID_USAGE_SENSOR_TEMPERATURE, 76 HID_USAGE_SENSOR_TEMPERATURE,
77 HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_TEMPERATURE, 77 HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_TEMPERATURE,
78 temp_st->temperature_attr.report_id, 78 temp_st->temperature_attr.report_id,
79 SENSOR_HUB_SYNC); 79 SENSOR_HUB_SYNC,
80 temp_st->temperature_attr.logical_minimum < 0);
80 hid_sensor_power_state( 81 hid_sensor_power_state(
81 &temp_st->common_attributes, 82 &temp_st->common_attributes,
82 false); 83 false);
diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c
index 2751dba850c6..3e1abb455472 100644
--- a/drivers/rtc/rtc-hid-sensor-time.c
+++ b/drivers/rtc/rtc-hid-sensor-time.c
@@ -213,7 +213,7 @@ static int hid_rtc_read_time(struct device *dev, struct rtc_time *tm)
213 /* get a report with all values through requesting one value */ 213 /* get a report with all values through requesting one value */
214 sensor_hub_input_attr_get_raw_value(time_state->common_attributes.hsdev, 214 sensor_hub_input_attr_get_raw_value(time_state->common_attributes.hsdev,
215 HID_USAGE_SENSOR_TIME, hid_time_addresses[0], 215 HID_USAGE_SENSOR_TIME, hid_time_addresses[0],
216 time_state->info[0].report_id, SENSOR_HUB_SYNC); 216 time_state->info[0].report_id, SENSOR_HUB_SYNC, false);
217 /* wait for all values (event) */ 217 /* wait for all values (event) */
218 ret = wait_for_completion_killable_timeout( 218 ret = wait_for_completion_killable_timeout(
219 &time_state->comp_last_time, HZ*6); 219 &time_state->comp_last_time, HZ*6);
diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
index e90b17775284..09a940066c0e 100644
--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -1005,35 +1005,38 @@ enum i8254_mode {
1005 * and INSN_DEVICE_CONFIG_GET_ROUTES. 1005 * and INSN_DEVICE_CONFIG_GET_ROUTES.
1006 */ 1006 */
1007#define NI_NAMES_BASE 0x8000u 1007#define NI_NAMES_BASE 0x8000u
1008
1009#define _TERM_N(base, n, x) ((base) + ((x) & ((n) - 1)))
1010
1008/* 1011/*
1009 * not necessarily all allowed 64 PFIs are valid--certainly not for all devices 1012 * not necessarily all allowed 64 PFIs are valid--certainly not for all devices
1010 */ 1013 */
1011#define NI_PFI(x) (NI_NAMES_BASE + ((x) & 0x3f)) 1014#define NI_PFI(x) _TERM_N(NI_NAMES_BASE, 64, x)
1012/* 8 trigger lines by standard, Some devices cannot talk to all eight. */ 1015/* 8 trigger lines by standard, Some devices cannot talk to all eight. */
1013#define TRIGGER_LINE(x) (NI_PFI(-1) + 1 + ((x) & 0x7)) 1016#define TRIGGER_LINE(x) _TERM_N(NI_PFI(-1) + 1, 8, x)
1014/* 4 RTSI shared MUXes to route signals to/from TRIGGER_LINES on NI hardware */ 1017/* 4 RTSI shared MUXes to route signals to/from TRIGGER_LINES on NI hardware */
1015#define NI_RTSI_BRD(x) (TRIGGER_LINE(-1) + 1 + ((x) & 0x3)) 1018#define NI_RTSI_BRD(x) _TERM_N(TRIGGER_LINE(-1) + 1, 4, x)
1016 1019
1017/* *** Counter/timer names : 8 counters max *** */ 1020/* *** Counter/timer names : 8 counters max *** */
1018#define NI_COUNTER_NAMES_BASE (NI_RTSI_BRD(-1) + 1) 1021#define NI_MAX_COUNTERS 8
1019#define NI_MAX_COUNTERS 7 1022#define NI_COUNTER_NAMES_BASE (NI_RTSI_BRD(-1) + 1)
1020#define NI_CtrSource(x) (NI_COUNTER_NAMES_BASE + ((x) & NI_MAX_COUNTERS)) 1023#define NI_CtrSource(x) _TERM_N(NI_COUNTER_NAMES_BASE, NI_MAX_COUNTERS, x)
1021/* Gate, Aux, A,B,Z are all treated, at times as gates */ 1024/* Gate, Aux, A,B,Z are all treated, at times as gates */
1022#define NI_GATES_NAMES_BASE (NI_CtrSource(-1) + 1) 1025#define NI_GATES_NAMES_BASE (NI_CtrSource(-1) + 1)
1023#define NI_CtrGate(x) (NI_GATES_NAMES_BASE + ((x) & NI_MAX_COUNTERS)) 1026#define NI_CtrGate(x) _TERM_N(NI_GATES_NAMES_BASE, NI_MAX_COUNTERS, x)
1024#define NI_CtrAux(x) (NI_CtrGate(-1) + 1 + ((x) & NI_MAX_COUNTERS)) 1027#define NI_CtrAux(x) _TERM_N(NI_CtrGate(-1) + 1, NI_MAX_COUNTERS, x)
1025#define NI_CtrA(x) (NI_CtrAux(-1) + 1 + ((x) & NI_MAX_COUNTERS)) 1028#define NI_CtrA(x) _TERM_N(NI_CtrAux(-1) + 1, NI_MAX_COUNTERS, x)
1026#define NI_CtrB(x) (NI_CtrA(-1) + 1 + ((x) & NI_MAX_COUNTERS)) 1029#define NI_CtrB(x) _TERM_N(NI_CtrA(-1) + 1, NI_MAX_COUNTERS, x)
1027#define NI_CtrZ(x) (NI_CtrB(-1) + 1 + ((x) & NI_MAX_COUNTERS)) 1030#define NI_CtrZ(x) _TERM_N(NI_CtrB(-1) + 1, NI_MAX_COUNTERS, x)
1028#define NI_GATES_NAMES_MAX NI_CtrZ(-1) 1031#define NI_GATES_NAMES_MAX NI_CtrZ(-1)
1029#define NI_CtrArmStartTrigger(x) (NI_CtrZ(-1) + 1 + ((x) & NI_MAX_COUNTERS)) 1032#define NI_CtrArmStartTrigger(x) _TERM_N(NI_CtrZ(-1) + 1, NI_MAX_COUNTERS, x)
1030#define NI_CtrInternalOutput(x) \ 1033#define NI_CtrInternalOutput(x) \
1031 (NI_CtrArmStartTrigger(-1) + 1 + ((x) & NI_MAX_COUNTERS)) 1034 _TERM_N(NI_CtrArmStartTrigger(-1) + 1, NI_MAX_COUNTERS, x)
1032/** external pin(s) labeled conveniently as Ctr<i>Out. */ 1035/** external pin(s) labeled conveniently as Ctr<i>Out. */
1033#define NI_CtrOut(x) (NI_CtrInternalOutput(-1) + 1 + ((x) & NI_MAX_COUNTERS)) 1036#define NI_CtrOut(x) _TERM_N(NI_CtrInternalOutput(-1) + 1, NI_MAX_COUNTERS, x)
1034/** For Buffered sampling of ctr -- x series capability. */ 1037/** For Buffered sampling of ctr -- x series capability. */
1035#define NI_CtrSampleClock(x) (NI_CtrOut(-1) + 1 + ((x) & NI_MAX_COUNTERS)) 1038#define NI_CtrSampleClock(x) _TERM_N(NI_CtrOut(-1) + 1, NI_MAX_COUNTERS, x)
1036#define NI_COUNTER_NAMES_MAX NI_CtrSampleClock(-1) 1039#define NI_COUNTER_NAMES_MAX NI_CtrSampleClock(-1)
1037 1040
1038enum ni_common_signal_names { 1041enum ni_common_signal_names {
1039 /* PXI_Star: this is a non-NI-specific signal */ 1042 /* PXI_Star: this is a non-NI-specific signal */
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index 2d1e0325d04d..5edf59ac6706 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -2843,7 +2843,8 @@ static int ni_ao_insn_config(struct comedi_device *dev,
2843 return ni_ao_arm(dev, s); 2843 return ni_ao_arm(dev, s);
2844 case INSN_CONFIG_GET_CMD_TIMING_CONSTRAINTS: 2844 case INSN_CONFIG_GET_CMD_TIMING_CONSTRAINTS:
2845 /* we don't care about actual channels */ 2845 /* we don't care about actual channels */
2846 data[1] = board->ao_speed; 2846 /* data[3] : chanlist_len */
2847 data[1] = board->ao_speed * data[3];
2847 data[2] = 0; 2848 data[2] = 0;
2848 return 0; 2849 return 0;
2849 default: 2850 default:
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c
index dd121f66fa2d..c912c70b3ef7 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
@@ -108,17 +108,6 @@ static int cedrus_request_validate(struct media_request *req)
108 unsigned int count; 108 unsigned int count;
109 unsigned int i; 109 unsigned int i;
110 110
111 count = vb2_request_buffer_cnt(req);
112 if (!count) {
113 v4l2_info(&ctx->dev->v4l2_dev,
114 "No buffer was provided with the request\n");
115 return -ENOENT;
116 } else if (count > 1) {
117 v4l2_info(&ctx->dev->v4l2_dev,
118 "More than one buffer was provided with the request\n");
119 return -EINVAL;
120 }
121
122 list_for_each_entry(obj, &req->objects, list) { 111 list_for_each_entry(obj, &req->objects, list) {
123 struct vb2_buffer *vb; 112 struct vb2_buffer *vb;
124 113
@@ -133,6 +122,17 @@ static int cedrus_request_validate(struct media_request *req)
133 if (!ctx) 122 if (!ctx)
134 return -ENOENT; 123 return -ENOENT;
135 124
125 count = vb2_request_buffer_cnt(req);
126 if (!count) {
127 v4l2_info(&ctx->dev->v4l2_dev,
128 "No buffer was provided with the request\n");
129 return -ENOENT;
130 } else if (count > 1) {
131 v4l2_info(&ctx->dev->v4l2_dev,
132 "More than one buffer was provided with the request\n");
133 return -EINVAL;
134 }
135
136 parent_hdl = &ctx->hdl; 136 parent_hdl = &ctx->hdl;
137 137
138 hdl = v4l2_ctrl_request_hdl_find(req, parent_hdl); 138 hdl = v4l2_ctrl_request_hdl_find(req, parent_hdl);
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 6a18cf73c85e..18936cdb1083 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -351,7 +351,7 @@ static ssize_t set_datatype_show(struct device *dev,
351 351
352 for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) { 352 for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
353 if (c->cfg.data_type & ch_data_type[i].most_ch_data_type) 353 if (c->cfg.data_type & ch_data_type[i].most_ch_data_type)
354 return snprintf(buf, PAGE_SIZE, ch_data_type[i].name); 354 return snprintf(buf, PAGE_SIZE, "%s", ch_data_type[i].name);
355 } 355 }
356 return snprintf(buf, PAGE_SIZE, "unconfigured\n"); 356 return snprintf(buf, PAGE_SIZE, "unconfigured\n");
357} 357}
diff --git a/drivers/staging/mt7621-dma/mtk-hsdma.c b/drivers/staging/mt7621-dma/mtk-hsdma.c
index df6ebf41bdea..5831f816c17b 100644
--- a/drivers/staging/mt7621-dma/mtk-hsdma.c
+++ b/drivers/staging/mt7621-dma/mtk-hsdma.c
@@ -335,6 +335,8 @@ static int mtk_hsdma_start_transfer(struct mtk_hsdam_engine *hsdma,
335 /* tx desc */ 335 /* tx desc */
336 src = sg->src_addr; 336 src = sg->src_addr;
337 for (i = 0; i < chan->desc->num_sgs; i++) { 337 for (i = 0; i < chan->desc->num_sgs; i++) {
338 tx_desc = &chan->tx_ring[chan->tx_idx];
339
338 if (len > HSDMA_MAX_PLEN) 340 if (len > HSDMA_MAX_PLEN)
339 tlen = HSDMA_MAX_PLEN; 341 tlen = HSDMA_MAX_PLEN;
340 else 342 else
@@ -344,7 +346,6 @@ static int mtk_hsdma_start_transfer(struct mtk_hsdam_engine *hsdma,
344 tx_desc->addr1 = src; 346 tx_desc->addr1 = src;
345 tx_desc->flags |= HSDMA_DESC_PLEN1(tlen); 347 tx_desc->flags |= HSDMA_DESC_PLEN1(tlen);
346 } else { 348 } else {
347 tx_desc = &chan->tx_ring[chan->tx_idx];
348 tx_desc->addr0 = src; 349 tx_desc->addr0 = src;
349 tx_desc->flags = HSDMA_DESC_PLEN0(tlen); 350 tx_desc->flags = HSDMA_DESC_PLEN0(tlen);
350 351
diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
index b8566ed898f1..aa98fbb17013 100644
--- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
+++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
@@ -82,7 +82,7 @@ static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrldev,
82 struct property *prop; 82 struct property *prop;
83 const char *function_name, *group_name; 83 const char *function_name, *group_name;
84 int ret; 84 int ret;
85 int ngroups; 85 int ngroups = 0;
86 unsigned int reserved_maps = 0; 86 unsigned int reserved_maps = 0;
87 87
88 for_each_node_with_property(np_config, "group") 88 for_each_node_with_property(np_config, "group")
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
index 85077947b9b8..85aba8a503cd 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
@@ -109,12 +109,12 @@ static void update_recvframe_phyinfo(union recv_frame *precvframe,
109 rx_bssid = get_hdr_bssid(wlanhdr); 109 rx_bssid = get_hdr_bssid(wlanhdr);
110 pkt_info.bssid_match = ((!IsFrameTypeCtrl(wlanhdr)) && 110 pkt_info.bssid_match = ((!IsFrameTypeCtrl(wlanhdr)) &&
111 !pattrib->icv_err && !pattrib->crc_err && 111 !pattrib->icv_err && !pattrib->crc_err &&
112 !ether_addr_equal(rx_bssid, my_bssid)); 112 ether_addr_equal(rx_bssid, my_bssid));
113 113
114 rx_ra = get_ra(wlanhdr); 114 rx_ra = get_ra(wlanhdr);
115 my_hwaddr = myid(&padapter->eeprompriv); 115 my_hwaddr = myid(&padapter->eeprompriv);
116 pkt_info.to_self = pkt_info.bssid_match && 116 pkt_info.to_self = pkt_info.bssid_match &&
117 !ether_addr_equal(rx_ra, my_hwaddr); 117 ether_addr_equal(rx_ra, my_hwaddr);
118 118
119 119
120 pkt_info.is_beacon = pkt_info.bssid_match && 120 pkt_info.is_beacon = pkt_info.bssid_match &&
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index af2234798fa8..db553f2e4c0b 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -1277,7 +1277,7 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy,
1277 1277
1278 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); 1278 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS);
1279 sinfo->tx_packets = psta->sta_stats.tx_pkts; 1279 sinfo->tx_packets = psta->sta_stats.tx_pkts;
1280 1280 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED);
1281 } 1281 }
1282 1282
1283 /* for Ad-Hoc/AP mode */ 1283 /* for Ad-Hoc/AP mode */
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 28bfdbdc6e76..b8631baf128d 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -2289,7 +2289,7 @@ static int rtw_wx_read32(struct net_device *dev,
2289exit: 2289exit:
2290 kfree(ptmp); 2290 kfree(ptmp);
2291 2291
2292 return 0; 2292 return ret;
2293} 2293}
2294 2294
2295static int rtw_wx_write32(struct net_device *dev, 2295static int rtw_wx_write32(struct net_device *dev,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index ea789376de0f..45de21c210c1 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1795,6 +1795,7 @@ vchiq_compat_ioctl_await_completion(struct file *file,
1795 struct vchiq_await_completion32 args32; 1795 struct vchiq_await_completion32 args32;
1796 struct vchiq_completion_data32 completion32; 1796 struct vchiq_completion_data32 completion32;
1797 unsigned int *msgbufcount32; 1797 unsigned int *msgbufcount32;
1798 unsigned int msgbufcount_native;
1798 compat_uptr_t msgbuf32; 1799 compat_uptr_t msgbuf32;
1799 void *msgbuf; 1800 void *msgbuf;
1800 void **msgbufptr; 1801 void **msgbufptr;
@@ -1906,7 +1907,11 @@ vchiq_compat_ioctl_await_completion(struct file *file,
1906 sizeof(completion32))) 1907 sizeof(completion32)))
1907 return -EFAULT; 1908 return -EFAULT;
1908 1909
1909 args32.msgbufcount--; 1910 if (get_user(msgbufcount_native, &args->msgbufcount))
1911 return -EFAULT;
1912
1913 if (!msgbufcount_native)
1914 args32.msgbufcount--;
1910 1915
1911 msgbufcount32 = 1916 msgbufcount32 =
1912 &((struct vchiq_await_completion32 __user *)arg)->msgbufcount; 1917 &((struct vchiq_await_completion32 __user *)arg)->msgbufcount;
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index 331dc377c275..dc12f5c4b076 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -177,6 +177,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
177* @attr_usage_id: Attribute usage id as per spec 177* @attr_usage_id: Attribute usage id as per spec
178* @report_id: Report id to look for 178* @report_id: Report id to look for
179* @flag: Synchronous or asynchronous read 179* @flag: Synchronous or asynchronous read
180* @is_signed: If true then fields < 32 bits will be sign-extended
180* 181*
181* Issues a synchronous or asynchronous read request for an input attribute. 182* Issues a synchronous or asynchronous read request for an input attribute.
182* Returns data upto 32 bits. 183* Returns data upto 32 bits.
@@ -190,7 +191,8 @@ enum sensor_hub_read_flags {
190int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, 191int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
191 u32 usage_id, 192 u32 usage_id,
192 u32 attr_usage_id, u32 report_id, 193 u32 attr_usage_id, u32 report_id,
193 enum sensor_hub_read_flags flag 194 enum sensor_hub_read_flags flag,
195 bool is_signed
194); 196);
195 197
196/** 198/**