X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH 17/22] thinkpad_acpi: Replace strnicmp with strncasecmp
       [not found] <1410900696-6481-1-git-send-email-linux@rasmusvillemoes.dk>
@ 2014-09-16 20:51 ` Rasmus Villemoes
  2014-09-16 22:08   ` Darren Hart
  0 siblings, 1 reply; 3+ messages in thread
From: Rasmus Villemoes @ 2014-09-16 20:51 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, Rasmus Villemoes, Henrique de Moraes Holschuh,
	Darren Hart, ibm-acpi-devel, platform-driver-x86

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.

Cc: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
Cc: Darren Hart <dvhart@infradead.org>
Cc: ibm-acpi-devel@lists.sourceforge.net
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/platform/x86/thinkpad_acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 3bbc6eb..f6a14c0 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -8878,13 +8878,13 @@ static int __must_check __init get_thinkpad_model_data(
 	}
 
 	s = dmi_get_system_info(DMI_PRODUCT_VERSION);
-	if (s && !(strnicmp(s, "ThinkPad", 8) && strnicmp(s, "Lenovo", 6))) {
+	if (s && !(strncasecmp(s, "ThinkPad", 8) && strncasecmp(s, "Lenovo", 6))) {
 		tp->model_str = kstrdup(s, GFP_KERNEL);
 		if (!tp->model_str)
 			return -ENOMEM;
 	} else {
 		s = dmi_get_system_info(DMI_BIOS_VENDOR);
-		if (s && !(strnicmp(s, "Lenovo", 6))) {
+		if (s && !(strncasecmp(s, "Lenovo", 6))) {
 			tp->model_str = kstrdup(s, GFP_KERNEL);
 			if (!tp->model_str)
 				return -ENOMEM;
-- 
2.0.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 17/22] thinkpad_acpi: Replace strnicmp with strncasecmp
  2014-09-16 20:51 ` [PATCH 17/22] thinkpad_acpi: Replace strnicmp with strncasecmp Rasmus Villemoes
@ 2014-09-16 22:08   ` Darren Hart
  2014-09-17  8:12     ` Rasmus Villemoes
  0 siblings, 1 reply; 3+ messages in thread
From: Darren Hart @ 2014-09-16 22:08 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Andrew Morton, linux-kernel, Henrique de Moraes Holschuh,
	ibm-acpi-devel, platform-driver-x86

On Tue, Sep 16, 2014 at 10:51:31PM +0200, Rasmus Villemoes wrote:
> 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.

When was this done? As of this morning I still see them as independent functions
in lib/string.c.

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 17/22] thinkpad_acpi: Replace strnicmp with strncasecmp
  2014-09-16 22:08   ` Darren Hart
@ 2014-09-17  8:12     ` Rasmus Villemoes
  0 siblings, 0 replies; 3+ messages in thread
From: Rasmus Villemoes @ 2014-09-17  8:12 UTC (permalink / raw)
  To: Darren Hart
  Cc: Andrew Morton, linux-kernel, Henrique de Moraes Holschuh,
	ibm-acpi-devel, platform-driver-x86

On Wed, Sep 17 2014, Darren Hart <dvhart@infradead.org> wrote:

> On Tue, Sep 16, 2014 at 10:51:31PM +0200, Rasmus Villemoes wrote:
>> 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.
>
> When was this done? As of this morning I still see them as independent functions
> in lib/string.c.

It will be in 3.18. I thought it had made it to linux-next, but should
have double-checked (and included the 3.18 info in the email); sorry.

http://thread.gmane.org/gmane.linux.kernel/1775150/focus=1775152

Rasmus

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-17  8:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1410900696-6481-1-git-send-email-linux@rasmusvillemoes.dk>
2014-09-16 20:51 ` [PATCH 17/22] thinkpad_acpi: Replace strnicmp with strncasecmp Rasmus Villemoes
2014-09-16 22:08   ` Darren Hart
2014-09-17  8:12     ` Rasmus Villemoes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox