[linux] 01/01: firmware: dmi: Add DMI_PRODUCT_FAMILY identification string
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Mon Jul 17 21:21:23 UTC 2017
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch stretch
in repository linux.
commit ca83f87bf9e7b283a4f826c2dba0456a10613aa5
Author: Ben Hutchings <ben at decadent.org.uk>
Date: Mon Jul 17 03:00:56 2017 +0100
firmware: dmi: Add DMI_PRODUCT_FAMILY identification string
Dependency of "pinctrl: cherryview: Extend the Chromebook DMI quirk to
Intel_Strago systems".
Plus an ABI fudge.
---
debian/changelog | 2 +
...mi-avoid-abi-break-for-dmi_product_family.patch | 129 +++++++++++++++++++++
...i-add-dmi_product_family-identification-s.patch | 61 ++++++++++
debian/patches/series | 2 +
4 files changed, 194 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 83fcf83..73fad58 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ linux (4.9.30-3) UNRELEASED; urgency=medium
* [x86] ideapad-laptop: Add various IdeaPad models to no_hw_rfkill list
(Closes: #866706)
* [x86] pinctrl: cherryview: Add terminate entry for dmi_system_id tables
+ * firmware: dmi: Add DMI_PRODUCT_FAMILY identification string
+ * firmware: dmi: Avoid ABI break for DMI_PRODUCT_FAMILY
* [x86] pinctrl: cherryview: Extend the Chromebook DMI quirk to Intel_Strago
systems (Closes: #862723)
* [armhf] Add ARM Mali Midgard device tree bindings and gpu node for rk3288
diff --git a/debian/patches/debian/firmware-dmi-avoid-abi-break-for-dmi_product_family.patch b/debian/patches/debian/firmware-dmi-avoid-abi-break-for-dmi_product_family.patch
new file mode 100644
index 0000000..ec851b0
--- /dev/null
+++ b/debian/patches/debian/firmware-dmi-avoid-abi-break-for-dmi_product_family.patch
@@ -0,0 +1,129 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Mon, 17 Jul 2017 19:11:49 +0100
+Subject: firmware: dmi: Avoid ABI break for DMI_PRODUCT_FAMILY
+Forwarded: not-needed
+Bug-Debian: https://bugs.debian.org/862723
+
+The DMI API in Linux uses its own enumeration of field IDs (rather
+than the numbers used in DMI) and uses them as indices into the
+static dmi_ident array without range-checking. So adding
+DMI_PRODUCT_FAMILY to this enumeration is a real ABI change.
+
+However, we can make this a compatible extension to the ABI by:
+(1) adding the new enumerator at the end, avoiding renumbering;
+(2) adding range checks to the functions that access dmi_ident;
+(3) renaming (with #define) all the affected functions, so that
+ any modules built against the new definition will fail to
+ load on old kernel versions;
+(4) adding trivial wrappers under the old names.
+
+Step (2) allows further additions without any more code changes.
+
+---
+--- a/include/linux/dmi.h
++++ b/include/linux/dmi.h
+@@ -96,20 +96,25 @@ struct dmi_dev_onboard {
+ };
+
+ extern struct kobject *dmi_kobj;
++#define dmi_check_system dmi_check_system_safe
+ extern int dmi_check_system(const struct dmi_system_id *list);
++#define dmi_first_match dmi_first_match_safe
+ const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
++#define dmi_get_system_info dmi_get_system_info_safe
+ extern const char * dmi_get_system_info(int field);
+ extern const struct dmi_device * dmi_find_device(int type, const char *name,
+ const struct dmi_device *from);
+ extern void dmi_scan_machine(void);
+ extern void dmi_memdev_walk(void);
+ extern void dmi_set_dump_stack_arch_desc(void);
++#define dmi_get_date dmi_get_date_safe
+ extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
+ extern int dmi_name_in_vendors(const char *str);
+ extern int dmi_name_in_serial(const char *str);
+ extern int dmi_available;
+ extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
+ void *private_data);
++#define dmi_match dmi_match_safe
+ extern bool dmi_match(enum dmi_field f, const char *str);
+ extern void dmi_memdev_name(u16 handle, const char **bank, const char **device);
+
+--- a/include/linux/mod_devicetable.h
++++ b/include/linux/mod_devicetable.h
+@@ -456,7 +456,6 @@ enum dmi_field {
+ DMI_PRODUCT_VERSION,
+ DMI_PRODUCT_SERIAL,
+ DMI_PRODUCT_UUID,
+- DMI_PRODUCT_FAMILY,
+ DMI_BOARD_VENDOR,
+ DMI_BOARD_NAME,
+ DMI_BOARD_VERSION,
+@@ -467,6 +466,9 @@ enum dmi_field {
+ DMI_CHASSIS_VERSION,
+ DMI_CHASSIS_SERIAL,
+ DMI_CHASSIS_ASSET_TAG,
++#ifndef __GENKSYMS__
++ DMI_PRODUCT_FAMILY,
++#endif
+ DMI_STRING_MAX,
+ };
+
+--- a/drivers/firmware/dmi_scan.c
++++ b/drivers/firmware/dmi_scan.c
+@@ -766,7 +766,7 @@ static bool dmi_matches(const struct dmi
+ int s = dmi->matches[i].slot;
+ if (s == DMI_NONE)
+ break;
+- if (dmi_ident[s]) {
++ if (s < DMI_STRING_MAX && dmi_ident[s]) {
+ if (!dmi->matches[i].exact_match &&
+ strstr(dmi_ident[s], dmi->matches[i].substr))
+ continue;
+@@ -852,7 +852,7 @@ EXPORT_SYMBOL(dmi_first_match);
+ */
+ const char *dmi_get_system_info(int field)
+ {
+- return dmi_ident[field];
++ return field < DMI_STRING_MAX ? dmi_ident[field] : NULL;
+ }
+ EXPORT_SYMBOL(dmi_get_system_info);
+
+@@ -1048,3 +1048,38 @@ void dmi_memdev_name(u16 handle, const c
+ }
+ }
+ EXPORT_SYMBOL_GPL(dmi_memdev_name);
++
++#undef dmi_check_system
++int dmi_check_system(const struct dmi_system_id *list)
++{
++ return dmi_check_system_safe(list);
++}
++EXPORT_SYMBOL(dmi_check_system);
++
++#undef dmi_first_match
++const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list)
++{
++ return dmi_first_match_safe(list);
++}
++EXPORT_SYMBOL(dmi_first_match);
++
++#undef dmi_get_system_info
++const char *dmi_get_system_info(int field)
++{
++ return dmi_get_system_info_safe(field);
++}
++EXPORT_SYMBOL(dmi_get_system_info);
++
++#undef dmi_get_date
++bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
++{
++ return dmi_get_date_safe(field, yearp, monthp, dayp);
++}
++EXPORT_SYMBOL(dmi_get_date);
++
++#undef dmi_match
++bool dmi_match(enum dmi_field f, const char *str)
++{
++ return dmi_match_safe(f, str);
++}
++EXPORT_SYMBOL_GPL(dmi_match);
diff --git a/debian/patches/features/all/firmware-dmi-add-dmi_product_family-identification-s.patch b/debian/patches/features/all/firmware-dmi-add-dmi_product_family-identification-s.patch
new file mode 100644
index 0000000..b0d9d97
--- /dev/null
+++ b/debian/patches/features/all/firmware-dmi-add-dmi_product_family-identification-s.patch
@@ -0,0 +1,61 @@
+From: Mika Westerberg <mika.westerberg at linux.intel.com>
+Date: Wed, 17 May 2017 13:25:12 +0300
+Subject: firmware: dmi: Add DMI_PRODUCT_FAMILY identification string
+Origin: https://git.kernel.org/linus/c61872c9833d17d3807fb999096917c1f9eaada0
+
+Sometimes it is more convenient to be able to match a whole family of
+products, like in case of bunch of Chromebooks based on Intel_Strago to
+apply a driver quirk instead of quirking each machine one-by-one.
+
+This adds support for DMI_PRODUCT_FAMILY identification string and also
+exports it to the userspace through sysfs attribute just like the
+existing ones.
+
+Suggested-by: Dmitry Torokhov <dmitry.torokhov at gmail.com>
+Signed-off-by: Mika Westerberg <mika.westerberg at linux.intel.com>
+Reviewed-by: Andy Shevchenko <andy.shevchenko at gmail.com>
+Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
+---
+ drivers/firmware/dmi-id.c | 2 ++
+ drivers/firmware/dmi_scan.c | 1 +
+ include/linux/mod_devicetable.h | 1 +
+ 3 files changed, 4 insertions(+)
+
+--- a/drivers/firmware/dmi-id.c
++++ b/drivers/firmware/dmi-id.c
+@@ -47,6 +47,7 @@ DEFINE_DMI_ATTR_WITH_SHOW(product_name,
+ DEFINE_DMI_ATTR_WITH_SHOW(product_version, 0444, DMI_PRODUCT_VERSION);
+ DEFINE_DMI_ATTR_WITH_SHOW(product_serial, 0400, DMI_PRODUCT_SERIAL);
+ DEFINE_DMI_ATTR_WITH_SHOW(product_uuid, 0400, DMI_PRODUCT_UUID);
++DEFINE_DMI_ATTR_WITH_SHOW(product_family, 0400, DMI_PRODUCT_FAMILY);
+ DEFINE_DMI_ATTR_WITH_SHOW(board_vendor, 0444, DMI_BOARD_VENDOR);
+ DEFINE_DMI_ATTR_WITH_SHOW(board_name, 0444, DMI_BOARD_NAME);
+ DEFINE_DMI_ATTR_WITH_SHOW(board_version, 0444, DMI_BOARD_VERSION);
+@@ -191,6 +192,7 @@ static void __init dmi_id_init_attr_tabl
+ ADD_DMI_ATTR(product_version, DMI_PRODUCT_VERSION);
+ ADD_DMI_ATTR(product_serial, DMI_PRODUCT_SERIAL);
+ ADD_DMI_ATTR(product_uuid, DMI_PRODUCT_UUID);
++ ADD_DMI_ATTR(product_family, DMI_PRODUCT_FAMILY);
+ ADD_DMI_ATTR(board_vendor, DMI_BOARD_VENDOR);
+ ADD_DMI_ATTR(board_name, DMI_BOARD_NAME);
+ ADD_DMI_ATTR(board_version, DMI_BOARD_VERSION);
+--- a/drivers/firmware/dmi_scan.c
++++ b/drivers/firmware/dmi_scan.c
+@@ -430,6 +430,7 @@ static void __init dmi_decode(const stru
+ dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6);
+ dmi_save_ident(dm, DMI_PRODUCT_SERIAL, 7);
+ dmi_save_uuid(dm, DMI_PRODUCT_UUID, 8);
++ dmi_save_ident(dm, DMI_PRODUCT_FAMILY, 26);
+ break;
+ case 2: /* Base Board Information */
+ dmi_save_ident(dm, DMI_BOARD_VENDOR, 4);
+--- a/include/linux/mod_devicetable.h
++++ b/include/linux/mod_devicetable.h
+@@ -457,6 +457,7 @@ enum dmi_field {
+ DMI_PRODUCT_VERSION,
+ DMI_PRODUCT_SERIAL,
+ DMI_PRODUCT_UUID,
++ DMI_PRODUCT_FAMILY,
+ DMI_BOARD_VENDOR,
+ DMI_BOARD_NAME,
+ DMI_BOARD_VERSION,
diff --git a/debian/patches/series b/debian/patches/series
index 6bdad41..bcf3b30 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -55,6 +55,7 @@ debian/amd64-don-t-warn-about-expected-w+x-pages-on-xen.patch
bugfix/arm/arm-dts-kirkwood-fix-sata-pinmux-ing-for-ts419.patch
bugfix/x86/pinctrl-cherryview-add-a-quirk-to-make-acer-chromebo.patch
bugfix/x86/pinctrl-cherryview-add-terminate-entry-for-dmi_syste.patch
+features/all/firmware-dmi-add-dmi_product_family-identification-s.patch
bugfix/x86/pinctrl-cherryview-extend-the-chromebook-dmi-quirk-t.patch
bugfix/x86/platform-x86-ideapad-laptop-add-y700-15-acz-to-no_hw.patch
bugfix/x86/platform-x86-ideapad-laptop-add-ideapad-310-15ikb-to.patch
@@ -149,6 +150,7 @@ bugfix/all/module-disable-matching-missing-version-crc.patch
# ABI maintenance
debian/revert-mips-loongson-3-select-mips_l1_cache_shift_6.patch
+debian/firmware-dmi-avoid-abi-break-for-dmi_product_family.patch
# Tools bug fixes
bugfix/all/usbip-document-tcp-wrappers.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git
More information about the Kernel-svn-changes
mailing list