Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309690
b: refs/heads/master
c: 13f2483
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Anton Vorontsov committed May 6, 2012
1 parent 6fb169f commit fc4c3e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 840b91bda91ebaa6230caec0ccf005daf9305fb6
refs/heads/master: 13f2483cd5e3df425cfa492cc62cf8fada5d01b9
20 changes: 6 additions & 14 deletions trunk/drivers/power/ds2781_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,7 @@ static ssize_t ds2781_read_param_eeprom_bin(struct file *filp,
struct power_supply *psy = to_power_supply(dev);
struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);

count = min_t(loff_t, count,
DS2781_EEPROM_BLOCK1_END -
DS2781_EEPROM_BLOCK1_START + 1 - off);
count = min_t(loff_t, count, DS2781_PARAM_EEPROM_SIZE - off);

return ds2781_read_block(dev_info, buf,
DS2781_EEPROM_BLOCK1_START + off, count);
Expand All @@ -661,9 +659,7 @@ static ssize_t ds2781_write_param_eeprom_bin(struct file *filp,
struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);
int ret;

count = min_t(loff_t, count,
DS2781_EEPROM_BLOCK1_END -
DS2781_EEPROM_BLOCK1_START + 1 - off);
count = min_t(loff_t, count, DS2781_PARAM_EEPROM_SIZE - off);

ret = ds2781_write(dev_info, buf,
DS2781_EEPROM_BLOCK1_START + off, count);
Expand All @@ -682,7 +678,7 @@ static struct bin_attribute ds2781_param_eeprom_bin_attr = {
.name = "param_eeprom",
.mode = S_IRUGO | S_IWUSR,
},
.size = DS2781_EEPROM_BLOCK1_END - DS2781_EEPROM_BLOCK1_START + 1,
.size = DS2781_PARAM_EEPROM_SIZE,
.read = ds2781_read_param_eeprom_bin,
.write = ds2781_write_param_eeprom_bin,
};
Expand All @@ -696,9 +692,7 @@ static ssize_t ds2781_read_user_eeprom_bin(struct file *filp,
struct power_supply *psy = to_power_supply(dev);
struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);

count = min_t(loff_t, count,
DS2781_EEPROM_BLOCK0_END -
DS2781_EEPROM_BLOCK0_START + 1 - off);
count = min_t(loff_t, count, DS2781_USER_EEPROM_SIZE - off);

return ds2781_read_block(dev_info, buf,
DS2781_EEPROM_BLOCK0_START + off, count);
Expand All @@ -715,9 +709,7 @@ static ssize_t ds2781_write_user_eeprom_bin(struct file *filp,
struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);
int ret;

count = min_t(loff_t, count,
DS2781_EEPROM_BLOCK0_END -
DS2781_EEPROM_BLOCK0_START + 1 - off);
count = min_t(loff_t, count, DS2781_USER_EEPROM_SIZE - off);

ret = ds2781_write(dev_info, buf,
DS2781_EEPROM_BLOCK0_START + off, count);
Expand All @@ -736,7 +728,7 @@ static struct bin_attribute ds2781_user_eeprom_bin_attr = {
.name = "user_eeprom",
.mode = S_IRUGO | S_IWUSR,
},
.size = DS2781_EEPROM_BLOCK0_END - DS2781_EEPROM_BLOCK0_START + 1,
.size = DS2781_USER_EEPROM_SIZE,
.read = ds2781_read_user_eeprom_bin,
.write = ds2781_write_user_eeprom_bin,
};
Expand Down

0 comments on commit fc4c3e0

Please sign in to comment.