Skip to content

Commit

Permalink
rtc: ds1307: remove member nvram_offset from struct ds1307
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
  • Loading branch information
Heiner Kallweit authored and Alexandre Belloni committed Aug 31, 2017
1 parent e553170 commit 969fa07
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/rtc/rtc-ds1307.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -918,17 +917,19 @@ 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);
}

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);
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 969fa07

Please sign in to comment.