diff options
author | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-09-01 11:34:31 -0400 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-10-24 14:09:39 -0400 |
commit | 179144a0d4128e7588b3d613a14807402f5e7c37 (patch) | |
tree | 996869256838ba759495d1a1331ffcddba94b1bd /drivers/hwmon | |
parent | ced29d422557feb4230ea6b0067f1e24c5bd83f7 (diff) |
hwmon: (pmbus) Replace EINVAL return codes with more appropriate errors
EINVAL was over-used in the code. Replace it with more appropriate errors.
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/pmbus/lm25066.c | 8 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/max8688.c | 4 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/pmbus_core.c | 10 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/ucd9000.c | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c index 2107f413e4f..a72bb9f51de 100644 --- a/drivers/hwmon/pmbus/lm25066.c +++ b/drivers/hwmon/pmbus/lm25066.c | |||
@@ -57,7 +57,7 @@ static int lm25066_read_word_data(struct i2c_client *client, int page, int reg) | |||
57 | int ret; | 57 | int ret; |
58 | 58 | ||
59 | if (page > 1) | 59 | if (page > 1) |
60 | return -EINVAL; | 60 | return -ENXIO; |
61 | 61 | ||
62 | /* Map READ_VAUX into READ_VOUT register on page 1 */ | 62 | /* Map READ_VAUX into READ_VOUT register on page 1 */ |
63 | if (page == 1) { | 63 | if (page == 1) { |
@@ -85,7 +85,7 @@ static int lm25066_read_word_data(struct i2c_client *client, int page, int reg) | |||
85 | break; | 85 | break; |
86 | default: | 86 | default: |
87 | /* No other valid registers on page 1 */ | 87 | /* No other valid registers on page 1 */ |
88 | ret = -EINVAL; | 88 | ret = -ENXIO; |
89 | break; | 89 | break; |
90 | } | 90 | } |
91 | goto done; | 91 | goto done; |
@@ -138,7 +138,7 @@ static int lm25066_write_word_data(struct i2c_client *client, int page, int reg, | |||
138 | int ret; | 138 | int ret; |
139 | 139 | ||
140 | if (page > 1) | 140 | if (page > 1) |
141 | return -EINVAL; | 141 | return -ENXIO; |
142 | 142 | ||
143 | switch (reg) { | 143 | switch (reg) { |
144 | case PMBUS_IIN_OC_WARN_LIMIT: | 144 | case PMBUS_IIN_OC_WARN_LIMIT: |
@@ -164,7 +164,7 @@ static int lm25066_write_word_data(struct i2c_client *client, int page, int reg, | |||
164 | static int lm25066_write_byte(struct i2c_client *client, int page, u8 value) | 164 | static int lm25066_write_byte(struct i2c_client *client, int page, u8 value) |
165 | { | 165 | { |
166 | if (page > 1) | 166 | if (page > 1) |
167 | return -EINVAL; | 167 | return -ENXIO; |
168 | 168 | ||
169 | if (page == 0) | 169 | if (page == 0) |
170 | return pmbus_write_byte(client, 0, value); | 170 | return pmbus_write_byte(client, 0, value); |
diff --git a/drivers/hwmon/pmbus/max8688.c b/drivers/hwmon/pmbus/max8688.c index e148e2c5a75..7113f1131e4 100644 --- a/drivers/hwmon/pmbus/max8688.c +++ b/drivers/hwmon/pmbus/max8688.c | |||
@@ -45,7 +45,7 @@ static int max8688_read_word_data(struct i2c_client *client, int page, int reg) | |||
45 | int ret; | 45 | int ret; |
46 | 46 | ||
47 | if (page) | 47 | if (page) |
48 | return -EINVAL; | 48 | return -ENXIO; |
49 | 49 | ||
50 | switch (reg) { | 50 | switch (reg) { |
51 | case PMBUS_VIRT_READ_VOUT_MAX: | 51 | case PMBUS_VIRT_READ_VOUT_MAX: |
@@ -102,7 +102,7 @@ static int max8688_read_byte_data(struct i2c_client *client, int page, int reg) | |||
102 | int mfg_status; | 102 | int mfg_status; |
103 | 103 | ||
104 | if (page) | 104 | if (page) |
105 | return -EINVAL; | 105 | return -ENXIO; |
106 | 106 | ||
107 | switch (reg) { | 107 | switch (reg) { |
108 | case PMBUS_STATUS_VOUT: | 108 | case PMBUS_STATUS_VOUT: |
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 36f287076ee..7841ea0c10a 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c | |||
@@ -160,7 +160,7 @@ int pmbus_set_page(struct i2c_client *client, u8 page) | |||
160 | rv = i2c_smbus_write_byte_data(client, PMBUS_PAGE, page); | 160 | rv = i2c_smbus_write_byte_data(client, PMBUS_PAGE, page); |
161 | newpage = i2c_smbus_read_byte_data(client, PMBUS_PAGE); | 161 | newpage = i2c_smbus_read_byte_data(client, PMBUS_PAGE); |
162 | if (newpage != page) | 162 | if (newpage != page) |
163 | rv = -EINVAL; | 163 | rv = -EIO; |
164 | else | 164 | else |
165 | data->currpage = page; | 165 | data->currpage = page; |
166 | } | 166 | } |
@@ -229,7 +229,7 @@ static int _pmbus_write_word_data(struct i2c_client *client, int page, int reg, | |||
229 | return status; | 229 | return status; |
230 | } | 230 | } |
231 | if (reg >= PMBUS_VIRT_BASE) | 231 | if (reg >= PMBUS_VIRT_BASE) |
232 | return -EINVAL; | 232 | return -ENXIO; |
233 | return pmbus_write_word_data(client, page, reg, word); | 233 | return pmbus_write_word_data(client, page, reg, word); |
234 | } | 234 | } |
235 | 235 | ||
@@ -261,7 +261,7 @@ static int _pmbus_read_word_data(struct i2c_client *client, int page, int reg) | |||
261 | return status; | 261 | return status; |
262 | } | 262 | } |
263 | if (reg >= PMBUS_VIRT_BASE) | 263 | if (reg >= PMBUS_VIRT_BASE) |
264 | return -EINVAL; | 264 | return -ENXIO; |
265 | return pmbus_read_word_data(client, page, reg); | 265 | return pmbus_read_word_data(client, page, reg); |
266 | } | 266 | } |
267 | 267 | ||
@@ -320,7 +320,7 @@ static int pmbus_check_status_cml(struct i2c_client *client) | |||
320 | if (status < 0 || (status & PB_STATUS_CML)) { | 320 | if (status < 0 || (status & PB_STATUS_CML)) { |
321 | status2 = pmbus_read_byte_data(client, -1, PMBUS_STATUS_CML); | 321 | status2 = pmbus_read_byte_data(client, -1, PMBUS_STATUS_CML); |
322 | if (status2 < 0 || (status2 & PB_CML_FAULT_INVALID_COMMAND)) | 322 | if (status2 < 0 || (status2 & PB_CML_FAULT_INVALID_COMMAND)) |
323 | return -EINVAL; | 323 | return -EIO; |
324 | } | 324 | } |
325 | return 0; | 325 | return 0; |
326 | } | 326 | } |
@@ -1682,7 +1682,7 @@ int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, | |||
1682 | if (info->pages <= 0 || info->pages > PMBUS_PAGES) { | 1682 | if (info->pages <= 0 || info->pages > PMBUS_PAGES) { |
1683 | dev_err(&client->dev, "Bad number of PMBus pages: %d\n", | 1683 | dev_err(&client->dev, "Bad number of PMBus pages: %d\n", |
1684 | info->pages); | 1684 | info->pages); |
1685 | ret = -EINVAL; | 1685 | ret = -ENODEV; |
1686 | goto out_data; | 1686 | goto out_data; |
1687 | } | 1687 | } |
1688 | 1688 | ||
diff --git a/drivers/hwmon/pmbus/ucd9000.c b/drivers/hwmon/pmbus/ucd9000.c index 640a9c9de7f..1536db6543f 100644 --- a/drivers/hwmon/pmbus/ucd9000.c +++ b/drivers/hwmon/pmbus/ucd9000.c | |||
@@ -75,7 +75,7 @@ static int ucd9000_read_byte_data(struct i2c_client *client, int page, int reg) | |||
75 | switch (reg) { | 75 | switch (reg) { |
76 | case PMBUS_FAN_CONFIG_12: | 76 | case PMBUS_FAN_CONFIG_12: |
77 | if (page) | 77 | if (page) |
78 | return -EINVAL; | 78 | return -ENXIO; |
79 | 79 | ||
80 | ret = ucd9000_get_fan_config(client, 0); | 80 | ret = ucd9000_get_fan_config(client, 0); |
81 | if (ret < 0) | 81 | if (ret < 0) |
@@ -89,7 +89,7 @@ static int ucd9000_read_byte_data(struct i2c_client *client, int page, int reg) | |||
89 | break; | 89 | break; |
90 | case PMBUS_FAN_CONFIG_34: | 90 | case PMBUS_FAN_CONFIG_34: |
91 | if (page) | 91 | if (page) |
92 | return -EINVAL; | 92 | return -ENXIO; |
93 | 93 | ||
94 | ret = ucd9000_get_fan_config(client, 2); | 94 | ret = ucd9000_get_fan_config(client, 2); |
95 | if (ret < 0) | 95 | if (ret < 0) |