tty: xuartps: Fix build error when COMMON_CLK is not set
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>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index ca4a2f1..e46e9f3 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -411,6 +411,7 @@
return calc_baud;
}
+#ifdef CONFIG_COMMON_CLK
/**
* xuartps_clk_notitifer_cb - Clock notifier callback
* @nb: Notifier block
@@ -504,6 +505,7 @@
return NOTIFY_DONE;
}
}
+#endif
/*----------------------Uart Operations---------------------------*/
@@ -1380,11 +1382,13 @@
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 @@
}
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 @@
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);