Skip to contentSkip to conversation

staging: gdm724x: gdm_tty: replaced macro with a function

PATCH In review Antoni Przybylik 3 participants 5 messages Sep 2, 2020 – Sep 4, 2020 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/2 staging: gdm724x: gdm_tty: replaced macro with a function

Changed return type to bool and removed inline specifier. Also added
static specifier.

---
 drivers/staging/gdm724x/gdm_tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/gdm724x/gdm_tty.c +1 -1
index 34a13d98c029..179fc9b9400b 100644
@@ -34,7 +34,7 @@ static DEFINE_MUTEX(gdm_table_lock);
 static const char *DRIVER_STRING[TTY_MAX_COUNT] = {"GCTATC", "GCTDM"};
 static char *DEVICE_STRING[TTY_MAX_COUNT] = {"GCT-ATC", "GCT-DM"};
 
-inline int gdm_tty_ready(struct gdm *gdm)
+static bool gdm_tty_ready(struct gdm *gdm)
 {
 	return (gdm && gdm->tty_dev && gdm->port.count);
 }
Signature · 1 line
2.28.0
#1 lore raw
Quoted 2 lines · Antoni Przybylik

Changed return type to bool and removed inline specifier. Also added
static specifier.

why remove the inline specifier?
thanks.

Quoted 19 lines
---
 drivers/staging/gdm724x/gdm_tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/gdm724x/gdm_tty.c +1 -1
index 34a13d98c029..179fc9b9400b 100644
@@ -34,7 +34,7 @@ static DEFINE_MUTEX(gdm_table_lock);
 static const char *DRIVER_STRING[TTY_MAX_COUNT] = {"GCTATC", "GCTDM"};
 static char *DEVICE_STRING[TTY_MAX_COUNT] = {"GCT-ATC", "GCT-DM"};
 
-inline int gdm_tty_ready(struct gdm *gdm)
+static bool gdm_tty_ready(struct gdm *gdm)
 {
 	return (gdm && gdm->tty_dev && gdm->port.count);
 }
Signature · 1 line
~Randy
#2 lore raw
Quoted 4 lines · Randy Dunlap
Quoted 2 lines · Antoni Przybylik

Changed return type to bool and removed inline specifier. Also added
static specifier.

why remove the inline specifier?

Greg KH wrote to me:

And really, no need to make it inline, just make it a normal function and the compiler will inline it if needed.

Quoted 15 lines

thanks.

Quoted 13 lines
---
  drivers/staging/gdm724x/gdm_tty.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/gdm724x/gdm_tty.c +0 -0
index 34a13d98c029..179fc9b9400b 100644
@@ -34,7 +34,7 @@ static DEFINE_MUTEX(gdm_table_lock);
  static const char *DRIVER_STRING[TTY_MAX_COUNT] = {"GCTATC", "GCTDM"};
  static char *DEVICE_STRING[TTY_MAX_COUNT] = {"GCT-ATC", "GCT-DM"};
 
Quoted 7 lines

drivers/staging/gdm724x/gdm_tty.c static DEFINE_MUTEX(gdm_table_lock); · line 40

Quoted 6 lines
drivers/staging/gdm724x/gdm_tty.c +1 -1
-inline int gdm_tty_ready(struct gdm *gdm)
+static bool gdm_tty_ready(struct gdm *gdm)
  {
  	return (gdm && gdm->tty_dev && gdm->port.count);
  }

Antoni Przybylik

#3 lore raw
Quoted 12 lines · On 9/2/20 10:07 AM, [email protected] wrote:
Quoted 4 lines · Randy Dunlap
Quoted 2 lines · Antoni Przybylik

Changed return type to bool and removed inline specifier. Also added static specifier.

why remove the inline specifier?

Greg KH wrote to me:

And really, no need to make it inline, just make it a normal function and the compiler will inline it if needed.

Quoted 1 line

thanks.

OK, thanks.
Sometimes the compiler will also ignore inline if it wants to. That's why we have to use __always_inline.

Quoted 21 lines
Quoted 6 lines
Quoted 6 lines

---
  drivers/staging/gdm724x/gdm_tty.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/staging/gdm724x/gdm_tty.c static DEFINE_MUTEX(gdm_table_lock); · line 40

Quoted 13 lines
drivers/staging/gdm724x/gdm_tty.c +1 -0
index 34a13d98c029..179fc9b9400b 100644
@@ -34,7 +34,7 @@ static DEFINE_MUTEX(gdm_table_lock);
   static const char *DRIVER_STRING[TTY_MAX_COUNT] = {"GCTATC", "GCTDM"};
   static char *DEVICE_STRING[TTY_MAX_COUNT] = {"GCT-ATC", "GCT-DM"};
   -inline int gdm_tty_ready(struct gdm *gdm)
+static bool gdm_tty_ready(struct gdm *gdm)
   {
       return (gdm && gdm->tty_dev && gdm->port.count);
   }

Antoni Przybylik

Signature · 2 lines
~Randy
Reported-by: Randy Dunlap <[email protected]>
maintainer
#4 lore raw
In reply to Antoni Przybylik
Quoted 7 lines · Antoni Przybylik

Changed return type to bool and removed inline specifier. Also added
static specifier.

---
 drivers/staging/gdm724x/gdm_tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

You sent 2 patches with the identical subject line, yet they did different things :(

Please fix them both up and resend.

thanks,

greg k-h