Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+26 -4
+4 -1
Documentation/IPMI.txt
··· 505 505 506 506 The addresses are normal I2C addresses. The adapter is the string 507 507 name of the adapter, as shown in /sys/class/i2c-adapter/i2c-<n>/name. 508 - It is *NOT* i2c-<n> itself. 508 + It is *NOT* i2c-<n> itself. Also, the comparison is done ignoring 509 + spaces, so if the name is "This is an I2C chip" you can say 510 + adapter_name=ThisisanI2cchip. This is because it's hard to pass in 511 + spaces in kernel parameters. 509 512 510 513 The debug flags are bit flags for each BMC found, they are: 511 514 IPMI messages: 1, driver state: 2, timing: 4, I2C probe: 8
+22 -3
drivers/char/ipmi/ipmi_ssif.c
··· 1258 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 1278 static struct ssif_addr_info *ssif_info_find(unsigned short addr, 1262 1279 char *adapter_name, 1263 1280 bool match_null_name) ··· 1289 1272 /* One is NULL and one is not */ 1290 1273 continue; 1291 1274 } 1292 - if (strcmp(info->adapter_name, adapter_name)) 1293 - /* Names to not match */ 1275 + if (adapter_name && 1276 + strcmp_nospace(info->adapter_name, 1277 + adapter_name)) 1278 + /* Names do not match */ 1294 1279 continue; 1295 1280 } 1296 1281 found = info; ··· 1426 1407 } else { 1427 1408 no_support: 1428 1409 /* Assume no multi-part or PEC support */ 1429 - pr_info(PFX "Error fetching SSIF: %d %d %2.2x, your system probably doesn't support this command so using defaults\n", 1410 + pr_info(PFX "Error fetching SSIF: %d %d %2.2x, your system probably doesn't support this command so using defaults\n", 1430 1411 rv, len, resp[2]); 1431 1412 1432 1413 ssif_info->max_xmit_msg_size = 32;