linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry
@ 2012-03-17  7:33 Axel Lin
  2012-03-17  7:37 ` [PATCH 2/2] power_supply: ds2781: Use DS2781_PARAM_EEPROM_SIZE and DS2781_USER_EEPROM_SIZE Axel Lin
  2012-03-18 21:45 ` [PATCH 1/2] power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry Evgeniy Polyakov
  0 siblings, 2 replies; 5+ messages in thread
From: Axel Lin @ 2012-03-17  7:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Renata Sayakhova, Evgeniy Polyakov, Greg Kroah-Hartman, Anton Vorontsov

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/power/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 459f664..340de6e 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -77,7 +77,7 @@ config BATTERY_DS2780
 	  Say Y here to enable support for batteries with ds2780 chip.
 
 config BATTERY_DS2781
-	tristate "2781 battery driver"
+	tristate "DS2781 battery driver"
 	depends on HAS_IOMEM
 	select W1
 	select W1_SLAVE_DS2781
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] power_supply: ds2781: Use DS2781_PARAM_EEPROM_SIZE and DS2781_USER_EEPROM_SIZE
  2012-03-17  7:33 [PATCH 1/2] power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry Axel Lin
@ 2012-03-17  7:37 ` Axel Lin
  2012-03-18 21:45 ` [PATCH 1/2] power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry Evgeniy Polyakov
  1 sibling, 0 replies; 5+ messages in thread
From: Axel Lin @ 2012-03-17  7:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Renata Sayakhova, Evgeniy Polyakov, Greg Kroah-Hartman, Anton Vorontsov

Since we have defined DS2781_PARAM_EEPROM_SIZE and DS2781_USER_EEPROM_SIZE,
use them to simplify the code.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/power/ds2781_battery.c |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/power/ds2781_battery.c b/drivers/power/ds2781_battery.c
index ca0d653..975684a 100644
--- a/drivers/power/ds2781_battery.c
+++ b/drivers/power/ds2781_battery.c
@@ -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);
@@ -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);
@@ -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,
 };
@@ -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);
@@ -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);
@@ -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,
 };
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry
  2012-03-17  7:33 [PATCH 1/2] power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry Axel Lin
  2012-03-17  7:37 ` [PATCH 2/2] power_supply: ds2781: Use DS2781_PARAM_EEPROM_SIZE and DS2781_USER_EEPROM_SIZE Axel Lin
@ 2012-03-18 21:45 ` Evgeniy Polyakov
  2012-04-18 22:33   ` Greg Kroah-Hartman
  2012-05-06  3:00   ` Anton Vorontsov
  1 sibling, 2 replies; 5+ messages in thread
From: Evgeniy Polyakov @ 2012-03-18 21:45 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Renata Sayakhova, Greg Kroah-Hartman, Anton Vorontsov

Hi

both patches look good, thank you
Greg, please pull it into your tree

Acked-by: Evgeniy Polyakov <zbr@ioremap.net>

-- 
	Evgeniy Polyakov

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry
  2012-03-18 21:45 ` [PATCH 1/2] power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry Evgeniy Polyakov
@ 2012-04-18 22:33   ` Greg Kroah-Hartman
  2012-05-06  3:00   ` Anton Vorontsov
  1 sibling, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2012-04-18 22:33 UTC (permalink / raw)
  To: Evgeniy Polyakov
  Cc: Axel Lin, linux-kernel, Renata Sayakhova, Anton Vorontsov

On Mon, Mar 19, 2012 at 01:45:30AM +0400, Evgeniy Polyakov wrote:
> Hi
> 
> both patches look good, thank you
> Greg, please pull it into your tree

Me?  Why?

I'm not the drivers/power/ maintainer, please send this to the proper
person.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry
  2012-03-18 21:45 ` [PATCH 1/2] power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry Evgeniy Polyakov
  2012-04-18 22:33   ` Greg Kroah-Hartman
@ 2012-05-06  3:00   ` Anton Vorontsov
  1 sibling, 0 replies; 5+ messages in thread
From: Anton Vorontsov @ 2012-05-06  3:00 UTC (permalink / raw)
  To: Evgeniy Polyakov; +Cc: Axel Lin, linux-kernel, Renata Sayakhova

On Mon, Mar 19, 2012 at 01:45:30AM +0400, Evgeniy Polyakov wrote:
> Hi
> 
> both patches look good, thank you
> Greg, please pull it into your tree
> 
> Acked-by: Evgeniy Polyakov <zbr@ioremap.net>

Both patches applied, thanks guys!

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-06  3:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-17  7:33 [PATCH 1/2] power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry Axel Lin
2012-03-17  7:37 ` [PATCH 2/2] power_supply: ds2781: Use DS2781_PARAM_EEPROM_SIZE and DS2781_USER_EEPROM_SIZE Axel Lin
2012-03-18 21:45 ` [PATCH 1/2] power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry Evgeniy Polyakov
2012-04-18 22:33   ` Greg Kroah-Hartman
2012-05-06  3:00   ` Anton Vorontsov

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).