public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] tty: xuartps: Fix build
@ 2013-10-21 23:40 Soren Brinkmann
  2013-10-21 23:40 ` [PATCH 1/3] tty: xuartps: Fix "may be used uninitialized" build warning Soren Brinkmann
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Soren Brinkmann @ 2013-10-21 23:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Michal Simek
  Cc: linux-kernel, linux-serial, Soren Brinkmann

This should fix the issues in the x86 build of the xuartps driver. The
issues are:
 - [tty:tty-next 72/75] drivers/tty/serial/xilinx_uartps.c:436:7: error:
   'PRE_RATE_CHANGE' undeclared
 - [tty:tty-next 73/75] drivers/tty/serial/xilinx_uartps.c:1227:21:
   error: 'xuartps_uart_driver' undeclared

Additionally I found some build warnings while fixing those issues.

There are some additional comments regarding patches 1 and 3 in their
respective email.
This series is based on the tty-next tree.

	Thanks,
	Sören

Soren Brinkmann (3):
  tty: xuartps: Fix "may be used uninitialized" build warning
  tty: xuartps: Fix build error due to missing forward declaration
  tty: xuartps: Fix build error when COMMON_CLK is not set

 drivers/tty/serial/xilinx_uartps.c | 38 +++++++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 15 deletions(-)

-- 
1.8.4.1


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

* [PATCH 1/3] tty: xuartps: Fix "may be used uninitialized" build warning
  2013-10-21 23:40 [PATCH 0/3] tty: xuartps: Fix build Soren Brinkmann
@ 2013-10-21 23:40 ` Soren Brinkmann
  2013-10-29 16:22   ` Greg Kroah-Hartman
  2013-10-21 23:41 ` [PATCH 2/3] tty: xuartps: Fix build error due to missing forward declaration Soren Brinkmann
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Soren Brinkmann @ 2013-10-21 23:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Michal Simek
  Cc: linux-kernel, linux-serial, Soren Brinkmann

Initialize varibles for which a 'may be used uninitalized' warning is
issued.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
The warning is actually a false positive. The variables are passed to a
function per reference. That function uses those variables to return
values, which then are used by the caller. Is there a way to
avoid the initialization and the build warning alltogether?
---
 drivers/tty/serial/xilinx_uartps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index c7c96c2f149c..5ac6c480df43 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -389,7 +389,7 @@ static unsigned int xuartps_set_baud_rate(struct uart_port *port,
 		unsigned int baud)
 {
 	unsigned int calc_baud;
-	u32 cd, bdiv;
+	u32 cd = 0, bdiv = 0;
 	u32 mreg;
 	int div8;
 	struct xuartps *xuartps = port->private_data;
-- 
1.8.4.1


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

* [PATCH 2/3] tty: xuartps: Fix build error due to missing forward declaration
  2013-10-21 23:40 [PATCH 0/3] tty: xuartps: Fix build Soren Brinkmann
  2013-10-21 23:40 ` [PATCH 1/3] tty: xuartps: Fix "may be used uninitialized" build warning Soren Brinkmann
@ 2013-10-21 23:41 ` Soren Brinkmann
  2013-10-21 23:41 ` [PATCH 3/3] tty: xuartps: Fix build error when COMMON_CLK is not set Soren Brinkmann
  2013-10-29 16:24 ` [PATCH 0/3] tty: xuartps: Fix build Greg Kroah-Hartman
  3 siblings, 0 replies; 8+ messages in thread
From: Soren Brinkmann @ 2013-10-21 23:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Michal Simek
  Cc: linux-kernel, linux-serial, Soren Brinkmann

If CONFIG_PM_SLEEP is enabled and CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
is not, a forward declaration of the uart_driver struct is not
included, leading to a build error due to an undeclared variable.
Fixing this by moving the definition of the struct uart_driver before
the definition of the suspend/resume callbacks.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
 drivers/tty/serial/xilinx_uartps.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 5ac6c480df43..ca4a2f1fbca9 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -1198,6 +1198,20 @@ console_initcall(xuartps_console_init);
 
 #endif /* CONFIG_SERIAL_XILINX_PS_UART_CONSOLE */
 
+/** Structure Definitions
+ */
+static struct uart_driver xuartps_uart_driver = {
+	.owner		= THIS_MODULE,		/* Owner */
+	.driver_name	= XUARTPS_NAME,		/* Driver name */
+	.dev_name	= XUARTPS_TTY_NAME,	/* Node name */
+	.major		= XUARTPS_MAJOR,	/* Major number */
+	.minor		= XUARTPS_MINOR,	/* Minor number */
+	.nr		= XUARTPS_NR_PORTS,	/* Number of UART ports */
+#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
+	.cons		= &xuartps_console,	/* Console */
+#endif
+};
+
 #ifdef CONFIG_PM_SLEEP
 /**
  * xuartps_suspend - suspend event
@@ -1311,20 +1325,6 @@ static int xuartps_resume(struct device *device)
 
 static SIMPLE_DEV_PM_OPS(xuartps_dev_pm_ops, xuartps_suspend, xuartps_resume);
 
-/** Structure Definitions
- */
-static struct uart_driver xuartps_uart_driver = {
-	.owner		= THIS_MODULE,		/* Owner */
-	.driver_name	= XUARTPS_NAME,		/* Driver name */
-	.dev_name	= XUARTPS_TTY_NAME,	/* Node name */
-	.major		= XUARTPS_MAJOR,	/* Major number */
-	.minor		= XUARTPS_MINOR,	/* Minor number */
-	.nr		= XUARTPS_NR_PORTS,	/* Number of UART ports */
-#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
-	.cons		= &xuartps_console,	/* Console */
-#endif
-};
-
 /* ---------------------------------------------------------------------
  * Platform bus binding
  */
-- 
1.8.4.1


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

* [PATCH 3/3] tty: xuartps: Fix build error when COMMON_CLK is not set
  2013-10-21 23:40 [PATCH 0/3] tty: xuartps: Fix build Soren Brinkmann
  2013-10-21 23:40 ` [PATCH 1/3] tty: xuartps: Fix "may be used uninitialized" build warning Soren Brinkmann
  2013-10-21 23:41 ` [PATCH 2/3] tty: xuartps: Fix build error due to missing forward declaration Soren Brinkmann
@ 2013-10-21 23:41 ` Soren Brinkmann
  2013-10-29 16:24 ` [PATCH 0/3] tty: xuartps: Fix build Greg Kroah-Hartman
  3 siblings, 0 replies; 8+ messages in thread
From: Soren Brinkmann @ 2013-10-21 23:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Michal Simek
  Cc: linux-kernel, linux-serial, Soren Brinkmann

Clock notifiers are only available when CONFIG_COMMON_CLK is enabled.
Hence all notifier related code has to be protected by corresponsing
ifdefs.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
Alternatively this could be fixed by adding a dependency on COMMON_CLK
in Kconfig. That would keep the code cleaner, but limit this driver to
platforms using the CCF.
---
 drivers/tty/serial/xilinx_uartps.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index ca4a2f1fbca9..e46e9f3f19b9 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -411,6 +411,7 @@ static unsigned int xuartps_set_baud_rate(struct uart_port *port,
 	return calc_baud;
 }
 
+#ifdef CONFIG_COMMON_CLK
 /**
  * xuartps_clk_notitifer_cb - Clock notifier callback
  * @nb:		Notifier block
@@ -504,6 +505,7 @@ static int xuartps_clk_notifier_cb(struct notifier_block *nb,
 		return NOTIFY_DONE;
 	}
 }
+#endif
 
 /*----------------------Uart Operations---------------------------*/
 
@@ -1380,11 +1382,13 @@ static int xuartps_probe(struct platform_device *pdev)
 		goto err_out_clk_disable;
 	}
 
+#ifdef CONFIG_COMMON_CLK
 	xuartps_data->clk_rate_change_nb.notifier_call =
 			xuartps_clk_notifier_cb;
 	if (clk_notifier_register(xuartps_data->refclk,
 				&xuartps_data->clk_rate_change_nb))
 		dev_warn(&pdev->dev, "Unable to register clock notifier.\n");
+#endif
 
 	/* Initialize the port structure */
 	port = xuartps_get_port();
@@ -1415,8 +1419,10 @@ static int xuartps_probe(struct platform_device *pdev)
 	}
 
 err_out_notif_unreg:
+#ifdef CONFIG_COMMON_CLK
 	clk_notifier_unregister(xuartps_data->refclk,
 			&xuartps_data->clk_rate_change_nb);
+#endif
 err_out_clk_disable:
 	clk_disable_unprepare(xuartps_data->refclk);
 err_out_clk_dis_aper:
@@ -1438,8 +1444,10 @@ static int xuartps_remove(struct platform_device *pdev)
 	int rc;
 
 	/* Remove the xuartps port from the serial core */
+#ifdef CONFIG_COMMON_CLK
 	clk_notifier_unregister(xuartps_data->refclk,
 			&xuartps_data->clk_rate_change_nb);
+#endif
 	rc = uart_remove_one_port(&xuartps_uart_driver, port);
 	port->mapbase = 0;
 	clk_disable_unprepare(xuartps_data->refclk);
-- 
1.8.4.1


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

* Re: [PATCH 1/3] tty: xuartps: Fix "may be used uninitialized" build warning
  2013-10-21 23:40 ` [PATCH 1/3] tty: xuartps: Fix "may be used uninitialized" build warning Soren Brinkmann
@ 2013-10-29 16:22   ` Greg Kroah-Hartman
  2013-10-29 16:39     ` Sören Brinkmann
  0 siblings, 1 reply; 8+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-29 16:22 UTC (permalink / raw)
  To: Soren Brinkmann; +Cc: Jiri Slaby, Michal Simek, linux-kernel, linux-serial

On Mon, Oct 21, 2013 at 04:40:59PM -0700, Soren Brinkmann wrote:
> Initialize varibles for which a 'may be used uninitalized' warning is
> issued.
> 
> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
> ---
> The warning is actually a false positive. The variables are passed to a
> function per reference. That function uses those variables to return
> values, which then are used by the caller. Is there a way to
> avoid the initialization and the build warning alltogether?
> ---
>  drivers/tty/serial/xilinx_uartps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Please properly credit the kbuild robot who found these issues the next
time...

thanks,

greg k-h

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

* Re: [PATCH 0/3] tty: xuartps: Fix build
  2013-10-21 23:40 [PATCH 0/3] tty: xuartps: Fix build Soren Brinkmann
                   ` (2 preceding siblings ...)
  2013-10-21 23:41 ` [PATCH 3/3] tty: xuartps: Fix build error when COMMON_CLK is not set Soren Brinkmann
@ 2013-10-29 16:24 ` Greg Kroah-Hartman
  2013-10-29 16:26   ` Greg Kroah-Hartman
  3 siblings, 1 reply; 8+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-29 16:24 UTC (permalink / raw)
  To: Soren Brinkmann; +Cc: Jiri Slaby, Michal Simek, linux-kernel, linux-serial

On Mon, Oct 21, 2013 at 04:40:58PM -0700, Soren Brinkmann wrote:
> This should fix the issues in the x86 build of the xuartps driver. The
> issues are:
>  - [tty:tty-next 72/75] drivers/tty/serial/xilinx_uartps.c:436:7: error:
>    'PRE_RATE_CHANGE' undeclared
>  - [tty:tty-next 73/75] drivers/tty/serial/xilinx_uartps.c:1227:21:
>    error: 'xuartps_uart_driver' undeclared
> 
> Additionally I found some build warnings while fixing those issues.
> 
> There are some additional comments regarding patches 1 and 3 in their
> respective email.
> This series is based on the tty-next tree.

No it isn't, it doesn't apply there at all.  Please respin these against
the latest tty-next branch and resend them so that I can apply them.

thanks,

greg k-h

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

* Re: [PATCH 0/3] tty: xuartps: Fix build
  2013-10-29 16:24 ` [PATCH 0/3] tty: xuartps: Fix build Greg Kroah-Hartman
@ 2013-10-29 16:26   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-29 16:26 UTC (permalink / raw)
  To: Soren Brinkmann; +Cc: Jiri Slaby, Michal Simek, linux-kernel, linux-serial

On Tue, Oct 29, 2013 at 09:24:57AM -0700, Greg Kroah-Hartman wrote:
> On Mon, Oct 21, 2013 at 04:40:58PM -0700, Soren Brinkmann wrote:
> > This should fix the issues in the x86 build of the xuartps driver. The
> > issues are:
> >  - [tty:tty-next 72/75] drivers/tty/serial/xilinx_uartps.c:436:7: error:
> >    'PRE_RATE_CHANGE' undeclared
> >  - [tty:tty-next 73/75] drivers/tty/serial/xilinx_uartps.c:1227:21:
> >    error: 'xuartps_uart_driver' undeclared
> > 
> > Additionally I found some build warnings while fixing those issues.
> > 
> > There are some additional comments regarding patches 1 and 3 in their
> > respective email.
> > This series is based on the tty-next tree.
> 
> No it isn't, it doesn't apply there at all.  Please respin these against
> the latest tty-next branch and resend them so that I can apply them.

Doh, nevermind, I was using the wrong branch of that tree, sorry, my
fault.

/me needs more coffee...

greg k-h

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

* Re: [PATCH 1/3] tty: xuartps: Fix "may be used uninitialized" build warning
  2013-10-29 16:22   ` Greg Kroah-Hartman
@ 2013-10-29 16:39     ` Sören Brinkmann
  0 siblings, 0 replies; 8+ messages in thread
From: Sören Brinkmann @ 2013-10-29 16:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Jiri Slaby, Michal Simek, linux-kernel, linux-serial

On Tue, Oct 29, 2013 at 09:22:52AM -0700, Greg Kroah-Hartman wrote:
> On Mon, Oct 21, 2013 at 04:40:59PM -0700, Soren Brinkmann wrote:
> > Initialize varibles for which a 'may be used uninitalized' warning is
> > issued.
> > 
> > Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
> > ---
> > The warning is actually a false positive. The variables are passed to a
> > function per reference. That function uses those variables to return
> > values, which then are used by the caller. Is there a way to
> > avoid the initialization and the build warning alltogether?
> > ---
> >  drivers/tty/serial/xilinx_uartps.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Please properly credit the kbuild robot who found these issues the next
> time...

Sorry for that. I'll do that next time.

	Thanks,
	Sören



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

end of thread, other threads:[~2013-10-29 16:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-21 23:40 [PATCH 0/3] tty: xuartps: Fix build Soren Brinkmann
2013-10-21 23:40 ` [PATCH 1/3] tty: xuartps: Fix "may be used uninitialized" build warning Soren Brinkmann
2013-10-29 16:22   ` Greg Kroah-Hartman
2013-10-29 16:39     ` Sören Brinkmann
2013-10-21 23:41 ` [PATCH 2/3] tty: xuartps: Fix build error due to missing forward declaration Soren Brinkmann
2013-10-21 23:41 ` [PATCH 3/3] tty: xuartps: Fix build error when COMMON_CLK is not set Soren Brinkmann
2013-10-29 16:24 ` [PATCH 0/3] tty: xuartps: Fix build Greg Kroah-Hartman
2013-10-29 16:26   ` Greg Kroah-Hartman

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