diff options
author | Jaehoon Chung <jh80.chung@samsung.com> | 2016-12-15 20:49:50 +0900 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2017-01-11 19:40:14 +0900 |
commit | 505cf4750ae55e711663538b3ec7a294c08e7417 (patch) | |
tree | 43f8c393b19f0946457b1beda94d228b1e6fc6e0 /drivers/power/power_spi.c | |
parent | 9c720c815b1b1e95fb13153396417dddf323511d (diff) |
power: change from meaningless value to error number
'-1' is absolutely meaningless value.
This patch changed from meaningless value to error number.
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/power/power_spi.c')
-rw-r--r-- | drivers/power/power_spi.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/power/power_spi.c b/drivers/power/power_spi.c index 1e554461f3..ef8531df0f 100644 --- a/drivers/power/power_spi.c +++ b/drivers/power/power_spi.c @@ -27,14 +27,14 @@ static u32 pmic_reg(struct pmic *p, u32 reg, u32 *val, u32 write) p->hw.spi.mode); if (!slave) - return -1; + return -ENODEV; } if (check_reg(p, reg)) - return -1; + return -EINVAL; if (spi_claim_bus(slave)) - return -1; + return -EBUSY; pmic_tx = p->hw.spi.prepare_tx(reg, val, write); @@ -59,21 +59,15 @@ static u32 pmic_reg(struct pmic *p, u32 reg, u32 *val, u32 write) err: spi_release_bus(slave); - return -1; + return -ENOTSUPP; } int pmic_reg_write(struct pmic *p, u32 reg, u32 val) { - if (pmic_reg(p, reg, &val, 1)) - return -1; - - return 0; + return pmic_reg(p, reg, &val, 1); } int pmic_reg_read(struct pmic *p, u32 reg, u32 *val) { - if (pmic_reg(p, reg, val, 0)) - return -1; - - return 0; + return pmic_reg(p, reg, val, 0); } |