Skip to contentSkip to conversation

fat: remove unused fat_tolower() and use to_lower() instead

PATCH In review George Hu 2 participants 2 messages Feb 4 VFAT/FAT/msdos filesystem

lore
Share & tools
lore

George Hu

author
#0 lore raw

PATCH 1/1 fat: remove unused fat_tolower() and use to_lower() instead

The fat_tolower() function is redundant, as it is functionally equivalent to the to_lower() macro defined in include/linux/ctype.h.

---
 fs/fat/dir.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
fs/fat/dir.c +3 -7
index 92b091783966..4f46d2358185 100644
@@ -18,6 +18,7 @@
 #include <linux/compat.h>
 #include <linux/uaccess.h>
 #include <linux/iversion.h>
+#include <linux/ctype.h>
 #include "fat.h"
 
 /*
@@ -33,11 +34,6 @@
 #define FAT_MAX_UNI_CHARS	((MSDOS_SLOTS - 1) * 13 + 1)
 #define FAT_MAX_UNI_SIZE	(FAT_MAX_UNI_CHARS * sizeof(wchar_t))
 
-static inline unsigned char fat_tolower(unsigned char c)
-{
-	return ((c >= 'A') && (c <= 'Z')) ? c+32 : c;
-}
-
 static inline loff_t fat_make_i_pos(struct super_block *sb,
 				    struct buffer_head *bh,
 				    struct msdos_dir_entry *de)
@@ -396,7 +392,7 @@ static int fat_parse_short(struct super_block *sb,
 					de->lcase & CASE_LOWER_BASE);
 		if (chl <= 1) {
 			if (!isvfat)
-				ptname[i] = nocase ? c : fat_tolower(c);
+				ptname[i] = nocase ? c : tolower(c);
 			i++;
 			if (c != ' ') {
 				name_len = i;
@@ -433,7 +429,7 @@ static int fat_parse_short(struct super_block *sb,
 		if (chl <= 1) {
 			k++;
 			if (!isvfat)
-				ptname[i] = nocase ? c : fat_tolower(c);
+				ptname[i] = nocase ? c : tolower(c);
 			i++;
 			if (c != ' ') {
 				name_len = i;
Signature · 1 line
2.52.0
maintainer
#1 lore raw
Quoted 2 lines · George Hu

The fat_tolower() function is redundant, as it is functionally equivalent to the to_lower() macro defined in include/linux/ctype.h.

No, it is not equivalent.

Thanks.

Quoted 47 lines
---
 fs/fat/dir.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
fs/fat/dir.c +3 -7
index 92b091783966..4f46d2358185 100644
@@ -18,6 +18,7 @@
 #include <linux/compat.h>
 #include <linux/uaccess.h>
 #include <linux/iversion.h>
+#include <linux/ctype.h>
 #include "fat.h"
 
 /*
@@ -33,11 +34,6 @@
 #define FAT_MAX_UNI_CHARS	((MSDOS_SLOTS - 1) * 13 + 1)
 #define FAT_MAX_UNI_SIZE	(FAT_MAX_UNI_CHARS * sizeof(wchar_t))
 
-static inline unsigned char fat_tolower(unsigned char c)
-{
-	return ((c >= 'A') && (c <= 'Z')) ? c+32 : c;
-}
-
 static inline loff_t fat_make_i_pos(struct super_block *sb,
 				    struct buffer_head *bh,
 				    struct msdos_dir_entry *de)
@@ -396,7 +392,7 @@ static int fat_parse_short(struct super_block *sb,
 					de->lcase & CASE_LOWER_BASE);
 		if (chl <= 1) {
 			if (!isvfat)
-				ptname[i] = nocase ? c : fat_tolower(c);
+				ptname[i] = nocase ? c : tolower(c);
 			i++;
 			if (c != ' ') {
 				name_len = i;
@@ -433,7 +429,7 @@ static int fat_parse_short(struct super_block *sb,
 		if (chl <= 1) {
 			k++;
 			if (!isvfat)
-				ptname[i] = nocase ? c : fat_tolower(c);
+				ptname[i] = nocase ? c : tolower(c);
 			i++;
 			if (c != ' ') {
 				name_len = i;
Signature · 1 line
OGAWA Hirofumi <[email protected]>