mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Vaittinen, Matti" <Matti.Vaittinen@fi.rohmeurope.com>
To: Mark Brown <broonie@kernel.org>
Cc: Matti Vaittinen <mazziesaccount@gmail.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	linux-power <linux-power@fi.rohmeurope.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/5] regulator: irq_helpers: Allow omitting map_event for simple IRQs
Date: Thu, 18 Nov 2021 15:14:02 +0000	[thread overview]
Message-ID: <f5a5cd1c-763b-4dc1-e40a-dafbc47a1eaf@fi.rohmeurope.com> (raw)
In-Reply-To: <YZZWh1aIg7TAdOUX@sirena.org.uk>

Hi Mark,

Thanks for the review :)

On 11/18/21 15:35, Mark Brown wrote:
> 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.

Hmm. Right, thanks. I can put that in the same place where other bit() 
operations are - let's see what the reception is :)

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

So, do you suggest that we export the map_event_simple() as a helper 
which drivers can provide to irq_helpers? If yes, do you think we should 
leave out the sanity check regarding the conditions (only one common 
error and only one rdev)? Or should we compare the given map function to 
the adress of the map_event_simple() and perform checks if it matches? 
It looks a bit strange to me. Or did you have some other vision?

Best Regards
     Matti Vaittinen


-- 
The Linux Kernel guy at ROHM Semiconductors

Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~ this year is the year of a signature writers block ~~

  reply	other threads:[~2021-11-18 15:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 11:47 [PATCH 0/5] Few miscellaneous regulator improvements Matti Vaittinen
2021-11-18 11:48 ` [PATCH 1/5] regulator: irq_helpers: Allow omitting map_event for simple IRQs Matti Vaittinen
2021-11-18 13:35   ` Mark Brown
2021-11-18 15:14     ` Vaittinen, Matti [this message]
2021-11-18 15:20       ` Mark Brown
2021-11-18 15:31         ` Vaittinen, Matti
2021-11-18 11:48 ` [PATCH 2/5] regulator: rohm-regulator: add helper for restricted voltage setting Matti Vaittinen
2021-11-18 11:49 ` [PATCH 3/5] regulator: bd718x7: Use rohm generic " Matti Vaittinen
2021-11-18 11:49 ` [PATCH 4/5] regulator: Add units to limit documentation Matti Vaittinen
2021-11-18 11:49 ` [PATCH 5/5] regulator: Update protection IRQ helper docs Matti Vaittinen
2021-11-18 19:06 ` (subset) [PATCH 0/5] Few miscellaneous regulator improvements Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f5a5cd1c-763b-4dc1-e40a-dafbc47a1eaf@fi.rohmeurope.com \
    --to=matti.vaittinen@fi.rohmeurope.com \
    --cc=broonie@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-power@fi.rohmeurope.com \
    --cc=mazziesaccount@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®