mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	EISA: Initialize device before its resources
Move eisa_init_device() before eisa_request_resources() so the device name is set before we set up its resources. That way we can print better messages. Previously edev->res[i].name was set to NULL in eisa_request_resources(), then filled in by eisa_init_device(). Now it is filled in by eisa_init_device() first, and we don't want to clear it out later in eisa_request_resources(). Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
		
							parent
							
								
									76668257b2
								
							
						
					
					
						commit
						26abfeed43
					
				
					 1 changed files with 12 additions and 16 deletions
				
			
		| 
						 | 
					@ -275,13 +275,11 @@ static int __init eisa_request_resources(struct eisa_root_device *root,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (slot) {
 | 
							if (slot) {
 | 
				
			||||||
			edev->res[i].name  = NULL;
 | 
					 | 
				
			||||||
			edev->res[i].start = SLOT_ADDRESS(root, slot)
 | 
								edev->res[i].start = SLOT_ADDRESS(root, slot)
 | 
				
			||||||
					     + (i * 0x400);
 | 
										     + (i * 0x400);
 | 
				
			||||||
			edev->res[i].end   = edev->res[i].start + 0xff;
 | 
								edev->res[i].end   = edev->res[i].start + 0xff;
 | 
				
			||||||
			edev->res[i].flags = IORESOURCE_IO;
 | 
								edev->res[i].flags = IORESOURCE_IO;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			edev->res[i].name  = NULL;
 | 
					 | 
				
			||||||
			edev->res[i].start = SLOT_ADDRESS(root, slot)
 | 
								edev->res[i].start = SLOT_ADDRESS(root, slot)
 | 
				
			||||||
					     + EISA_VENDOR_ID_OFFSET;
 | 
										     + EISA_VENDOR_ID_OFFSET;
 | 
				
			||||||
			edev->res[i].end   = edev->res[i].start + 3;
 | 
								edev->res[i].end   = edev->res[i].start + 3;
 | 
				
			||||||
| 
						 | 
					@ -327,6 +325,13 @@ static int __init eisa_probe(struct eisa_root_device *root)
 | 
				
			||||||
		return -ENOMEM;
 | 
							return -ENOMEM;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
						if (eisa_init_device(root, edev, 0)) {
 | 
				
			||||||
 | 
							kfree(edev);
 | 
				
			||||||
 | 
							if (!root->force_probe)
 | 
				
			||||||
 | 
								return -ENODEV;
 | 
				
			||||||
 | 
							goto force_probe;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (eisa_request_resources(root, edev, 0)) {
 | 
						if (eisa_request_resources(root, edev, 0)) {
 | 
				
			||||||
		dev_warn(root->dev,
 | 
							dev_warn(root->dev,
 | 
				
			||||||
		         "EISA: Cannot allocate resource for mainboard\n");
 | 
							         "EISA: Cannot allocate resource for mainboard\n");
 | 
				
			||||||
| 
						 | 
					@ -336,14 +341,6 @@ static int __init eisa_probe(struct eisa_root_device *root)
 | 
				
			||||||
		goto force_probe;
 | 
							goto force_probe;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (eisa_init_device(root, edev, 0)) {
 | 
					 | 
				
			||||||
		eisa_release_resources(edev);
 | 
					 | 
				
			||||||
		kfree(edev);
 | 
					 | 
				
			||||||
		if (!root->force_probe)
 | 
					 | 
				
			||||||
			return -ENODEV;
 | 
					 | 
				
			||||||
		goto force_probe;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	dev_info(&edev->dev, "EISA: Mainboard %s detected\n", edev->id.sig);
 | 
						dev_info(&edev->dev, "EISA: Mainboard %s detected\n", edev->id.sig);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (eisa_register_device(edev)) {
 | 
						if (eisa_register_device(edev)) {
 | 
				
			||||||
| 
						 | 
					@ -363,16 +360,15 @@ static int __init eisa_probe(struct eisa_root_device *root)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (eisa_request_resources(root, edev, i)) {
 | 
							if (eisa_init_device(root, edev, i)) {
 | 
				
			||||||
			dev_warn(root->dev,
 | 
					 | 
				
			||||||
			         "Cannot allocate resource for EISA slot %d\n",
 | 
					 | 
				
			||||||
			         i);
 | 
					 | 
				
			||||||
			kfree(edev);
 | 
								kfree(edev);
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (eisa_init_device(root, edev, i)) {
 | 
							if (eisa_request_resources(root, edev, i)) {
 | 
				
			||||||
			eisa_release_resources(edev);
 | 
								dev_warn(root->dev,
 | 
				
			||||||
 | 
								         "Cannot allocate resource for EISA slot %d\n",
 | 
				
			||||||
 | 
								         i);
 | 
				
			||||||
			kfree(edev);
 | 
								kfree(edev);
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue