]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
power: ds2781_battery: clean up eeprom read/write functions
authorVladimir Zapolskiy <vz@mleia.com>
Sun, 26 Jul 2015 21:26:48 +0000 (00:26 +0300)
committerSebastian Reichel <sre@kernel.org>
Mon, 27 Jul 2015 14:28:54 +0000 (16:28 +0200)
The change removes redundant calculation of left space on eeprom while
reading or writing "param_eeprom" or "user_eeprom", the checks are not
needed, since this task is done on caller side in fs/sysfs/file.c

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
drivers/power/ds2781_battery.c

index 56d583dae9087c89742bf25e4d0a61364d4f5885..c3680024f3992af41f7a4ff8a5598b628df67c43 100644 (file)
@@ -639,8 +639,6 @@ 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_PARAM_EEPROM_SIZE - off);
-
        return ds2781_read_block(dev_info, buf,
                                DS2781_EEPROM_BLOCK1_START + off, count);
 }
@@ -655,8 +653,6 @@ 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_PARAM_EEPROM_SIZE - off);
-
        ret = ds2781_write(dev_info, buf,
                                DS2781_EEPROM_BLOCK1_START + off, count);
        if (ret < 0)
@@ -688,8 +684,6 @@ 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_USER_EEPROM_SIZE - off);
-
        return ds2781_read_block(dev_info, buf,
                                DS2781_EEPROM_BLOCK0_START + off, count);
 
@@ -705,8 +699,6 @@ 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_USER_EEPROM_SIZE - off);
-
        ret = ds2781_write(dev_info, buf,
                                DS2781_EEPROM_BLOCK0_START + off, count);
        if (ret < 0)