diff options
author | Corey Minyard <cminyard@mvista.com> | 2015-03-31 13:48:53 -0400 |
---|---|---|
committer | Corey Minyard <cminyard@mvista.com> | 2015-05-05 15:24:45 -0400 |
commit | b0e9aaa99dfb3036829e91d4f0aae449639e221a (patch) | |
tree | 737024f5452fc39d09fe6fc470c2140359bbd904 /drivers/char | |
parent | d467f7a405cf0e7f06ed8d3175607ebb4ed06671 (diff) |
ipmi:ssif: Ignore spaces when comparing I2C adapter names
Some of the adapters have spaces in their names, but that's really
hard to pass in as a module or kernel parameters. So ignore the
spaces.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/ipmi/ipmi_ssif.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index 1de1914f5f89..3c3b7257867b 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c | |||
@@ -1258,6 +1258,23 @@ static const struct file_operations smi_stats_proc_ops = { | |||
1258 | .release = single_release, | 1258 | .release = single_release, |
1259 | }; | 1259 | }; |
1260 | 1260 | ||
1261 | static int strcmp_nospace(char *s1, char *s2) | ||
1262 | { | ||
1263 | while (*s1 && *s2) { | ||
1264 | while (isspace(*s1)) | ||
1265 | s1++; | ||
1266 | while (isspace(*s2)) | ||
1267 | s2++; | ||
1268 | if (*s1 > *s2) | ||
1269 | return 1; | ||
1270 | if (*s1 < *s2) | ||
1271 | return -1; | ||
1272 | s1++; | ||
1273 | s2++; | ||
1274 | } | ||
1275 | return 0; | ||
1276 | } | ||
1277 | |||
1261 | static struct ssif_addr_info *ssif_info_find(unsigned short addr, | 1278 | static struct ssif_addr_info *ssif_info_find(unsigned short addr, |
1262 | char *adapter_name, | 1279 | char *adapter_name, |
1263 | bool match_null_name) | 1280 | bool match_null_name) |
@@ -1272,8 +1289,10 @@ restart: | |||
1272 | /* One is NULL and one is not */ | 1289 | /* One is NULL and one is not */ |
1273 | continue; | 1290 | continue; |
1274 | } | 1291 | } |
1275 | if (strcmp(info->adapter_name, adapter_name)) | 1292 | if (adapter_name && |
1276 | /* Names to not match */ | 1293 | strcmp_nospace(info->adapter_name, |
1294 | adapter_name)) | ||
1295 | /* Names do not match */ | ||
1277 | continue; | 1296 | continue; |
1278 | } | 1297 | } |
1279 | found = info; | 1298 | found = info; |
@@ -1407,7 +1426,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1407 | } else { | 1426 | } else { |
1408 | no_support: | 1427 | no_support: |
1409 | /* Assume no multi-part or PEC support */ | 1428 | /* Assume no multi-part or PEC support */ |
1410 | pr_info(PFX "Error fetching SSIF: %d %d %2.2x, your system probably doesn't support this command so using defaults\n", | 1429 | pr_info(PFX "Error fetching SSIF: %d %d %2.2x, your system probably doesn't support this command so using defaults\n", |
1411 | rv, len, resp[2]); | 1430 | rv, len, resp[2]); |
1412 | 1431 | ||
1413 | ssif_info->max_xmit_msg_size = 32; | 1432 | ssif_info->max_xmit_msg_size = 32; |