Thread (155 messages) 155 messages, 19 authors, 2011-05-10
STALE5515d

[PATCH 01/10] Add a common struct clk

From: Rob Herring <hidden>
Date: 2011-05-02 03:09:24

Jeremy,

On 05/01/2011 08:09 PM, Jeremy Kerr wrote:
Hi Rob,
quoted
quoted
+int clk_prepare(struct clk *clk)
+{
+	int ret = 0;
+
Shouldn't all these functions have some clk pointer checks:

	if (IS_ERR_OR_NULL(clk))
		return -EINVAL;
No, I'd prefer not to. The driver code should be responsible for passing
a valid pointer here, by doing this check once (where the clock is
initially acquired through clk_get), rather than the core code doing it
on each function call.
I think you will find many examples in the kernel where that is not done 
by drivers. It is also common that the same driver is used on platforms 
with and without clock support. Adding NULL ptr checks around every clk 
api function makes for ugly and duplicated code.

Every implementation of clk_enable that I looked at does this check in 
their implementation. I looked at omap, imx, spear, and samsung. Seems 
like we should try to minimize breakage from switching to common struct clk.

Rob
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help