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:   Thu, 18 Nov 2021 13:35:03 +0000
From:   Mark Brown <broonie@...nel.org>
To:     Matti Vaittinen <matti.vaittinen@...rohmeurope.com>
Cc:     Matti Vaittinen <mazziesaccount@...il.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Lee Jones <lee.jones@...aro.org>,
        linux-power@...rohmeurope.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/5] regulator: irq_helpers: Allow omitting map_event for
 simple IRQs

On Thu, Nov 18, 2021 at 01:48:26PM +0200, Matti Vaittinen wrote:

> +static bool single_bit_set(int val, int bits_to_check)
> +{
> +	int bit;
> +	const unsigned long bits = val;
> +
> +	bit = find_first_bit(&bits, bits_to_check);
> +	if (bit == bits_to_check)
> +		return false;
> +
> +	bit = find_next_bit(&bits, bits_to_check, bit + 1);
> +
> +	return (bit == bits_to_check);
> +}

The namespacing here feels like it should be with the other _bit()
helpers rather than private to the regulator code, I can certainly see
other things wanting to use it.

> +	if (!h->desc.map_event) {
> +		if (rdev_amount != 1 ||
> +		    !single_bit_set(common_errs, sizeof(common_errs) * 8) ||
> +		    per_rdev_errs)
> +			return ERR_PTR(-EINVAL);
> +
> +		h->desc.map_event = map_event_simple;
> +	}

This isn't the usual pattern, normally we would have the driver assign
the helper operation.  We can always still do the check based on finding
the expected map_event set up.

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