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

PNP: replace strnicmp with strncasecmp

The kernel used to contain two functions for length-delimited,
case-insensitive string comparison, strnicmp with correct semantics and
a slightly buggy strncasecmp. The latter is the POSIX name, so strnicmp
was renamed to strncasecmp, and strnicmp made into a wrapper for the new
strncasecmp to avoid breaking existing users.

To allow the compat wrapper strnicmp to be removed at some point in the
future, and to avoid the extra indirection cost, do
s/strnicmp/strncasecmp/g.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Rasmus Villemoes and committed by
Linus Torvalds
7fb1cab4 40f5c777

+12 -12
+12 -12
drivers/pnp/interface.c
··· 346 346 } 347 347 348 348 buf = skip_spaces(buf); 349 - if (!strnicmp(buf, "disable", 7)) { 349 + if (!strncasecmp(buf, "disable", 7)) { 350 350 retval = pnp_disable_dev(dev); 351 351 goto done; 352 352 } 353 - if (!strnicmp(buf, "activate", 8)) { 353 + if (!strncasecmp(buf, "activate", 8)) { 354 354 retval = pnp_activate_dev(dev); 355 355 goto done; 356 356 } 357 - if (!strnicmp(buf, "fill", 4)) { 357 + if (!strncasecmp(buf, "fill", 4)) { 358 358 if (dev->active) 359 359 goto done; 360 360 retval = pnp_auto_config_dev(dev); 361 361 goto done; 362 362 } 363 - if (!strnicmp(buf, "auto", 4)) { 363 + if (!strncasecmp(buf, "auto", 4)) { 364 364 if (dev->active) 365 365 goto done; 366 366 pnp_init_resources(dev); 367 367 retval = pnp_auto_config_dev(dev); 368 368 goto done; 369 369 } 370 - if (!strnicmp(buf, "clear", 5)) { 370 + if (!strncasecmp(buf, "clear", 5)) { 371 371 if (dev->active) 372 372 goto done; 373 373 pnp_init_resources(dev); 374 374 goto done; 375 375 } 376 - if (!strnicmp(buf, "get", 3)) { 376 + if (!strncasecmp(buf, "get", 3)) { 377 377 mutex_lock(&pnp_res_mutex); 378 378 if (pnp_can_read(dev)) 379 379 dev->protocol->get(dev); 380 380 mutex_unlock(&pnp_res_mutex); 381 381 goto done; 382 382 } 383 - if (!strnicmp(buf, "set", 3)) { 383 + if (!strncasecmp(buf, "set", 3)) { 384 384 resource_size_t start; 385 385 resource_size_t end; 386 386 unsigned long flags; ··· 392 392 mutex_lock(&pnp_res_mutex); 393 393 while (1) { 394 394 buf = skip_spaces(buf); 395 - if (!strnicmp(buf, "io", 2)) { 395 + if (!strncasecmp(buf, "io", 2)) { 396 396 buf = pnp_get_resource_value(buf + 2, 397 397 IORESOURCE_IO, 398 398 &start, &end, 399 399 &flags); 400 400 pnp_add_io_resource(dev, start, end, flags); 401 - } else if (!strnicmp(buf, "mem", 3)) { 401 + } else if (!strncasecmp(buf, "mem", 3)) { 402 402 buf = pnp_get_resource_value(buf + 3, 403 403 IORESOURCE_MEM, 404 404 &start, &end, 405 405 &flags); 406 406 pnp_add_mem_resource(dev, start, end, flags); 407 - } else if (!strnicmp(buf, "irq", 3)) { 407 + } else if (!strncasecmp(buf, "irq", 3)) { 408 408 buf = pnp_get_resource_value(buf + 3, 409 409 IORESOURCE_IRQ, 410 410 &start, NULL, 411 411 &flags); 412 412 pnp_add_irq_resource(dev, start, flags); 413 - } else if (!strnicmp(buf, "dma", 3)) { 413 + } else if (!strncasecmp(buf, "dma", 3)) { 414 414 buf = pnp_get_resource_value(buf + 3, 415 415 IORESOURCE_DMA, 416 416 &start, NULL, 417 417 &flags); 418 418 pnp_add_dma_resource(dev, start, flags); 419 - } else if (!strnicmp(buf, "bus", 3)) { 419 + } else if (!strncasecmp(buf, "bus", 3)) { 420 420 buf = pnp_get_resource_value(buf + 3, 421 421 IORESOURCE_BUS, 422 422 &start, &end,