浏览代码

ISAPNP: handle independent options following dependent ones

The ISAPNP spec recommends that independent options precede
dependent ones, but this is not actually required.  The current
ISAPNP code incorrectly puts such trailing independent options
at the end of the last dependent option list.

This patch fixes that bug by resetting the current option list
to the independent list when we see an "End Dependent Functions"
tag.  PNPBIOS and PNPACPI handle this the same way.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Bjorn Helgaas 17 年之前
父节点
当前提交
bbe413b4fc
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      drivers/pnp/isapnp/core.c

+ 7 - 2
drivers/pnp/isapnp/core.c

@@ -584,14 +584,14 @@ static int __init isapnp_create_device(struct pnp_card *card,
 {
 {
 	int number = 0, skip = 0, priority, compat = 0;
 	int number = 0, skip = 0, priority, compat = 0;
 	unsigned char type, tmp[17];
 	unsigned char type, tmp[17];
-	struct pnp_option *option;
+	struct pnp_option *option, *option_independent;
 	struct pnp_dev *dev;
 	struct pnp_dev *dev;
 	u32 eisa_id;
 	u32 eisa_id;
 	char id[8];
 	char id[8];
 
 
 	if ((dev = isapnp_parse_device(card, size, number++)) == NULL)
 	if ((dev = isapnp_parse_device(card, size, number++)) == NULL)
 		return 1;
 		return 1;
-	option = pnp_register_independent_option(dev);
+	option_independent = option = pnp_register_independent_option(dev);
 	if (!option) {
 	if (!option) {
 		kfree(dev);
 		kfree(dev);
 		return 1;
 		return 1;
@@ -613,6 +613,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
 				size = 0;
 				size = 0;
 				skip = 0;
 				skip = 0;
 				option = pnp_register_independent_option(dev);
 				option = pnp_register_independent_option(dev);
+				option_independent = option;
 				if (!option) {
 				if (!option) {
 					kfree(dev);
 					kfree(dev);
 					return 1;
 					return 1;
@@ -662,6 +663,10 @@ static int __init isapnp_create_device(struct pnp_card *card,
 		case _STAG_ENDDEP:
 		case _STAG_ENDDEP:
 			if (size != 0)
 			if (size != 0)
 				goto __skip;
 				goto __skip;
+			if (option_independent == option)
+				dev_warn(&dev->dev, "missing "
+					 "_STAG_STARTDEP tag\n");
+			option = option_independent;
 			dev_dbg(&dev->dev, "end dependent options\n");
 			dev_dbg(&dev->dev, "end dependent options\n");
 			break;
 			break;
 		case _STAG_IOPORT:
 		case _STAG_IOPORT: