Commit 7ac57347 authored by Soren Brinkmann's avatar Soren Brinkmann Committed by Greg Kroah-Hartman

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: default avatarSoren Brinkmann <soren.brinkmann@xilinx.com>
Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d3641f64
...@@ -411,6 +411,7 @@ static unsigned int xuartps_set_baud_rate(struct uart_port *port, ...@@ -411,6 +411,7 @@ static unsigned int xuartps_set_baud_rate(struct uart_port *port,
return calc_baud; return calc_baud;
} }
#ifdef CONFIG_COMMON_CLK
/** /**
* xuartps_clk_notitifer_cb - Clock notifier callback * xuartps_clk_notitifer_cb - Clock notifier callback
* @nb: Notifier block * @nb: Notifier block
...@@ -504,6 +505,7 @@ static int xuartps_clk_notifier_cb(struct notifier_block *nb, ...@@ -504,6 +505,7 @@ static int xuartps_clk_notifier_cb(struct notifier_block *nb,
return NOTIFY_DONE; return NOTIFY_DONE;
} }
} }
#endif
/*----------------------Uart Operations---------------------------*/ /*----------------------Uart Operations---------------------------*/
...@@ -1380,11 +1382,13 @@ static int xuartps_probe(struct platform_device *pdev) ...@@ -1380,11 +1382,13 @@ static int xuartps_probe(struct platform_device *pdev)
goto err_out_clk_disable; goto err_out_clk_disable;
} }
#ifdef CONFIG_COMMON_CLK
xuartps_data->clk_rate_change_nb.notifier_call = xuartps_data->clk_rate_change_nb.notifier_call =
xuartps_clk_notifier_cb; xuartps_clk_notifier_cb;
if (clk_notifier_register(xuartps_data->refclk, if (clk_notifier_register(xuartps_data->refclk,
&xuartps_data->clk_rate_change_nb)) &xuartps_data->clk_rate_change_nb))
dev_warn(&pdev->dev, "Unable to register clock notifier.\n"); dev_warn(&pdev->dev, "Unable to register clock notifier.\n");
#endif
/* Initialize the port structure */ /* Initialize the port structure */
port = xuartps_get_port(); port = xuartps_get_port();
...@@ -1415,8 +1419,10 @@ static int xuartps_probe(struct platform_device *pdev) ...@@ -1415,8 +1419,10 @@ static int xuartps_probe(struct platform_device *pdev)
} }
err_out_notif_unreg: err_out_notif_unreg:
#ifdef CONFIG_COMMON_CLK
clk_notifier_unregister(xuartps_data->refclk, clk_notifier_unregister(xuartps_data->refclk,
&xuartps_data->clk_rate_change_nb); &xuartps_data->clk_rate_change_nb);
#endif
err_out_clk_disable: err_out_clk_disable:
clk_disable_unprepare(xuartps_data->refclk); clk_disable_unprepare(xuartps_data->refclk);
err_out_clk_dis_aper: err_out_clk_dis_aper:
...@@ -1438,8 +1444,10 @@ static int xuartps_remove(struct platform_device *pdev) ...@@ -1438,8 +1444,10 @@ static int xuartps_remove(struct platform_device *pdev)
int rc; int rc;
/* Remove the xuartps port from the serial core */ /* Remove the xuartps port from the serial core */
#ifdef CONFIG_COMMON_CLK
clk_notifier_unregister(xuartps_data->refclk, clk_notifier_unregister(xuartps_data->refclk,
&xuartps_data->clk_rate_change_nb); &xuartps_data->clk_rate_change_nb);
#endif
rc = uart_remove_one_port(&xuartps_uart_driver, port); rc = uart_remove_one_port(&xuartps_uart_driver, port);
port->mapbase = 0; port->mapbase = 0;
clk_disable_unprepare(xuartps_data->refclk); clk_disable_unprepare(xuartps_data->refclk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment