linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bartosz Golaszewski <brgl@bgdev.pl>
Subject: [PATCH] eeprom: at24: don't use the default regmap locking
Date: Sun,  3 Dec 2017 22:47:43 +0100	[thread overview]
Message-ID: <20171203214743.15970-1-brgl@bgdev.pl> (raw)

We need to always wait for the last write to complete and we want the
regmap to be protected from concurrent access during that wait. That
makes using the regmap's default locking impossible and we're
protecting it with an external mutex.

Set an empty function as the callback for regmap's lock and unlock
routines so that it doesn't allocate any internal resources for
unnecessary locking.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
This is a temporary solution - I'm working on a patch extending the
regmap framework with locking policy options, which will allow users
to manually lock & unlock regmaps if needed or disable locking at all.

 drivers/misc/eeprom/at24.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 625b00166117..34bc394a9c14 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -498,14 +498,23 @@ static unsigned int at24_get_offset_adj(u8 flags, unsigned int byte_len)
 	}
 }
 
+static void at24_regmap_lock_unlock_none(void *map)
+{
+
+}
+
 static const struct regmap_config regmap_config_8 = {
 	.reg_bits = 8,
 	.val_bits = 8,
+	.lock = at24_regmap_lock_unlock_none,
+	.unlock = at24_regmap_lock_unlock_none,
 };
 
 static const struct regmap_config regmap_config_16 = {
 	.reg_bits = 16,
 	.val_bits = 8,
+	.lock = at24_regmap_lock_unlock_none,
+	.unlock = at24_regmap_lock_unlock_none,
 };
 
 static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
-- 
2.15.1

             reply	other threads:[~2017-12-03 21:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-03 21:47 Bartosz Golaszewski [this message]
2017-12-10 18:57 ` [PATCH] eeprom: at24: don't use the default regmap locking Bartosz Golaszewski
2017-12-14 20:27   ` Bartosz Golaszewski

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=20171203214743.15970-1-brgl@bgdev.pl \
    --to=brgl@bgdev.pl \
    --cc=hkallweit1@gmail.com \
    --cc=linux-i2c@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).