mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	s390/pci: use pci_rescan_remove_lock
Make sure that we use the pci_rescan_remove_lock when we remove or add functions from/to the bus. Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
		
							parent
							
								
									515f022e8b
								
							
						
					
					
						commit
						2a01bd1bd3
					
				
					 2 changed files with 13 additions and 4 deletions
				
			
		| 
						 | 
					@ -87,7 +87,9 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
 | 
				
			||||||
		ret = zpci_enable_device(zdev);
 | 
							ret = zpci_enable_device(zdev);
 | 
				
			||||||
		if (ret)
 | 
							if (ret)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
							pci_lock_rescan_remove();
 | 
				
			||||||
		pci_rescan_bus(zdev->bus);
 | 
							pci_rescan_bus(zdev->bus);
 | 
				
			||||||
 | 
							pci_unlock_rescan_remove();
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case 0x0302: /* Reserved -> Standby */
 | 
						case 0x0302: /* Reserved -> Standby */
 | 
				
			||||||
		if (!zdev)
 | 
							if (!zdev)
 | 
				
			||||||
| 
						 | 
					@ -95,7 +97,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case 0x0303: /* Deconfiguration requested */
 | 
						case 0x0303: /* Deconfiguration requested */
 | 
				
			||||||
		if (pdev)
 | 
							if (pdev)
 | 
				
			||||||
			pci_stop_and_remove_bus_device(pdev);
 | 
								pci_stop_and_remove_bus_device_locked(pdev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ret = zpci_disable_device(zdev);
 | 
							ret = zpci_disable_device(zdev);
 | 
				
			||||||
		if (ret)
 | 
							if (ret)
 | 
				
			||||||
| 
						 | 
					@ -112,7 +114,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
 | 
				
			||||||
			/* Give the driver a hint that the function is
 | 
								/* Give the driver a hint that the function is
 | 
				
			||||||
			 * already unusable. */
 | 
								 * already unusable. */
 | 
				
			||||||
			pdev->error_state = pci_channel_io_perm_failure;
 | 
								pdev->error_state = pci_channel_io_perm_failure;
 | 
				
			||||||
			pci_stop_and_remove_bus_device(pdev);
 | 
								pci_stop_and_remove_bus_device_locked(pdev);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		zdev->fh = ccdf->fh;
 | 
							zdev->fh = ccdf->fh;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,17 +44,24 @@ static ssize_t recover_store(struct device *dev, struct device_attribute *attr,
 | 
				
			||||||
	if (!device_remove_file_self(dev, attr))
 | 
						if (!device_remove_file_self(dev, attr))
 | 
				
			||||||
		return count;
 | 
							return count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pci_lock_rescan_remove();
 | 
				
			||||||
	pci_stop_and_remove_bus_device(pdev);
 | 
						pci_stop_and_remove_bus_device(pdev);
 | 
				
			||||||
	ret = zpci_disable_device(zdev);
 | 
						ret = zpci_disable_device(zdev);
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
		return ret;
 | 
							goto error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = zpci_enable_device(zdev);
 | 
						ret = zpci_enable_device(zdev);
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
		return ret;
 | 
							goto error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pci_rescan_bus(zdev->bus);
 | 
						pci_rescan_bus(zdev->bus);
 | 
				
			||||||
 | 
						pci_unlock_rescan_remove();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return count;
 | 
						return count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					error:
 | 
				
			||||||
 | 
						pci_unlock_rescan_remove();
 | 
				
			||||||
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
static DEVICE_ATTR_WO(recover);
 | 
					static DEVICE_ATTR_WO(recover);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue