linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: of_serial: remove NULL pointer check for clk_disable_unprepare
@ 2017-05-20 17:44 Masahiro Yamada
  2017-05-20 19:04 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2017-05-20 17:44 UTC (permalink / raw)
  To: linux-serial
  Cc: Masahiro Yamada, Arnd Bergmann, Robert Jarzmik, Sekhar Nori,
	Jiri Slaby, linux-kernel, David Lechner, Thor Thayer,
	Greg Kroah-Hartman

After long term efforts of fixing non-common clock implementations,
clk_disable() is a no-op for a NULL pointer input, and this is now
tree-wide consistent.

All clock consumers can safely call clk_disable(_unprepare) without
NULL pointer check.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/tty/serial/8250/8250_of.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
index 1cbadaf..89ba2b5 100644
--- a/drivers/tty/serial/8250/8250_of.c
+++ b/drivers/tty/serial/8250/8250_of.c
@@ -159,8 +159,8 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
 
 	return 0;
 out:
-	if (info->clk)
-		clk_disable_unprepare(info->clk);
+	clk_disable_unprepare(info->clk);
+
 	return ret;
 }
 
@@ -229,8 +229,8 @@ static int of_platform_serial_remove(struct platform_device *ofdev)
 
 	serial8250_unregister_port(info->line);
 
-	if (info->clk)
-		clk_disable_unprepare(info->clk);
+	clk_disable_unprepare(info->clk);
+
 	kfree(info);
 	return 0;
 }
@@ -244,7 +244,7 @@ static int of_serial_suspend(struct device *dev)
 
 	serial8250_suspend_port(info->line);
 
-	if (info->clk && (!uart_console(port) || console_suspend_enabled))
+	if (!uart_console(port) || console_suspend_enabled)
 		clk_disable_unprepare(info->clk);
 
 	return 0;
-- 
2.7.4

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

* Re: [PATCH] serial: of_serial: remove NULL pointer check for clk_disable_unprepare
  2017-05-20 17:44 [PATCH] serial: of_serial: remove NULL pointer check for clk_disable_unprepare Masahiro Yamada
@ 2017-05-20 19:04 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2017-05-20 19:04 UTC (permalink / raw)
  To: linux-serial
  Cc: Masahiro Yamada, Arnd Bergmann, Robert Jarzmik, Sekhar Nori,
	Jiri Slaby, Linux Kernel Mailing List, David Lechner,
	Thor Thayer, Greg Kroah-Hartman

2017-05-21 2:44 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> After long term efforts of fixing non-common clock implementations,
> clk_disable() is a no-op for a NULL pointer input, and this is now
> tree-wide consistent.
>
> All clock consumers can safely call clk_disable(_unprepare) without
> NULL pointer check.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


Sorry, I retract this patch.

Krzysztof pointed out
cleanups only for clk_disable_unprepare() will lose the code symmetry.

NULL pointer checks for clk_prepare_enable() should be
removed to keep the code symmetrical.

This is possible for common-clock framework because
clk_prepare_enable() is also a no-op for a NULL clk input.
But it is not necessarily true for non-common clock implementations.


-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2017-05-20 19:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-20 17:44 [PATCH] serial: of_serial: remove NULL pointer check for clk_disable_unprepare Masahiro Yamada
2017-05-20 19:04 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).