From: <yizhang.mrvl@gmail.com>
To: <sameo@linux.intel.com>, <gregkh@linuxfoundation.org>,
<yizhang.mrvl@gmail.com>
Cc: <cxie4@marvell.com>, <arnd@arndb.de>, <yizhang@marvell.com>,
<linux-kernel@vger.kernel.org>, <jtzhou@marvell.com>
Subject: [PATCH 3/4] mfd: 88pm800: fix probe bug
Date: Thu, 23 May 2013 19:10:46 +0800 [thread overview]
Message-ID: <1369307447-17874-4-git-send-email-yizhang.mrvl@gmail.com> (raw)
In-Reply-To: <1369307447-17874-1-git-send-email-yizhang.mrvl@gmail.com>
From: Yi Zhang <yizhang@marvell.com>
1) return 0 when probe function is successful
2) fine-tune pm800_pages_init()
Signed-off-by: Yi Zhang <yizhang@marvell.com>
---
drivers/mfd/88pm800.c | 29 +++++++++++++++++++++--------
1 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c
index 618a6b9..475b5fa 100644
--- a/drivers/mfd/88pm800.c
+++ b/drivers/mfd/88pm800.c
@@ -369,32 +369,43 @@ static int pm800_pages_init(struct pm80x_chip *chip)
struct pm80x_subchip *subchip;
struct i2c_client *client = chip->client;
+ int ret = -ENODEV;
+
subchip = chip->subchip;
/* PM800 block power: i2c addr 0x31 */
- if (subchip->power_page_addr) {
+ if (subchip & (subchip->power_page_addr)) {
subchip->power_page =
i2c_new_dummy(client->adapter, subchip->power_page_addr);
subchip->regmap_power =
devm_regmap_init_i2c(subchip->power_page,
&pm80x_regmap_config);
i2c_set_clientdata(subchip->power_page, chip);
- } else
+ } else {
dev_info(chip->dev,
"PM800 block power 0x31: No power_page_addr\n");
+ return ret;
+ }
/* PM800 block GPADC: i2c addr 0x32 */
- if (subchip->gpadc_page_addr) {
+ if (subchip & (subchip->gpadc_page_addr)) {
subchip->gpadc_page = i2c_new_dummy(client->adapter,
subchip->gpadc_page_addr);
subchip->regmap_gpadc =
devm_regmap_init_i2c(subchip->gpadc_page,
&pm80x_regmap_config);
i2c_set_clientdata(subchip->gpadc_page, chip);
- } else
+ } else {
dev_info(chip->dev,
"PM800 block GPADC 0x32: No gpadc_page_addr\n");
+ goto out_gpadc_page;
+ }
return 0;
+
+out_gpadc_page:
+ regmap_exit(subchip->regmap_power);
+ i2c_unregister_device(subchip->power_page);
+ return ret;
}
static void pm800_pages_exit(struct pm80x_chip *chip)
@@ -537,16 +548,18 @@ static int pm800_probe(struct i2c_client *client,
ret = device_800_init(chip, pdata);
if (ret) {
dev_err(chip->dev, "%s id 0x%x failed!\n", __func__, chip->id);
- goto err_subchip_alloc;
+ goto err_800_init;
}
if (pdata->plat_config)
pdata->plat_config(chip, pdata);
-err_subchip_alloc:
- mfd_remove_devices(chip->dev);
- device_irq_exit_800(chip);
+ return 0;
+
+err_800_init:
+ pm800_pages_exit(chip);
err_page_init:
+err_subchip_alloc:
pm80x_deinit();
out_init:
return ret;
--
1.7.0.4
next prev parent reply other threads:[~2013-05-23 11:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-23 11:10 [PATCH 0/3] mfd: 88pm800: bug fix and add regulator support yizhang.mrvl
2013-05-23 11:10 ` [PATCH 1/4] mfd: 88pm800: fix NULL pointer error yizhang.mrvl
2013-05-23 11:10 ` [PATCH 2/4] mfd: 88pm800: remove "IRQF_TRIGGER_FALLING" flag yizhang.mrvl
2013-05-23 11:10 ` yizhang.mrvl [this message]
2013-05-23 11:10 ` [PATCH 4/4] mfd: 88pm800: add regulator support yizhang.mrvl
-- strict thread matches above, loose matches on Subject: below --
2013-05-22 12:07 [PATCH 0/3] *** SUBJECT HERE *** yizhang.mrvl
2013-05-22 12:07 ` [PATCH 3/4] mfd: 88pm800: fix probe bug yizhang.mrvl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1369307447-17874-4-git-send-email-yizhang.mrvl@gmail.com \
--to=yizhang.mrvl@gmail.com \
--cc=arnd@arndb.de \
--cc=cxie4@marvell.com \
--cc=gregkh@linuxfoundation.org \
--cc=jtzhou@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=yizhang@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®