From: Bartosz Golaszewski <brgl@bgdev.pl>
To: 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>,
Mark Brown <broonie@kernel.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: [PATCH v2 1/8] regmap: provide regmap_assign_bits()
Date: Wed, 4 Nov 2020 20:30:44 +0100 [thread overview]
Message-ID: <20201104193051.32236-2-brgl@bgdev.pl> (raw)
In-Reply-To: <20201104193051.32236-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Add another bits helper to regmap API: this one sets given bits if value
is true and clears them if it's false.
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
include/linux/regmap.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index e7834d98207f..62099e7a3ed6 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -1148,6 +1148,15 @@ static inline int regmap_clear_bits(struct regmap *map,
return regmap_update_bits_base(map, reg, bits, 0, NULL, false, false);
}
+static inline int regmap_assign_bits(struct regmap *map, unsigned int reg,
+ unsigned int bits, bool value)
+{
+ if (value)
+ return regmap_set_bits(map, reg, bits);
+ else
+ return regmap_clear_bits(map, reg, bits);
+}
+
int regmap_test_bits(struct regmap *map, unsigned int reg, unsigned int bits);
/**
@@ -1554,6 +1563,13 @@ static inline int regmap_clear_bits(struct regmap *map,
return -EINVAL;
}
+static inline int regmap_assign_bits(struct regmap *map, unsigned int reg,
+ unsigned int bits, bool value)
+{
+ WARN_ONCE(1, "regmap API is disabled");
+ return -EINVAL;
+}
+
static inline int regmap_test_bits(struct regmap *map,
unsigned int reg, unsigned int bits)
{
--
2.29.1
next prev parent reply other threads:[~2020-11-04 19:31 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 ` Bartosz Golaszewski [this message]
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
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=20201104193051.32236-2-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=David.Laight@aculab.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=broonie@kernel.org \
--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