* [PATCH 1/2] regulator: tps65090: Use IS_ERR to check return value of regulator_register
@ 2012-03-24 2:56 Axel Lin
2012-03-24 2:57 ` [PATCH 2/2] regulator: Remove _en_reg, _en_bit and _ops parameters from tps65090_REG macro Axel Lin
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Axel Lin @ 2012-03-24 2:56 UTC (permalink / raw)
To: linux-kernel; +Cc: Venu Byravarasu, Liam Girdwood, Mark Brown
regulator_register never returns NULL.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/tps65090-regulator.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c
index 6c28e3a..470ca7e 100644
--- a/drivers/regulator/tps65090-regulator.c
+++ b/drivers/regulator/tps65090-regulator.c
@@ -153,7 +153,7 @@ static int __devinit tps65090_regulator_probe(struct platform_device *pdev)
rdev = regulator_register(&ri->desc, &pdev->dev,
&tps_pdata->regulator, ri, NULL);
- if (IS_ERR_OR_NULL(rdev)) {
+ if (IS_ERR(rdev)) {
dev_err(&pdev->dev, "failed to register regulator %s\n",
ri->desc.name);
return PTR_ERR(rdev);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] regulator: Remove _en_reg, _en_bit and _ops parameters from tps65090_REG macro
2012-03-24 2:56 [PATCH 1/2] regulator: tps65090: Use IS_ERR to check return value of regulator_register Axel Lin
@ 2012-03-24 2:57 ` Axel Lin
2012-03-26 6:51 ` Venu Byravarasu
2012-03-26 3:28 ` [PATCH 1/2] regulator: tps65090: Use IS_ERR to check return value of regulator_register Venu Byravarasu
2012-03-26 10:52 ` Mark Brown
2 siblings, 1 reply; 5+ messages in thread
From: Axel Lin @ 2012-03-24 2:57 UTC (permalink / raw)
To: linux-kernel; +Cc: Venu Byravarasu, Liam Girdwood, Mark Brown
Both _en_bit and _ops parameters for all DCDCs and FETs are the same, so we
can hardcode it in tps65090_REG macro.
_en_reg can be calculated by _id + 12, so we can also remove it.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/tps65090-regulator.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c
index 470ca7e..7baff2e 100644
--- a/drivers/regulator/tps65090-regulator.c
+++ b/drivers/regulator/tps65090-regulator.c
@@ -94,31 +94,31 @@ static struct regulator_ops tps65090_ops = {
.is_enabled = tps65090_reg_is_enabled,
};
-#define tps65090_REG(_id, _en_reg, _en_bit, _ops) \
+#define tps65090_REG(_id) \
{ \
- .reg_en_reg = _en_reg, \
- .en_bit = _en_bit, \
+ .reg_en_reg = (TPS65090_ID_##_id) + 12, \
+ .en_bit = 0, \
.id = TPS65090_ID_##_id, \
.desc = { \
.name = tps65090_rails(_id), \
.id = TPS65090_ID_##_id, \
- .ops = &_ops, \
+ .ops = &tps65090_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
}, \
}
static struct tps65090_regulator TPS65090_regulator[] = {
- tps65090_REG(DCDC1, 12, 0, tps65090_ops),
- tps65090_REG(DCDC2, 13, 0, tps65090_ops),
- tps65090_REG(DCDC3, 14, 0, tps65090_ops),
- tps65090_REG(FET1, 15, 0, tps65090_ops),
- tps65090_REG(FET2, 16, 0, tps65090_ops),
- tps65090_REG(FET3, 17, 0, tps65090_ops),
- tps65090_REG(FET4, 18, 0, tps65090_ops),
- tps65090_REG(FET5, 19, 0, tps65090_ops),
- tps65090_REG(FET6, 20, 0, tps65090_ops),
- tps65090_REG(FET7, 21, 0, tps65090_ops),
+ tps65090_REG(DCDC1),
+ tps65090_REG(DCDC2),
+ tps65090_REG(DCDC3),
+ tps65090_REG(FET1),
+ tps65090_REG(FET2),
+ tps65090_REG(FET3),
+ tps65090_REG(FET4),
+ tps65090_REG(FET5),
+ tps65090_REG(FET6),
+ tps65090_REG(FET7),
};
static inline struct tps65090_regulator *find_regulator_info(int id)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH 1/2] regulator: tps65090: Use IS_ERR to check return value of regulator_register
2012-03-24 2:56 [PATCH 1/2] regulator: tps65090: Use IS_ERR to check return value of regulator_register Axel Lin
2012-03-24 2:57 ` [PATCH 2/2] regulator: Remove _en_reg, _en_bit and _ops parameters from tps65090_REG macro Axel Lin
@ 2012-03-26 3:28 ` Venu Byravarasu
2012-03-26 10:52 ` Mark Brown
2 siblings, 0 replies; 5+ messages in thread
From: Venu Byravarasu @ 2012-03-26 3:28 UTC (permalink / raw)
To: Axel Lin, linux-kernel@vger.kernel.org; +Cc: Liam Girdwood, Mark Brown
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 451 bytes --]
> rdev = regulator_register(&ri->desc, &pdev->dev,
> &tps_pdata->regulator, ri, NULL);
> - if (IS_ERR_OR_NULL(rdev)) {
> + if (IS_ERR(rdev)) {
Thanks Axel, for this patch.
Just today I saw Mark's mail and about to make this change.
Acked-by: Venu Byravarasu <vbyravarasu@nvidia.com>
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 2/2] regulator: Remove _en_reg, _en_bit and _ops parameters from tps65090_REG macro
2012-03-24 2:57 ` [PATCH 2/2] regulator: Remove _en_reg, _en_bit and _ops parameters from tps65090_REG macro Axel Lin
@ 2012-03-26 6:51 ` Venu Byravarasu
0 siblings, 0 replies; 5+ messages in thread
From: Venu Byravarasu @ 2012-03-26 6:51 UTC (permalink / raw)
To: Axel Lin, linux-kernel@vger.kernel.org; +Cc: Liam Girdwood, Mark Brown
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2313 bytes --]
> Both _en_bit and _ops parameters for all DCDCs and FETs are the same, so we
> can hardcode it in tps65090_REG macro.
>
> _en_reg can be calculated by _id + 12, so we can also remove it.
Looks good to me.
Acked by: Venu Byravarasu <vbyravarasu@nvidia.com>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> drivers/regulator/tps65090-regulator.c | 28 ++++++++++++++--------------
> 1 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/regulator/tps65090-regulator.c
> b/drivers/regulator/tps65090-regulator.c
> index 470ca7e..7baff2e 100644
> --- a/drivers/regulator/tps65090-regulator.c
> +++ b/drivers/regulator/tps65090-regulator.c
> @@ -94,31 +94,31 @@ static struct regulator_ops tps65090_ops = {
> .is_enabled = tps65090_reg_is_enabled,
> };
>
> -#define tps65090_REG(_id, _en_reg, _en_bit, _ops) \
> +#define tps65090_REG(_id) \
> { \
> - .reg_en_reg = _en_reg, \
> - .en_bit = _en_bit, \
> + .reg_en_reg = (TPS65090_ID_##_id) + 12, \
> + .en_bit = 0, \
> .id = TPS65090_ID_##_id, \
> .desc = { \
> .name = tps65090_rails(_id), \
> .id = TPS65090_ID_##_id, \
> - .ops = &_ops, \
> + .ops = &tps65090_ops, \
> .type = REGULATOR_VOLTAGE, \
> .owner = THIS_MODULE, \
> }, \
> }
>
> static struct tps65090_regulator TPS65090_regulator[] = {
> - tps65090_REG(DCDC1, 12, 0, tps65090_ops),
> - tps65090_REG(DCDC2, 13, 0, tps65090_ops),
> - tps65090_REG(DCDC3, 14, 0, tps65090_ops),
> - tps65090_REG(FET1, 15, 0, tps65090_ops),
> - tps65090_REG(FET2, 16, 0, tps65090_ops),
> - tps65090_REG(FET3, 17, 0, tps65090_ops),
> - tps65090_REG(FET4, 18, 0, tps65090_ops),
> - tps65090_REG(FET5, 19, 0, tps65090_ops),
> - tps65090_REG(FET6, 20, 0, tps65090_ops),
> - tps65090_REG(FET7, 21, 0, tps65090_ops),
> + tps65090_REG(DCDC1),
> + tps65090_REG(DCDC2),
> + tps65090_REG(DCDC3),
> + tps65090_REG(FET1),
> + tps65090_REG(FET2),
> + tps65090_REG(FET3),
> + tps65090_REG(FET4),
> + tps65090_REG(FET5),
> + tps65090_REG(FET6),
> + tps65090_REG(FET7),
> };
>
> static inline struct tps65090_regulator *find_regulator_info(int id)
> --
> 1.7.5.4
>
>
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] regulator: tps65090: Use IS_ERR to check return value of regulator_register
2012-03-24 2:56 [PATCH 1/2] regulator: tps65090: Use IS_ERR to check return value of regulator_register Axel Lin
2012-03-24 2:57 ` [PATCH 2/2] regulator: Remove _en_reg, _en_bit and _ops parameters from tps65090_REG macro Axel Lin
2012-03-26 3:28 ` [PATCH 1/2] regulator: tps65090: Use IS_ERR to check return value of regulator_register Venu Byravarasu
@ 2012-03-26 10:52 ` Mark Brown
2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2012-03-26 10:52 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Venu Byravarasu, Liam Girdwood
[-- Attachment #1: Type: text/plain, Size: 182 bytes --]
On Sat, Mar 24, 2012 at 10:56:00AM +0800, Axel Lin wrote:
> regulator_register never returns NULL.
Applied both, thanks. In theory it may return NULL but that's not an
error code.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-26 10:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-24 2:56 [PATCH 1/2] regulator: tps65090: Use IS_ERR to check return value of regulator_register Axel Lin
2012-03-24 2:57 ` [PATCH 2/2] regulator: Remove _en_reg, _en_bit and _ops parameters from tps65090_REG macro Axel Lin
2012-03-26 6:51 ` Venu Byravarasu
2012-03-26 3:28 ` [PATCH 1/2] regulator: tps65090: Use IS_ERR to check return value of regulator_register Venu Byravarasu
2012-03-26 10:52 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox