Skip to contentSkip to conversation

powerpc: booke_wdt: Fix build error as a module

PATCH Superseded Pranith Kumar 3 participants 8 messages Aug 20, 2014 – Aug 25, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: booke_wdt: Fix build error as a module

Building booke_wdt fails when trying to build as a module as there is no early_param() in module. Fix by using module_param() instead of early_param().

---
 drivers/watchdog/booke_wdt.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
drivers/watchdog/booke_wdt.c +5 -23
index 08a7853..65f5e9f 100644
@@ -30,8 +30,6 @@
  * occur, and the final time the board will reset.
  */
 
-u32 booke_wdt_enabled;
-u32 booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT;
 
 #ifdef	CONFIG_PPC_FSL_BOOK3E
 #define WDTP(x)		((((x)&0x3)<<30)|(((x)&0x3c)<<15))
@@ -41,27 +39,10 @@ u32 booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT;
 #define WDTP_MASK	(TCR_WP_MASK)
 #endif
 
-/* Checks wdt=x and wdt_period=xx command-line option */
-notrace int __init early_parse_wdt(char *p)
-{
-	if (p && strncmp(p, "0", 1) != 0)
-		booke_wdt_enabled = 1;
-
-	return 0;
-}
-early_param("wdt", early_parse_wdt);
-
-int __init early_parse_wdt_period(char *p)
-{
-	unsigned long ret;
-	if (p) {
-		if (!kstrtol(p, 0, &ret))
-			booke_wdt_period = ret;
-	}
-
-	return 0;
-}
-early_param("wdt_period", early_parse_wdt_period);
+static bool booke_wdt_enabled = true;
+module_param(booke_wdt_enabled, bool, 0444);
+static int  booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT;
+module_param(booke_wdt_period, int, 0444);
 
 #ifdef CONFIG_PPC_FSL_BOOK3E
 
@@ -259,5 +240,6 @@ static int __init booke_wdt_init(void)
 module_init(booke_wdt_init);
 module_exit(booke_wdt_exit);
 
+MODULE_ALIAS("booke_wdt");
 MODULE_DESCRIPTION("PowerPC Book-E watchdog driver");
 MODULE_LICENSE("GPL");
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 serial: Fix build failure caused by missing header file

Fix build failure caused by missing header file:

drivers/tty/serial/nwpserial.c: In function 'wait_for_bits':
drivers/tty/serial/nwpserial.c:53:3: error: implicit declaration of function 'udelay' [-Werror=implicit-function-declaration]

---
 drivers/tty/serial/nwpserial.c | 1 +
 1 file changed, 1 insertion(+)
drivers/tty/serial/nwpserial.c +1 -0
index c06366b..5da7622 100644
@@ -22,6 +22,7 @@
 #include <linux/of_platform.h>
 #include <linux/of_device.h>
 #include <linux/nwpserial.h>
+#include <linux/delay.h>
 #include <asm/prom.h>
 #include <asm/dcr.h>
 
Signature · 1 line
1.9.1
maintainer
#5 lore raw
In reply to Pranith Kumar
Quoted 38 lines · Pranith Kumar

Building booke_wdt fails when trying to build as a module as there is no early_param() in module. Fix by using module_param() instead of early_param().

---
 drivers/watchdog/booke_wdt.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
drivers/watchdog/booke_wdt.c +0 -14
index 08a7853..65f5e9f 100644
@@ -30,8 +30,6 @@
  * occur, and the final time the board will reset.
  */
 
-u32 booke_wdt_enabled;
-u32 booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT;
 
 #ifdef	CONFIG_PPC_FSL_BOOK3E
 #define WDTP(x)		((((x)&0x3)<<30)|(((x)&0x3c)<<15))
@@ -41,27 +39,10 @@ u32 booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT;
 #define WDTP_MASK	(TCR_WP_MASK)
 #endif
 
-/* Checks wdt=x and wdt_period=xx command-line option */
-notrace int __init early_parse_wdt(char *p)
-{
-	if (p && strncmp(p, "0", 1) != 0)
-		booke_wdt_enabled = 1;
-
-	return 0;
-}
-early_param("wdt", early_parse_wdt);
-
-int __init early_parse_wdt_period(char *p)
-{

drivers/watchdog/booke_wdt.c u32 booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT; · line 42

Quoted 10 lines
drivers/watchdog/booke_wdt.c +1 -9
-	unsigned long ret;
-	if (p) {
-		if (!kstrtol(p, 0, &ret))
-			booke_wdt_period = ret;
-	}
-
-	return 0;
-}
-early_param("wdt_period", early_parse_wdt_period);
+static bool booke_wdt_enabled = true;

Any reason for changing the default from false to true ? Unless you have a reaslly good reason, I don't think that is a good idea.

drivers/watchdog/booke_wdt.c u32 booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT; · line 46

Quoted 4 lines
drivers/watchdog/booke_wdt.c +3 -0
+module_param(booke_wdt_enabled, bool, 0444);
+static int  booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT;
+module_param(booke_wdt_period, int, 0444);
 

Also not sure if it adds value to have the module parameters visible from user space. Why not use 0 for the permission flags ?

Thanks,
Guenter

#6 lore raw
Quoted 44 lines · Guenter
Quoted 43 lines · Pranith Kumar

Building booke_wdt fails when trying to build as a module as there is no early_param() in module. Fix by using module_param() instead of early_param().

---
 drivers/watchdog/booke_wdt.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
drivers/watchdog/booke_wdt.c +0 -19
index 08a7853..65f5e9f 100644
@@ -30,8 +30,6 @@
  * occur, and the final time the board will reset.
  */
 
-u32 booke_wdt_enabled;
-u32 booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT;
 
 #ifdef       CONFIG_PPC_FSL_BOOK3E
 #define WDTP(x)              ((((x)&0x3)<<30)|(((x)&0x3c)<<15))
@@ -41,27 +39,10 @@ u32 booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT;
 #define WDTP_MASK    (TCR_WP_MASK)
 #endif
 
-/* Checks wdt=x and wdt_period=xx command-line option */
-notrace int __init early_parse_wdt(char *p)
-{
-     if (p && strncmp(p, "0", 1) != 0)
-             booke_wdt_enabled = 1;
-
-     return 0;
-}
-early_param("wdt", early_parse_wdt);
-
-int __init early_parse_wdt_period(char *p)
-{
-     unsigned long ret;
-     if (p) {
-             if (!kstrtol(p, 0, &ret))
-                     booke_wdt_period = ret;
-     }
Quoted 8 lines

drivers/watchdog/booke_wdt.c u32 booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT; · line 42

Quoted 5 lines
drivers/watchdog/booke_wdt.c +1 -4
-
-     return 0;
-}
-early_param("wdt_period", early_parse_wdt_period);
+static bool booke_wdt_enabled = true;

Any reason for changing the default from false to true ? Unless you have a reaslly good reason, I don't think that is a good idea.

I don't see where it was being set to false. It is uninitialized AFAICT. Does that mean that it is false? (I thought only static variables got that default).

Quoted 8 lines

drivers/watchdog/booke_wdt.c u32 booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT; · line 46

Quoted 5 lines
drivers/watchdog/booke_wdt.c +3 -0
+module_param(booke_wdt_enabled, bool, 0444);
+static int  booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT;
+module_param(booke_wdt_period, int, 0444);
 

Also not sure if it adds value to have the module parameters visible from user space. Why not use 0 for the permission flags ?

I have no objection to your suggestion. But not sure if such paranoia is warranted :)

Signature · 1 line
Pranith
#7 lore raw
Quoted 9 lines · Pranith Kumar
Quoted 3 lines · Guenter

Any reason for changing the default from false to true ? Unless you have a reaslly good reason, I don't think that is a good idea.

I don't see where it was being set to false. It is uninitialized AFAICT. Does that mean that it is false? (I thought only static variables got that default).

Ohk, some googling tells me both global and static variables are initialized to 0. Makes sense, I will send in a v2

Signature · 1 line
Pranith
#2 lore raw

Re: [PATCH] serial: Fix build failure caused by missing header file

In reply to Pranith Kumar
Quoted 9 lines · Pranith Kumar

Fix build failure caused by missing header file:

drivers/tty/serial/nwpserial.c: In function 'wait_for_bits':
drivers/tty/serial/nwpserial.c:53:3: error: implicit declaration of function 'udelay' [-Werror=implicit-function-declaration]

---
 drivers/tty/serial/nwpserial.c | 1 +
 1 file changed, 1 insertion(+)

Where is this failing? What arch? What kernel version did it show up in (i.e. what commit caused this problem?)

thanks,

greg k-h

#3 lore raw

Re: [PATCH] serial: Fix build failure caused by missing header file

Quoted 3 lines · Greg Kroah-Hartman

Where is this failing? What arch? What kernel version did it show up in (i.e. what commit caused this problem?)

This was a randconfig on powerpc. I did not bisect as to which commit introduced this since it is a simple missing header file.

Signature · 1 line
Pranith
#4 lore raw

Re: [PATCH] serial: Fix build failure caused by missing header file

Quoted 9 lines · Pranith Kumar
Quoted 3 lines · Greg Kroah-Hartman

Where is this failing? What arch? What kernel version did it show up in (i.e. what commit caused this problem?)

This was a randconfig on powerpc. I did not bisect as to which commit introduced this since it is a simple missing header file.

Ok, so I guess it's not worth getting into 3.17, I'll queue it up for 3.18 in a few days.

thanks,

greg k-h