linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	David Laight <David.Laight@aculab.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [RFT PATCH v2 7/8] gpio: exar: switch to using regmap
Date: Thu, 5 Nov 2020 17:40:57 +0000	[thread overview]
Message-ID: <20201105174057.GG4856@sirena.org.uk> (raw)
In-Reply-To: <20201104193051.32236-8-brgl@bgdev.pl>

[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]

On Wed, Nov 04, 2020 at 08:30:50PM +0100, Bartosz Golaszewski wrote:

> @@ -119,21 +81,39 @@ static void exar_set_value(struct gpio_chip *chip, unsigned int offset,
>  	unsigned int addr = exar_offset_to_lvl_addr(exar_gpio, offset);
>  	unsigned int bit = exar_offset_to_bit(exar_gpio, offset);
>  
> -	exar_update(chip, addr, value, bit);
> +	regmap_assign_bits(exar_gpio->regs, addr, BIT(bit), value);
>  }

This appears to be the use of _assign_bits() and TBH I'm still both
having a hard time understanding the motivation for it and liking the
name, especially since AFAICT it's only setting a single bit here.  The
above is just

	regmap_update_bits(exar_gpio->regs, addr, 1 << bit, value << bit);

AFAICT (and indeed now I dig around assign_bit() only works on a single
bit and does both shifts which makes the correspondance with that
interface super unclear, we're not mirroring that interface here).  If
you're trying to clone the bitops function it should probably be an
actual clone of the bitops function not something different, that would
be clearer and it'd be easier to understand why someone would want the
API in the first place.  But perhaps I'm missing something here?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2020-11-05 17:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 19:30 [PATCH v2 0/8] gpio: exar: refactor the driver Bartosz Golaszewski
2020-11-04 19:30 ` [PATCH v2 1/8] regmap: provide regmap_assign_bits() Bartosz Golaszewski
2020-11-04 19:30 ` [PATCH v2 2/8] gpio: exar: add a newline after the copyright notice Bartosz Golaszewski
2020-11-04 19:30 ` [PATCH v2 3/8] gpio: exar: include idr.h Bartosz Golaszewski
2020-11-04 19:30 ` [PATCH v2 4/8] gpio: exar: switch to a simpler IDA interface Bartosz Golaszewski
2020-11-04 19:30 ` [PATCH v2 5/8] gpio: exar: use a helper variable for &pdev->dev Bartosz Golaszewski
2020-11-04 19:30 ` [RFT PATCH v2 6/8] gpio: exar: unduplicate address and offset computation Bartosz Golaszewski
2020-11-04 19:30 ` [RFT PATCH v2 7/8] gpio: exar: switch to using regmap Bartosz Golaszewski
2020-11-04 20:35   ` Andy Shevchenko
2020-11-05  8:56     ` Bartosz Golaszewski
2020-11-05 17:40   ` Mark Brown [this message]
2020-11-06 11:13     ` Bartosz Golaszewski
2020-11-06 12:17       ` Mark Brown
2020-11-04 19:30 ` [PATCH v2 8/8] gpio: exar: use devm action for freeing the IDA and drop remove() Bartosz Golaszewski
2020-11-04 20:36 ` [PATCH v2 0/8] gpio: exar: refactor the driver Andy Shevchenko

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=20201105174057.GG4856@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=David.Laight@aculab.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=brgl@bgdev.pl \
    --cc=jan.kiszka@siemens.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).