History log of /linux-master/drivers/iio/temperature/hid-sensor-temperature.c
Revision Date Author Comments
# f5589173 19-Sep-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

iio: temperature: hid-sensor: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230919174931.1417681-48-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# fb226ae7 08-Jun-2021 Jonathan Cameron <Jonathan.Cameron@huawei.com>

iio: hid-sensors: Update header includes

General driver churn doesn't always include updates of header includes.
Manual review of the output of the include-what-you-use checker lead to the
following cleanup. Hopefuly this brings things back to a good state for the
hid-sensor drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20210608205510.4033887-1-jic23@kernel.org


# 12f13d1f 14-Jun-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

iio: hid-sensors: lighten exported symbols by moving to IIO_HID namespace

A namespace for exported symbols makes clear who is a provider
and who is a consumer of the certain resources. Besides that,
it doesn't pollute the common namespace.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20210614162447.5392-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 0e41fd51 31-Jan-2021 Ye Xiang <xiang.ye@intel.com>

iio: hid-sensors: Move get sensitivity attribute to hid-sensor-common

No functional change has been made with this patch. The main intent here
is to reduce code repetition of getting sensitivity attribute.

In the current implementation, sensor_hub_input_get_attribute_info() is
called from multiple drivers to get attribute info for sensitivity
field. Moving this to common place will avoid code repetition.

Signed-off-by: Ye Xiang <xiang.ye@intel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210201054921.18214-2-xiang.ye@intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 141e7633 02-Mar-2021 Ye Xiang <xiang.ye@intel.com>

iio: hid-sensor-temperature: Fix issues of timestamp channel

This patch fixes 2 issues of timestamp channel:
1. This patch ensures that there is sufficient space and correct
alignment for the timestamp.
2. Correct the timestamp channel scan index.

Fixes: 59d0f2da3569 ("iio: hid: Add temperature sensor support")
Signed-off-by: Ye Xiang <xiang.ye@intel.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210303063615.12130-4-xiang.ye@intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# d3be8324 22-May-2020 Alexandru Ardelean <alexandru.ardelean@analog.com>

iio: remove explicit IIO device parent assignment

This patch applies the semantic patch:
@@
expression I, P, SP;
@@
I = devm_iio_device_alloc(P, SP);
...
- I->dev.parent = P;

It updates 302 files and does 307 deletions.
This semantic patch also removes some comments like
'/* Establish that the iio_dev is a child of the i2c device */'

But this is is only done in case where the block is left empty.

The patch does not seem to cover all cases. It looks like in some cases a
different variable is used in some cases to assign the parent, but it
points to the same reference.
In other cases, the block covered by ... may be just too big to be covered
by the semantic patch.

However, this looks pretty good as well, as it does cover a big bulk of the
drivers that should remove the parent assignment.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 067fda1c 23-Apr-2020 Alexandru Ardelean <alexandru.ardelean@analog.com>

iio: hid-sensors: move triggered buffer setup into hid_sensor_setup_trigger

The main intent here is to get rid of the iio_buffer_set_attrs() helper, or
at least rework it's usage a bit.
The problem with that helper is that it needs a pointer to the buffer,
which makes supporting multiple buffers per IIO device a bit more
cumbersome.

The hid_sensor_setup_trigger() is pretty much used in the same way:
- iio_triggered_buffer_setup() gets called before
- then hid_sensor_setup_trigger() and hid_sensor_setup_batch_mode() gets
called which may attach some fifo attributes

This change merges the 2 together under the hid_sensor_setup_trigger()
function. Only the &iio_pollfunc_store_time is passed to all devices, so
it's not even required to pass it explicitly outside of the common
hid_sensor_setup_trigger() function.

Moving the devm_iio_triggered_buffer_setup/cleanup() calls into the common
place code can help the rework of the buffer code, since it is in one
place.

One detail of the change is that there are 2 drivers that use
devm_iio_triggered_buffer_setup(). That function gets implicitly
replaced with iio_triggered_buffer_setup()/cleanup(), but since all drivers
call both hid_sensor_setup_trigger9) & hid_sensor_remove_trigger() trigger,
the iio_triggered_buffer_cleanup() piggy backs on the
hid_sensor_remove_trigger() call, which should cover the cleanup.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# f6cc69f1 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 309

Based on 2 normalized pattern(s):

it and or modify it under the terms of the gnu general public
license version 2 as published by the free software foundation this
program is distributed in the hope it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details you should have received a copy of the gnu general
public license along with this program

this program is free software you can redistribute it and or modify
it under the terms and conditions of the gnu general public license
version 2 as published by the free software foundation this program
is distributed in the hope it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details you should have received a copy of the gnu general
public license along with this program

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 11 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190530000434.249870634@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0145b505 31-Oct-2018 Hans de Goede <hdegoede@redhat.com>

iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers

Before this commit sensor_hub_input_attr_get_raw_value() failed to take
the signedness of 16 and 8 bit values into account, returning e.g.
65436 instead of -100 for the z-axis reading of an accelerometer.

This commit adds a new is_signed parameter to the function and makes all
callers pass the appropriate value for this.

While at it, this commit also fixes up some neighboring lines where
statements were needlessly split over 2 lines to improve readability.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 5e42916a 23-Jul-2017 Jonathan Cameron <jic23@kernel.org>

iio:temperature: drop assignment of iio_info.driver_module

The equivalent of this is now done via macro magic when
the relevant register call is made. The actual structure
elements will shortly go away.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>


# 59d0f2da 03-Mar-2017 Song Hongyan <hongyan.song@intel.com>

iio: hid: Add temperature sensor support

Environmental temperature sensor is a hid defined sensor,
it measures temperature.

More information can be found in:
http://www.usb.org/developers/hidpage/HUTRR39b.pdf

According to IIO ABI definition, IIO_TEMP data output unit is
milli degrees Celsius. Add the unit convert from degree to milli degree.

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>