[PATCH] usb: gadget: configfs: Make check_user_usb_string() static
From: Christophe JAILLET
Date: Sat Aug 10 2024 - 16:53:54 EST
"linux/usb/gadget_configfs.h" is only included in
"drivers/usb/gadget/configfs.c", so there is no need to declare a function
in the header file. it is only used in this .c file.
It's better to have it static.
Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
I've not checked, but I suspect gcc to both inline check_user_usb_string()
in its only caller and keep it as-is for any potential other callers.
Before:
======
$ size drivers/usb/gadget/configfs.o
text data bss dec hex filename
41197 5120 64 46381 b52d drivers/usb/gadget/configfs.o
After:
=====
text data bss dec hex filename
40834 5112 64 46010 b3ba drivers/usb/gadget/configfs.o
---
drivers/usb/gadget/configfs.c | 2 +-
include/linux/usb/gadget_configfs.h | 3 ---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 0e7c1e947c0a..e0bf2b2bfc01 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -12,7 +12,7 @@
#include "u_f.h"
#include "u_os_desc.h"
-int check_user_usb_string(const char *name,
+static int check_user_usb_string(const char *name,
struct usb_gadget_strings *stringtab_dev)
{
u16 num;
diff --git a/include/linux/usb/gadget_configfs.h b/include/linux/usb/gadget_configfs.h
index d61aebd68128..6a552dd4dec9 100644
--- a/include/linux/usb/gadget_configfs.h
+++ b/include/linux/usb/gadget_configfs.h
@@ -4,9 +4,6 @@
#include <linux/configfs.h>
-int check_user_usb_string(const char *name,
- struct usb_gadget_strings *stringtab_dev);
-
#define GS_STRINGS_W(__struct, __name) \
static ssize_t __struct##_##__name##_store(struct config_item *item, \
const char *page, size_t len) \
--
2.46.0