lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 12 Jan 2015 09:52:37 +0100
From:	Jacek Anaszewski <j.anaszewski@...sung.com>
To:	Pavel Machek <pavel@....cz>
Cc:	linux-leds@...r.kernel.org, linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
	kyungmin.park@...sung.com, b.zolnierkie@...sung.com,
	cooloney@...il.com, rpurdie@...ys.net, sakari.ailus@....fi,
	s.nawrocki@...sung.com, Andrzej Hajda <a.hajda@...sung.com>,
	Lee Jones <lee.jones@...aro.org>,
	Chanwoo Choi <cw00.choi@...sung.com>
Subject: Re: [PATCH/RFC v10 08/19] leds: Add support for max77693 mfd flash cell

Hi Pavel,

Thanks for the review.

On 01/09/2015 07:46 PM, Pavel Machek wrote:
> On Fri 2015-01-09 16:22:58, Jacek Anaszewski wrote:
>> This patch adds led-flash support to Maxim max77693 chipset.
>> A device can be exposed to user space through LED subsystem
>> sysfs interface. Device supports up to two leds which can
>> work in flash and torch mode. The leds can be triggered
>> externally or by software.
>>
>
>> +struct max77693_sub_led {
>> +	/* related FLED output identifier */
>
> ->flash LED, about 4x.
>
>> +/* split composite current @i into two @iout according to @imax weights */
>> +static void __max77693_calc_iout(u32 iout[2], u32 i, u32 imax[2])
>> +{
>> +	u64 t = i;
>> +
>> +	t *= imax[1];
>> +	do_div(t, imax[0] + imax[1]);
>> +
>> +	iout[1] = (u32)t / FLASH_IOUT_STEP * FLASH_IOUT_STEP;
>> +	iout[0] = i - iout[1];
>> +}
>
> Is 64-bit arithmetics neccessary here? Could we do the FLASH_IOUT_STEP
> divisons before t *=, so that 64-bit division is not neccessary?

It is required. All these operations allow for splitting the composite
current into both outputs according to weights given in the imax array.

>> +static int max77693_led_flash_strobe_get(
>> +				struct led_classdev_flash *fled_cdev,
>> +				bool *state)
>> +{
>> +	struct max77693_sub_led *sub_led = flcdev_to_sub_led(fled_cdev);
>> +	struct max77693_led_device *led = sub_led_to_led(sub_led);
>> +	int ret;
>> +
>> +	if (!state)
>> +		return -EINVAL;
>> +
>> +	mutex_lock(&led->lock);
>> +
>> +	ret = max77693_strobe_status_get(led, state);
>> +
>> +	*state = !!(*state && (led->strobing_sub_led_id == sub_led->fled_id));
>> +
>> +
>> +	mutex_unlock(&led->lock);
>> +
>> +	return ret;
>> +}
>
> Maybe remove some empty lines?
>

Of course.

-- 
Best Regards,
Jacek Anaszewski
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ