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, 5 Nov 2012 11:42:47 +0100
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	Laxman Dewangan <ldewangan@...dia.com>
Cc:	sameo@...ux.intel.com, lrg@...com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] regulator: tps80031: add regulator driver for
 tps80031

On Mon, Nov 05, 2012 at 03:14:18PM +0530, Laxman Dewangan wrote:

> +	switch (ri->device_flags) {
> +	case 0:

Should we be using different versions of the ops depending on the device
flags rather than having these switches?  It seems like we can't change
at runtime and it would make the code a lot simpler.

> +		if (sel < 57)
> +			voltage = 607700 + 12660 * sel;
> +		else if (sel == 57)
> +			voltage = 1350 * 1000;
> +		else if (sel == 58)
> +			voltage = 1500 * 1000;
> +		else if (sel == 59)
> +			voltage = 1800 * 1000;
> +		else if (sel == 60)
> +			voltage = 1900 * 1000;
> +		else if (sel == 61)
> +			voltage = 2100 * 1000;

This looks like a switch statement with a default case (as do most of
these).

> +	ret = tps80031_write(parent, ri->rinfo->volt_id,
> +			ri->rinfo->volt_reg, sel + 1);

Why the + 1 (and - 1 in the get()).  I'd expect we can just use the
register value directly as a selector.

> +	if (!(ri->config_flags & VBUS_SW_ONLY)) {
> +		dev_err(&rdev->dev, "%s() is not supported with flag 0x%08x\n",
> +			 __func__, ri->config_flags);
> +		return -EIO;
> +	}

Same as the device flags above - we should this be set by changing the
ops when we register?

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ