Re: [PATCH v1] clocksource: Sigma Designs Tango 27 MHz xtal

From: Daniel Lezcano
Date: Wed Oct 07 2015 - 05:47:26 EST


On 10/07/2015 10:23 AM, Marc Gonzalez wrote:

[ ... ]

+++ b/drivers/clocksource/tango_xtal.c
@@ -0,0 +1,46 @@
+#include <linux/clocksource.h>
+#include <linux/sched_clock.h>
+#include <linux/of_address.h>
+#include <linux/delay.h>
+#include <linux/clk.h>

#include <linux/init.h> is missing.

For my education: this header is already indirectly included;
The directive should be explicit to prevent breakage in case
other (implicit) includes are reorganized?

Yes, exactly.

The 'clocksource.h' header includes 'init.h' only for the 'clocksource_default_clock' function. If this function disappears, or the __init section is removed, then the 'init.h' inclusion won't make sense anymore in the header file. By removing it, that will break all code relying on the implicit inclusion.

So the rule of thumb I apply to myself is always to explicitly include the headers in the C file even if it is already implicitly included. This rule is valid only if the header file is not using intensively code coming from the implicit inclusion like static inlines etc ...

+static void __iomem *xtal_in_cnt;
+static struct delay_timer delay_timer;
+
+static unsigned long read_xtal_counter(void)
+{
+ return readl_relaxed(xtal_in_cnt);
+}
+
+static u64 read_sched_clock(void)
+{
+ return read_xtal_counter();
+}

static u64 *notrace* read_sched_clock(void)

What about read_clocksource? and read_xtal_counter?

See commit 89e6a13b88.

-- Daniel


--
<http://www.linaro.org/> Linaro.org â Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/