regulator: ad5398: show changing current in uA
Subsystems (2)
PATCH 1/2 regulator: ad5398: show changing current in uA
Integer division may truncate the result.
Current code shows changing current is 0mA when selector is 1 ... 8.
For example:
selector = 1ad5398_calc_current returns 117, debug message shows 117/1000 = 0mA selector = 2ad5398_calc_current returns 234, debug message shows 234/1000 = 0mA selector = 3ad5398_calc_current returns 351, debug message shows 351/1000 = 0mA
............
selector = 8ad5398_calc_current returns 937, debug message shows 937/1000 = 0mA
Show the changing current in uA makes it easier for debugging.
--- drivers/regulator/ad5398.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/ad5398.c +2 -2
@@ -99,8 +99,8 @@ static int ad5398_set_current_limit(struct regulator_dev *rdev, int min_uA, intif (ad5398_calc_current (chip, selector) > max_uA)return -EINVAL ; -dev_dbg (&client->dev,"changing current %dmA\n" , -ad5398_calc_current (chip, selector) /1000 ); +dev_dbg (&client->dev,"changing current %duA\n" , +ad5398_calc_current (chip, selector));/* read chip enable bit */ ret =ad5398_read_reg (client, &data);
Signature · 1 line
1.7.5.4
PATCH 2/2 regulator: ad5398: Use devm_kzalloc
--- drivers/regulator/ad5398.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/regulator/ad5398.c +1 -4
@@ -220,7 +220,7 @@ static int __devinit ad5398_probe(struct i2c_client *client,if (!init_data)return -EINVAL ; - chip =kzalloc (sizeof (*chip),GFP_KERNEL ); + chip =devm_kzalloc (&client->dev,sizeof (*chip),GFP_KERNEL );if (!chip)return -ENOMEM ;
@@ -246,7 +246,6 @@ static int __devinit ad5398_probe(struct i2c_client *client,return 0 ; err: -kfree (chip);return ret; }
@@ -255,8 +254,6 @@ static int __devexit ad5398_remove(struct i2c_client *client)struct ad5398_chip_info *chip =i2c_get_clientdata (client);regulator_unregister (chip->rdev); -kfree (chip); -return 0 ; }
Signature · 1 line
1.7.5.4
RE: [PATCH 2/2] regulator: ad5398: Use devm_kzalloc
-----Original Message-----
From: Axel Lin [mailto:[email protected]]
Sent: Tuesday, March 27, 2012 10:10 AM
To: [email protected]
Cc: Zhang, Sonic; Liam Girdwood; Mark Brown
Subject: [PATCH 2/2] regulator: ad5398: Use devm_kzalloc
--- drivers/regulator/ad5398.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/regulator/ad5398.c +1 -4
@@ -220,7 +220,7 @@ static int __devinit ad5398_probe(struct i2c_client *client,if (!init_data)return -EINVAL ; - chip =kzalloc (sizeof (*chip),GFP_KERNEL ); + chip =devm_kzalloc (&client->dev,sizeof (*chip),GFP_KERNEL );if (!chip)return -ENOMEM ;
@@ -246,7 +246,6 @@ static int __devinit ad5398_probe(struct i2c_client *client,return 0 ; err: -kfree (chip);return ret; }
@@ -255,8 +254,6 @@ static int __devexit ad5398_remove(struct i2c_client *client)struct ad5398_chip_info *chip =i2c_get_clientdata (client);regulator_unregister (chip->rdev); -kfree (chip); -return 0 ; }
--
1.7.5.4
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
-----Original Message-----
From: Axel Lin [mailto:[email protected]]
Sent: Tuesday, March 27, 2012 10:08 AM
To: [email protected]
Cc: Zhang, Sonic; Liam Girdwood; Mark Brown
Subject: [PATCH 1/2] regulator: ad5398: show changing current in uA
Integer division may truncate the result.
Current code shows changing current is 0mA when selector is 1 ... 8.
For example:
selector = 1ad5398_calc_current returns 117, debug message shows 117/1000 = 0mA selector = 2ad5398_calc_current returns 234, debug message shows 234/1000 = 0mA selector = 3ad5398_calc_current returns 351, debug message shows 351/1000 = 0mA
............
selector = 8ad5398_calc_current returns 937, debug message shows 937/1000 = 0mA
Show the changing current in uA makes it easier for debugging.
--- drivers/regulator/ad5398.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/ad5398.c +2 -2
@@ -99,8 +99,8 @@ static int ad5398_set_current_limit(struct regulator_dev *rdev, int min_uA, intif (ad5398_calc_current (chip, selector) > max_uA)return -EINVAL ; -dev_dbg (&client->dev,"changing current %dmA\n" , -ad5398_calc_current (chip, selector) /1000 ); +dev_dbg (&client->dev,"changing current %duA\n" , +ad5398_calc_current (chip, selector));/* read chip enable bit */ ret =ad5398_read_reg (client, &data);
--
1.7.5.4
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Mark Brown
AppliedQuoted 2 lines · Axel Lin
Integer division may truncate the result.
Current code shows changing current is 0mA when selector is 1 ... 8.
Applied both, thanks.