lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 15 Nov 2013 16:09:18 -0800
From:	David Cohen <david.a.cohen@...ux.intel.com>
To:	mingo@...nel.org, hch@...radead.org, hpa@...or.com
Cc:	tglx@...utronix.de, x86@...nel.org, linux-kernel@...r.kernel.org,
	lenb@...nel.org, David Cohen <david.a.cohen@...ux.intel.com>
Subject: [PATCH v1.1] x86: intel-mid: add test module for sfi_device()

This patch adds a test module to validate sfi_device() when used from a
driver module.

Signed-off-by: David Cohen <david.a.cohen@...ux.intel.com>
---

v1 to v1.1:
 - Fixed typos on comment.
 - No functional changes

Br, David

---
 arch/x86/Kconfig                                   |  9 +++++
 arch/x86/platform/intel-mid/device_libs/Makefile   |  2 ++
 .../intel-mid/device_libs/platform_sfi_test.c      | 41 ++++++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_sfi_test.c

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 00fa3b7d2abe..140e1de64d81 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -456,6 +456,15 @@ config X86_INTEL_MID
 	  systems which do not have the PCI legacy interfaces (Moorestown,
 	  Medfield). If you are building for a PC class system say N here.
 
+config SFI_TEST_MODULE
+	tristate "Intel MID sfi test module"
+	depends on SFI && X86_INTEL_MID && m
+	---help---
+	  Select to build a test module to validate SFI devices on Intel MID
+	  platforms from driver modules.
+
+	  This module will be called platform_sfi_test.ko
+
 config X86_INTEL_LPSS
 	bool "Intel Low Power Subsystem Support"
 	depends on ACPI
diff --git a/arch/x86/platform/intel-mid/device_libs/Makefile b/arch/x86/platform/intel-mid/device_libs/Makefile
index 097e7a7940d8..b4e858e5c6e9 100644
--- a/arch/x86/platform/intel-mid/device_libs/Makefile
+++ b/arch/x86/platform/intel-mid/device_libs/Makefile
@@ -20,3 +20,5 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+# Test
+obj-$(CONFIG_SFI_TEST_MODULE) += platform_sfi_test.o
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_sfi_test.c b/arch/x86/platform/intel-mid/device_libs/platform_sfi_test.c
new file mode 100644
index 000000000000..dc146f4a2c18
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_sfi_test.c
@@ -0,0 +1,41 @@
+/*
+ * platform_sfi_test.c: test module for sfi_device()
+ *
+ * (C) Copyright 2013 Intel Corporation
+ * Author: David Cohen <david.a.cohen@...ux.intel.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/module.h>
+#include <asm/intel-mid.h>
+
+/*
+ * Even though we're implementing this device_handler callback, it should
+ * never be called when loading the module because the sfi device name
+ * "I'm_not_here" won't match to any entry on sfi table.
+ *
+ * This test validates sfi_device() compilation and usage in modules.
+ * Despite this sfi device test isn't found in the end, the module tests Intel
+ * MID sfi codes when trying to match this device with current sfi table.
+ */
+static void
+sfi_test_dev_handler(struct sfi_device_table_entry *pentry, struct devs_id *dev)
+{
+	pr_info("%s: This is a test for sfi_device() as module\n", __func__);
+}
+
+static const struct devs_id sfi_test_dev_id __initconst = {
+	.name = "I'm_not_here",
+	.type = SFI_DEV_TYPE_UART,
+	.device_handler = sfi_test_dev_handler,
+};
+
+sfi_device(sfi_test_dev_id);
+
+MODULE_AUTHOR("David Cohen <david.a.cohen@...ux.intel.com>");
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("This module provides test for sfi_device() macro");
-- 
1.8.4.2

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ