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:	Tue, 31 Mar 2015 21:07:30 -0700
From:	Joe Perches <joe@...ches.com>
To:	Ingi Kim <ingi2.kim@...sung.com>
Cc:	cooloney@...il.com, rpurdie@...ys.net, robh+dt@...nel.org,
	pawel.moll@....com, mark.rutland@....com,
	ijc+devicetree@...lion.org.uk, galak@...eaurora.org,
	sakari.ailus@....fi, j.anaszewski@...sung.com,
	varkabhadram@...il.com, sw0312.kim@...sung.com,
	cw00.choi@...sung.com, jh80.chung@...sung.com,
	ideal.song@...sung.com, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-leds@...r.kernel.org
Subject: Re: [PATCH v5 3/3] leds: Add ktd2692 flash LED driver

On Wed, 2015-04-01 at 12:58 +0900, Ingi Kim wrote:
> This patch adds a driver to support the ktd2692 flash LEDs.
> ktd2692 can control flash current by ExpressWire interface.

trivia:

> diff --git a/drivers/leds/leds-ktd2692.c b/drivers/leds/leds-ktd2692.c
[]
> +static void ktd2692_brightness_set(struct ktd2692_context *led,
> +					enum led_brightness brightness)
> +{
> +	mutex_lock(&led->lock);
> +
> +	if (brightness == LED_OFF) {
> +		led->mode = KTD2692_MODE_DISABLE;
> +		gpio_set_value(led->aux_gpio, KTD2692_LOW);
> +		goto out;
> +	}
> +
> +	ktd2692_expresswire_write(led, KTD2692_REG_MOVIE_CURRENT_BASE |
> +				KTD2692_BRIGHTNESS_RANGE_255_TO_8(brightness));
> +	led->mode = KTD2692_MODE_MOVIE;
> +
> +out:
> +	ktd2692_expresswire_write(led, led->mode | KTD2692_REG_MODE_BASE);
> +	mutex_unlock(&led->lock);
> +}

Perhaps this function would be better with if/else
without the out: label

> +static int ktd2692_led_flash_strobe_set(struct led_classdev_flash *fled_cdev,
> +						bool state)
> +{
> +	struct ktd2692_context *led = fled_cdev_to_led(fled_cdev);
> +	struct led_flash_setting *timeout = &fled_cdev->timeout;
> +	u32 flash_tm_reg;
> +
> +	mutex_lock(&led->lock);
> +
> +	if (state == 0) {
> +		led->mode = KTD2692_MODE_DISABLE;
> +		gpio_set_value(led->aux_gpio, KTD2692_LOW);
> +		goto done;
> +	}
> +
> +	flash_tm_reg = GET_TIMEOUT_OFFSET(timeout->val, timeout->step);
> +	ktd2692_expresswire_write(led, flash_tm_reg
> +			| KTD2692_REG_FLASH_TIMEOUT_BASE);
> +
> +	led->mode = KTD2692_MODE_FLASH;
> +	gpio_set_value(led->aux_gpio, KTD2692_HIGH);
> +
> +done:
> +	ktd2692_expresswire_write(led, led->mode | KTD2692_REG_MODE_BASE);

Same if/else with the done: label?


--
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