diff options
Diffstat (limited to 'drivers/iio/light/hid-sensor-prox.c')
-rw-r--r-- | drivers/iio/light/hid-sensor-prox.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c index 91ecc46ffeaa..ef60bae738e3 100644 --- a/drivers/iio/light/hid-sensor-prox.c +++ b/drivers/iio/light/hid-sensor-prox.c | |||
@@ -43,8 +43,6 @@ struct prox_state { | |||
43 | static const struct iio_chan_spec prox_channels[] = { | 43 | static const struct iio_chan_spec prox_channels[] = { |
44 | { | 44 | { |
45 | .type = IIO_PROXIMITY, | 45 | .type = IIO_PROXIMITY, |
46 | .modified = 1, | ||
47 | .channel2 = IIO_NO_MOD, | ||
48 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | 46 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
49 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | | 47 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | |
50 | BIT(IIO_CHAN_INFO_SCALE) | | 48 | BIT(IIO_CHAN_INFO_SCALE) | |
@@ -253,7 +251,6 @@ static int hid_prox_probe(struct platform_device *pdev) | |||
253 | struct iio_dev *indio_dev; | 251 | struct iio_dev *indio_dev; |
254 | struct prox_state *prox_state; | 252 | struct prox_state *prox_state; |
255 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; | 253 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; |
256 | struct iio_chan_spec *channels; | ||
257 | 254 | ||
258 | indio_dev = devm_iio_device_alloc(&pdev->dev, | 255 | indio_dev = devm_iio_device_alloc(&pdev->dev, |
259 | sizeof(struct prox_state)); | 256 | sizeof(struct prox_state)); |
@@ -272,20 +269,21 @@ static int hid_prox_probe(struct platform_device *pdev) | |||
272 | return ret; | 269 | return ret; |
273 | } | 270 | } |
274 | 271 | ||
275 | channels = kmemdup(prox_channels, sizeof(prox_channels), GFP_KERNEL); | 272 | indio_dev->channels = kmemdup(prox_channels, sizeof(prox_channels), |
276 | if (!channels) { | 273 | GFP_KERNEL); |
274 | if (!indio_dev->channels) { | ||
277 | dev_err(&pdev->dev, "failed to duplicate channels\n"); | 275 | dev_err(&pdev->dev, "failed to duplicate channels\n"); |
278 | return -ENOMEM; | 276 | return -ENOMEM; |
279 | } | 277 | } |
280 | 278 | ||
281 | ret = prox_parse_report(pdev, hsdev, channels, | 279 | ret = prox_parse_report(pdev, hsdev, |
280 | (struct iio_chan_spec *)indio_dev->channels, | ||
282 | HID_USAGE_SENSOR_PROX, prox_state); | 281 | HID_USAGE_SENSOR_PROX, prox_state); |
283 | if (ret) { | 282 | if (ret) { |
284 | dev_err(&pdev->dev, "failed to setup attributes\n"); | 283 | dev_err(&pdev->dev, "failed to setup attributes\n"); |
285 | goto error_free_dev_mem; | 284 | goto error_free_dev_mem; |
286 | } | 285 | } |
287 | 286 | ||
288 | indio_dev->channels = channels; | ||
289 | indio_dev->num_channels = | 287 | indio_dev->num_channels = |
290 | ARRAY_SIZE(prox_channels); | 288 | ARRAY_SIZE(prox_channels); |
291 | indio_dev->dev.parent = &pdev->dev; | 289 | indio_dev->dev.parent = &pdev->dev; |