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: <20201120131708.GD6751@sirena.org.uk>
Date:   Fri, 20 Nov 2020 13:17:08 +0000
From:   Mark Brown <broonie@...nel.org>
To:     Adam Ward <adam.ward@...semi.com>
Cc:     Rob Herring <robh+dt@...nel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Vincent Whitchurch <vincent.whitchurch@...s.com>,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH 7/9] regulator: da9121: add current support

On Fri, Nov 20, 2020 at 12:14:57PM +0000, Adam Ward wrote:

> +static bool da9121_rdev_to_buck_reg_mask(struct regulator_dev *rdev, bool mode,
> +					 unsigned int *reg, unsigned int *msk)
> +{
> +	struct da9121 *chip = rdev_get_drvdata(rdev);
> +	int id = rdev_get_id(rdev);
> +
> +	switch (id) {
> +	case DA9121_IDX_BUCK1:
> +		if (mode) {
> +			*reg = DA9121_REG_BUCK_BUCK1_4;
> +			*msk = DA9121_MASK_BUCK_BUCKx_4_CHx_A_MODE;
> +		} else {
> +			*reg = DA9121_REG_BUCK_BUCK1_2;
> +			*msk = DA9121_MASK_BUCK_BUCKx_2_CHx_ILIM;
> +		}
> +		break;

This is really not an easy interface to understand, the boolean flag
saying which register set to pick is not particularly obvious to read
and won't scale.  The usual pattern with things like this is to store
information in driver data at probe time.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ