- 10 5月, 2021 1 次提交
-
-
由 Colin Ian King 提交于
The lux_val returned from tsl2583_get_lux can potentially be zero, so check for this to avoid a division by zero and an overflowed gain_trim_val. Fixes clang scan-build warning: drivers/iio/light/tsl2583.c:345:40: warning: Either the condition 'lux_val<0' is redundant or there is division by zero at line 345. [zerodivcond] Fixes: ac4f6eee ("staging: iio: TAOS tsl258x: Device driver") Signed-off-by: NColin Ian King <colin.king@canonical.com> Cc: <Stable@vger.kernel.org> Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
-
- 10 1月, 2021 1 次提交
-
-
由 Lars-Peter Clausen 提交于
Use DIV_ROUND_CLOSEST() instead of open-coding it. This documents intent and makes it more clear what is going on for the casual reviewer. Generated using the following the Coccinelle semantic patch. // <smpl> @r1@ expression x; constant C1; constant C2; @@ ((x) + C1) / C2 @script:python@ C1 << r1.C1; C2 << r1.C2; @@ try: if int(C1) * 2 != int(C2): cocci.include_match(False) except: cocci.include_match(False) @@ expression r1.x; constant r1.C1; constant r1.C2; @@ -(((x) + C1) / C2) +DIV_ROUND_CLOSEST(x, C2) // </smpl> Signed-off-by: NLars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20201227171126.28216-3-lars@metafoo.deSigned-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
-
- 14 6月, 2020 1 次提交
-
-
由 Alexandru Ardelean 提交于
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: NAlexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
-
- 31 5月, 2019 1 次提交
-
-
由 Thomas Gleixner 提交于
Based on 3 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that 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 this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] this program is distributed in the hope that 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 this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version [author] [graeme] [gregory] [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema] [hk] [hemahk]@[ti] [com] this program is distributed in the hope that 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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1105 file(s). Signed-off-by: NThomas Gleixner <tglx@linutronix.de> Reviewed-by: NAllison Randal <allison@lohutok.net> Reviewed-by: NRichard Fontana <rfontana@redhat.com> Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 20 5月, 2018 1 次提交
-
-
由 Brian Masney 提交于
The times reported by the in_illuminance_integration_time_available sysfs attribute are actually in milliseconds, not microseconds. This patch corrects the times with the correct unit. The fixes tag is inaccurate as the issue existed when the driver was still in staging. However, lots of changes occured before it graduated so this is as a good a point as any for backports. Signed-off-by: NBrian Masney <masneyb@onstation.org> Fixes: f44d5c8a ("staging: iio: tsl2583: move out of staging") Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
-
- 23 8月, 2017 1 次提交
-
-
由 Jonathan Cameron 提交于
The equivalent of both of these are now done via macro magic when the relevant register calls are made. The actual structure elements will shortly go away. Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: NLars-Peter Clausen <lars@metafoo.de>
-
- 20 8月, 2017 1 次提交
-
-
由 Arvind Yadav 提交于
i2c_device_id are not supposed to change at runtime. All functions working with i2c_device_id provided by <linux/i2c.h> work with const i2c_device_id. So mark the non-const structs as const. Signed-off-by: NArvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
-
- 17 5月, 2017 1 次提交
-
-
由 Brian Masney 提交于
This patch adds runtime power management support to the tsl2583 driver. The device is powered off after two seconds of inactivity. Verified that the driver still functions correctly using a TSL2581 hooked up to a Raspberry Pi 2. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
- 25 11月, 2016 1 次提交
-
-
由 Dan Carpenter 提交于
This array is supposed to have 10 elements. Smatch complains that with the current code we can have n == max_ints and read beyond the end of the array. Fixes: ac4f6eee ("staging: iio: TAOS tsl258x: Device driver") Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com> Acked-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
- 13 11月, 2016 27 次提交
-
-
由 Brian Masney 提交于
Move tsl2580, tsl2581, tsl2583 driver out of staging into mainline. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
Add Brian Masney's copyright to the header and to the MODULE_AUTHOR for all of the staging cleanups that has been done to this driver. The original MODULE_AUTHOR() did not have a space between his name and email address. This patch also adds the missing space. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
The ret variable in tsl2583_suspend() and tsl2583_resume() was initialized to 0. This is not necessary so this patch removes the initialization. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
The entries in the lux table (als_device_lux) can be updated via sysfs through the function in_illuminance_lux_table_store(). The last row in the table must be terminated with values that are zero. The sysfs code already ensures that the last row is all zeros. The call to memset to clear out the table is not needed so this patch removes the unnecessary call. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
The comment for tsl2583_probe() does not provide any useful value. This patch removes the comment. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
The comment that describes the code that clears the interrupt bit was vague and didn't provide much value. This patch adds more detail about why that bit needs to be cleared. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
The header only listed the tsl2580 and tsl2581 devices as supported by this driver. This patch adds the tsl2583 since it is also supported by this driver. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
The driver contains a global lux table that can be updated via sysfs. Change this to a per device lux table so that multiple devices can be hooked up to the same system with different lux tables. There are 10 entries, plus 1 for the termination segment, set aside for the entries in the lux table. When updating the lux table via sysfs, only 9 entries, plus the terminator, could be added. This changes the code to allow for the 10 entries, plus the terminator. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
in_illuminance_lux_table_store assumes that an unsigned int is 32 bits. Replace this with sizeof(value[1]). Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
in_illuminance_lux_table_store() contains some unnecessary parentheses. This patch removes them since they provide no value. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
tsl2583_als_calibrate() returns the newly computed gain_trim if the calibration was successful. This function is only called by in_illuminance_calibrate_store() and the return value inside that sysfs attribute is only checked to see if an error was returned. This patch changes tsl2583_als_calibrate() to return 0 on success. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
The check for ch1lux > ch0lux inside tsl2583_get_lux is only valid if the ratio is not equal to zero. Move the code block inside the else statement. This does away with the need to initialize the variables to zero. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
If channel 0 does not have any data, then the code sets the lux to zero. The corresponding comment says that the last value is returned. This updates the comment to correctly reflect what the code does. It also clarifies the comment about why 0 is returned. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
The definition of the tsl2583_device_lux struct has a series of single line comments. There are two other cases where the multiline comments did not have an initial blank line. Change these comments to use the proper multiline syntax. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
Add and remove newlines to improve code readability in preparation for moving the driver out of staging. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
Fixed warning found by make W=2: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
Most of the values in the #defines have their values aligned on a single column, but some do not. This changes the remaining defines to use consistent alignment with the majority to improve code readability. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
Some functions and variables were prefixed with either taos, tsl258x, taos2583, or tsl2583. Change everything to use the tsl2583 prefix since that is the name of the .c file. The taos_settings member inside the taos_settings struct was renamed to als_settings. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
There are several places in the code where the function name is hardcoded in the log message. Use the __func__ constant string to build the log message. This also clarifies some of the error messages to match the code and ensures that the correct priority is used since the message is already being changed. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
Address warning from checkpatch: CHECK: Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
taos_probe() calls i2c_smbus_write_byte() to select the control register, however there are no subsequent calls to i2c_smbus_read_byte(). The write call is unnecessary and is removed by this patch. Verified that the driver still functions correctly using a TSL2581 hooked up to a Raspberry Pi 2. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
The current chip state is represented as a tristate (working, suspended, and unknown). The unknown state was not used. This patch changes the chip state so that it is now represented as a single boolean value (suspended). Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
The device probing and the suspend/resume code checks a flag internal to the driver that determines whether or not the chip is in a working state. These checks are not needed. This patch removes the unnecessary checks. It will do no harm to the hardware if the chip is reinitialized if it is already powered on. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
taos_get_lux checks to see if the chip is in a working state. This check is not necessary since it is only called from tsl2583_read_raw and in_illuminance_calibrate_store (via taos_als_calibrate). The chip state is already checked by these functions. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
in_illuminance_calibrate_store() did not check to see if the chip is in a working state. This patch adds the proper check. The return value from taos_als_calibrate() was also not checked in this function, so the proper check was also added while changes are being made here. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
When updating the in_illuminance_calibscale and in_illuminance_integration_time sysfs attributes, these values were not actually written to the chip. The chip would continue to use the old parameters. Extracted out tsl2583_set_als_gain() and tsl2583_set_als_time() functions that are now called when these sysfs attributes are updated. The chip initialization also calls these these new functions. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
taos_chip_on() reads an eight member array called taos_config that contains the desired state of the chip's registers. Only four of the registers actually need to be written to. The four that do not need to be written to are for the {low,high} byte of the lower interrupt threshold and the {low,high} byte of the upper interrupt threshold. Interrupts are currently not supported by this driver so there is no need to write to these registers. This patch removes the taos_config array and separates out the i2c calls that write to the CONTROL, TIMING, INTERRUPT and ANALOG registers. This is part of a larger refactor that was split up to make the code review easier. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
- 09 11月, 2016 1 次提交
-
-
由 Arnd Bergmann 提交于
Removing a call to the taos_chip_off() makes it unused when CONFIG_PM is disabled: drivers/staging/iio/light/tsl2583.c:438:12: error: ‘taos_chip_off’ defined but not used [-Werror=unused-function] This removes all the #ifdef in this file, and marks the PM functions as __maybe_unused instead, which is more reliable and gives us better compile time coverage. Fixes: 0561155f ("staging: iio: tsl2583: don't shutdown chip when updating the lux table") Signed-off-by: NArnd Bergmann <arnd@arndb.de> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
- 06 11月, 2016 3 次提交
-
-
由 Brian Masney 提交于
taos_als_calibrate() queries the control register to determine if the unit is powered on and has the ADC enabled. It then queries the same register a second time to determine if the ADC reading is valid. This patch removes the redundant i2c_smbus_read_byte_data() call. Verified that the driver still functions correctly using a TSL2581 hooked up to a Raspberry Pi 2. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
in_illuminance_lux_table_store() shuts down the chip, updates the contents of the lux table, and then turns the chip back on. The values in lux table are not used by the chip and are only used internally by the driver. It is not necessary to change the power state on the chip. This patch removes the calls to taos_chip_off() and taos_chip_on() in in_illuminance_lux_table_store(). Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-
由 Brian Masney 提交于
taos_chip_on() explicitly turns the sensor power on and then writes the 8 registers that are stored in taos_config. The first register in taos_config is the CONTROL register and the configuration is set to turn the power off. The existing state sequence in taos_chip_on() is: - Turn device power on - Turn device power off (via taos_config) - Configure other 7 registers (via taos_config) - Turn device power on, enable ADC This patch changes the code so that the device is not powered off via taos_config. Verified that the driver still functions correctly using a TSL2581 hooked up to a Raspberry Pi 2. Signed-off-by: NBrian Masney <masneyb@onstation.org> Signed-off-by: NJonathan Cameron <jic23@kernel.org>
-