Skip to contentSkip to conversation

clkdev: Add default clkdev.h

PATCH In review Mark Brown 3 participants 4 messages Jul 3, 2012 – Jul 4, 2012

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 clkdev: Add default clkdev.h

Ease the deployment of clkdev by providing a default asm/clkdev.h which will be used if the arch does not have an include/asm/clkdev.h.

---

The discussion on the previous posting of this patch suggested we should be merging this via clk (or possibly clkdev).

 include/asm-generic/Kbuild.asm |    4 ++++
 include/asm-generic/clkdev.h   |   26 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 include/asm-generic/clkdev.h
include/asm-generic/Kbuild.asm +4 -0
index c5d2e5d..da121e0 100644
@@ -13,6 +13,10 @@ ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
 header-y += a.out.h
 endif
 
+ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/clkdev.h),)
+generic-y += clkdev.h
+endif
+
 header-y += auxvec.h
 header-y += bitsperlong.h
 header-y += byteorder.h
include/asm-generic/clkdev.h new file +26 -0
new file mode 100644
index 0000000..7a15bd0
@@ -0,0 +1,26 @@
+/*
+ *  include/asm-generic/clkdev.h
+ *
+ * Based on the ARM clkdev.h:
+ *  Copyright (C) 2008 Russell King.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Helper for the clk API to assist looking up a struct clk.
+ */
+#ifndef __ASM_CLKDEV_H
+#define __ASM_CLKDEV_H
+
+#include <linux/slab.h>
+
+static inline int __clk_get(clk) { return 1; }
+static inline void __clk_put(clk) { }
+
+static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
+{
+	return kzalloc(size, GFP_KERNEL);
+}
+
+#endif
Signature · 1 line
1.7.10
#1 lore raw

Hi Mark,

include/asm-generic/clkdev.h line 19

Quoted 3 lines · On Tue, 3 Jul 2012 16:23:35 +0100 Mark Brown…
include/asm-generic/clkdev.h new file +2 -0
+static inline int __clk_get(clk) { return 1; }
+static inline void __clk_put(clk) { }

struct clk;

static inline int __clk_get(struct clk *clk) { return 1; } static inline void __clk_put(struct clk *clk) { }

Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]
#2 lore raw
In reply to Mark Brown

include/asm-generic/Kbuild.asm ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \ · line 18

Quoted 9 lines · Mark Brown
include/asm-generic/Kbuild.asm +3 -0
@@ -13,6 +13,10 @@ ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
 header-y += a.out.h
 endif
 
+ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/clkdev.h),)
+generic-y += clkdev.h
+endif

Quoting Sam:
"Any use of wildcards in include/asm-generic/Kbuild.asm is bogus."

http://lkml.indiana.edu/hypermail/linux/kernel/1206.2/01507.html

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author
#3 lore raw
Quoted 4 lines · Geert Uytterhoeven

Quoting Sam:
"Any use of wildcards in include/asm-generic/Kbuild.asm is bogus."

http://lkml.indiana.edu/hypermail/linux/kernel/1206.2/01507.html

Without actually explaining why which isn't terribly helpful :/

As far as I can tell it looks like this is for headers which may optionally be absent but clkdev.h is a header which should never be absent, either the architecture defines it or it uses the generic one.

As I said further up the thread having to go round ever single architecture and get them to actually apply patches for stuff like this is needlessly painful.