From: Austin Boyle <Austin.Boyle@aviatnet.com>
To: Wolfram Sang <w.sang@pengutronix.de>
Cc: <rtc-linux@googlegroups.com>,
Joakim Tjernlund <Joakim.Tjernlund@transmode.se>,
Alessandro Zummo <a.zummo@towertech.it>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] rtc: ds1307: Register offset moved to chip description
Date: Wed, 27 Jun 2012 10:24:02 +1200 [thread overview]
Message-ID: <1340749442.3241.4046.camel@pc786-ubu.gnet.global.vpn> (raw)
rtc: ds1307: Register offset moved to chip description
From: Austin Boyle <Austin.Boyle@aviatnet.com>
Register offset is added to chip description instead of being hard-coded
into probe function.
Based on v3.5-rc4
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Austin Boyle <Austin.Boyle@aviatnet.com>
---
diff --git a/a/drivers/rtc/rtc-ds1307.c b/b/drivers/rtc/rtc-ds1307.c
index 836710c..abf837b 100644
--- a/a/drivers/rtc/rtc-ds1307.c
+++ b/b/drivers/rtc/rtc-ds1307.c
@@ -122,6 +122,7 @@ struct ds1307 {
struct chip_desc {
unsigned alarm:1;
+ u8 offset;
u16 nvram_offset;
u16 nvram_size;
u16 trickle_charger_reg;
@@ -149,6 +150,9 @@ static const struct chip_desc chips[last_ds_type] = {
[ds_1388] = {
.trickle_charger_reg = 0x0a,
},
+ [ds_1388] = {
+ .offset = 1, /* seconds field starts at 1 */
+ },
[ds_3231] = {
.alarm = 1,
},
@@ -646,6 +650,7 @@ static int __devinit ds1307_probe(struct i2c_client *client,
ds1307->client = client;
ds1307->type = id->driver_data;
+ ds1307->offset = chip->offset;
if (pdata && pdata->trickle_charger_setup && chip->trickle_charger_reg)
i2c_smbus_write_byte_data(client, chip->trickle_charger_reg,
@@ -768,9 +773,6 @@ static int __devinit ds1307_probe(struct i2c_client *client,
hour);
}
break;
- case ds_1388:
- ds1307->offset = 1; /* Seconds starts at 1 */
- break;
default:
break;
}
next reply other threads:[~2012-06-26 22:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-26 22:24 Austin Boyle [this message]
2012-06-27 13:33 ` Wolfram Sang
2012-06-27 13:42 ` Joakim Tjernlund
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=1340749442.3241.4046.camel@pc786-ubu.gnet.global.vpn \
--to=austin.boyle@aviatnet.com \
--cc=Joakim.Tjernlund@transmode.se \
--cc=a.zummo@towertech.it \
--cc=linux-kernel@vger.kernel.org \
--cc=rtc-linux@googlegroups.com \
--cc=w.sang@pengutronix.de \
/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®