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]
Message-ID: <20121023171837.GE4477@opensource.wolfsonmicro.com>
Date:	Tue, 23 Oct 2012 18:18:38 +0100
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	ciminaghi@...dd.com
Cc:	sameo@...ux.intel.com, rubini@...dd.com, giancarlo.asnaghi@...com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 02/10] drivers/mfd/sta2x11-mfd: add regmap support

On Mon, Oct 22, 2012 at 04:50:33PM +0200, ciminaghi@...dd.com wrote:

> +static bool sta2x11_sctl_writeable_reg(struct device *dev, unsigned int reg)
> +{
> +	return !__reg_within_range(reg, SCTL_SCPCIECSBRST, SCTL_SCRSTSTA);
> +}

This and most of your other readable/writable things look like a
framework feature waiting to be written - something data driven which
takes a table of register ranges and goes and does the
__reg_within_range() check on them.  Seems like it'd be really useful
for devices like this.

> +static bool sta2x11_apb_soc_regs_writeable_reg(struct device *dev,
> +					       unsigned int reg)
> +{
> +	if (!sta2x11_apb_soc_regs_readable_reg(dev, reg))
> +		return false;
> +	return (!__reg_within_range(reg, PCIE_PM_STATUS_0_PORT_0_4,
> +				    PCIE_PM_STATUS_7_0_EP4) &&
> +		reg != PCIE_COMMON_CLOCK_CONFIG_0_4_0 &&
> +		!__reg_within_range(reg, PCIE_SoC_INT_ROUTER_STATUS0_REG,
> +				    PCIE_SoC_INT_ROUTER_STATUS3_REG) &&
> +		reg != SYSTEM_CONFIG_STATUS_REG &&
> +		reg != COMPENSATION_REG1);

For this I'd write a switch statement with the range checks in the
default: case.  Actually you could just use the GCC switch range
feature:

	case PCIE_PM_STATUS_0_PORT_0_4..PCIE_PM_STATUS_7_0_EP4:

Either of these would increase readability.

but generally

Reviewed-by: Mark Brown <broonie@...nsource.wolfsonmicro.com>

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