From: Heiner Kallweit <hkallweit1@gmail.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: linux-rtc@vger.kernel.org
Subject: [PATCH 9/9] rtc: ds1307: remove member nvram_offset from struct ds1307
Date: Wed, 12 Jul 2017 07:49:54 +0200 [thread overview]
Message-ID: <24eaba2e-5ac5-aa7d-0434-61eebd9f516b@gmail.com> (raw)
In-Reply-To: <aded2895-cf4b-12f0-5525-c4389ccf3650@gmail.com>
Remove member nvram_offset from struct ds1307 and use the value stored
in struct chip_desc directly.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/rtc/rtc-ds1307.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 43babd74..6eb7e86e 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -116,7 +116,6 @@ enum ds_type {
struct ds1307 {
u8 regs[11];
- u16 nvram_offset;
struct nvmem_config nvmem_cfg;
enum ds_type type;
unsigned long flags;
@@ -918,8 +917,9 @@ static int ds1307_nvram_read(void *priv, unsigned int offset, void *val,
size_t bytes)
{
struct ds1307 *ds1307 = priv;
+ const struct chip_desc *chip = &chips[ds1307->type];
- return regmap_bulk_read(ds1307->regmap, ds1307->nvram_offset + offset,
+ return regmap_bulk_read(ds1307->regmap, chip->nvram_offset + offset,
val, bytes);
}
@@ -927,8 +927,9 @@ static int ds1307_nvram_write(void *priv, unsigned int offset, void *val,
size_t bytes)
{
struct ds1307 *ds1307 = priv;
+ const struct chip_desc *chip = &chips[ds1307->type];
- return regmap_bulk_write(ds1307->regmap, ds1307->nvram_offset + offset,
+ return regmap_bulk_write(ds1307->regmap, chip->nvram_offset + offset,
val, bytes);
}
@@ -1673,7 +1674,6 @@ static int ds1307_probe(struct i2c_client *client,
ds1307->nvmem_cfg.reg_read = ds1307_nvram_read;
ds1307->nvmem_cfg.reg_write = ds1307_nvram_write;
ds1307->nvmem_cfg.priv = ds1307;
- ds1307->nvram_offset = chip->nvram_offset;
ds1307->rtc->nvmem_config = &ds1307->nvmem_cfg;
ds1307->rtc->nvram_old_abi = true;
--
2.13.2
next prev parent reply other threads:[~2017-07-12 5:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-12 5:23 [PATCH 0/9] rtc: ds1307: series with refactorings / improvements Heiner Kallweit
2017-07-12 5:49 ` [PATCH 1/9] rtc: ds1307: remove member irq from struct ds1307 Heiner Kallweit
2017-07-12 5:49 ` [PATCH 2/9] rtc: ds1307: factor out bbsqi bit to struct chip_desc Heiner Kallweit
2017-07-12 5:49 ` [PATCH 3/9] rtc: ds1307: improve trickle charger initialization Heiner Kallweit
2017-07-12 5:49 ` [PATCH 4/9] rtc: ds1307: constify struct chip_desc variables Heiner Kallweit
2017-07-12 5:49 ` [PATCH 5/9] rtc: ds1307: improve irq setup Heiner Kallweit
2017-07-12 5:49 ` [PATCH 6/9] rtc: ds1307: factor out irq_handler to struct chip_desc Heiner Kallweit
2017-07-12 5:49 ` [PATCH 7/9] rtc: ds1307: factor out rtc_ops " Heiner Kallweit
2017-07-12 5:49 ` [PATCH 8/9] rtc: ds1307: factor out offset " Heiner Kallweit
2017-07-12 5:49 ` Heiner Kallweit [this message]
2017-08-24 21:04 ` [PATCH 0/9] rtc: ds1307: series with refactorings / improvements Alexandre Belloni
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=24eaba2e-5ac5-aa7d-0434-61eebd9f516b@gmail.com \
--to=hkallweit1@gmail.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=linux-rtc@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).