Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: khilman@baylibre.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/6] ARM: davinci: add skeleton for pdata-quirks
Date: Mon,  9 Jan 2017 12:55:29 -0800	[thread overview]
Message-ID: <20170109205531.3435-5-khilman@baylibre.com> (raw)
In-Reply-To: <20170109205531.3435-1-khilman@baylibre.com>

Add skeleton pdata-quirks for for davinci.

Signed-off-by: Kevin Hilman <khilman@baylibre.com>
---
 arch/arm/mach-davinci/include/mach/common.h |  2 ++
 arch/arm/mach-davinci/pdata-quirks.c        | 39 +++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 arch/arm/mach-davinci/pdata-quirks.c

diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index 0b3c169758ed..037aa66bcac1 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -102,6 +102,8 @@ int davinci_pm_init(void);
 static inline int davinci_pm_init(void) { return 0; }
 #endif
 
+void __init pdata_quirks_init(void);
+
 #define SRAM_SIZE	SZ_128K
 
 #endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
diff --git a/arch/arm/mach-davinci/pdata-quirks.c b/arch/arm/mach-davinci/pdata-quirks.c
new file mode 100644
index 000000000000..5b57da475065
--- /dev/null
+++ b/arch/arm/mach-davinci/pdata-quirks.c
@@ -0,0 +1,39 @@
+/*
+ * Legacy platform_data quirks
+ *
+ * Copyright (C) 2016 BayLibre, Inc
+ *
+ * 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.
+ */
+#include <linux/kernel.h>
+#include <linux/of_platform.h>
+
+#include <mach/common.h>
+
+struct pdata_init {
+	const char *compatible;
+	void (*fn)(void);
+};
+
+static void pdata_quirks_check(struct pdata_init *quirks)
+{
+	while (quirks->compatible) {
+		if (of_machine_is_compatible(quirks->compatible)) {
+			if (quirks->fn)
+				quirks->fn();
+			break;
+		}
+		quirks++;
+	}
+}
+
+static struct pdata_init pdata_quirks[] __initdata = {
+	{ /* sentinel */ },
+};
+
+void __init pdata_quirks_init(void)
+{
+	pdata_quirks_check(pdata_quirks);
+}
-- 
2.9.3

  parent reply	other threads:[~2017-01-09 20:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 20:55 [PATCH v2 0/6] ARM: davinci: da850: add/enable video capture Kevin Hilman
2017-01-09 20:55 ` [PATCH v2 1/6] ARM: dts: davinci: da850: VPIF: add node and muxing Kevin Hilman
2017-01-10  9:35   ` Sekhar Nori
2017-01-09 20:55 ` [PATCH v2 2/6] ARM: dts: davinci: da850-evm: enable VPIF Kevin Hilman
2017-01-10  9:37   ` Sekhar Nori
2017-01-09 20:55 ` [PATCH v2 3/6] ARM: dts: davinci: da850-lcdk: " Kevin Hilman
2017-01-10  9:39   ` Sekhar Nori
2017-01-09 20:55 ` Kevin Hilman [this message]
2017-01-10 10:26   ` [PATCH v2 4/6] ARM: davinci: add skeleton for pdata-quirks Sekhar Nori
2017-01-10 10:50     ` Sekhar Nori
2017-01-10 18:18       ` Kevin Hilman
2017-01-09 20:55 ` [PATCH v2 5/6] ARM: davinci: da8xx: add pdata-quirks, use for VPIF capture Kevin Hilman
2017-01-10 10:41   ` Sekhar Nori
2017-01-09 20:55 ` [PATCH v2 6/6] ARM: davinci: board-da850-evm: add I2C ID for VPIF Kevin Hilman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170109205531.3435-5-khilman@baylibre.com \
    --to=khilman@baylibre.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox