@@ -150,7 +150,7 @@ static int acpi_send_edr_status(struct pci_dev *pdev, struct pci_dev *edev,
150150
151151static void edr_handle_event (acpi_handle handle , u32 event , void * data )
152152{
153- struct pci_dev * pdev = data , * edev ;
153+ struct pci_dev * pdev = data , * err_port , * err_dev ;
154154 pci_ers_result_t estate = PCI_ERS_RESULT_DISCONNECT ;
155155 u16 status ;
156156
@@ -169,36 +169,37 @@ static void edr_handle_event(acpi_handle handle, u32 event, void *data)
169169 * may be that port or a parent of it (PCI Firmware r3.3, sec
170170 * 4.6.13).
171171 */
172- edev = acpi_dpc_port_get (pdev );
173- if (!edev ) {
172+ err_port = acpi_dpc_port_get (pdev );
173+ if (!err_port ) {
174174 pci_err (pdev , "Firmware failed to locate DPC port\n" );
175175 return ;
176176 }
177177
178- pci_dbg (pdev , "Reported EDR dev: %s\n" , pci_name (edev ));
178+ pci_dbg (pdev , "Reported EDR dev: %s\n" , pci_name (err_port ));
179179
180180 /* If port does not support DPC, just send the OST */
181- if (!edev -> dpc_cap ) {
182- pci_err (edev , FW_BUG "This device doesn't support DPC\n" );
181+ if (!err_port -> dpc_cap ) {
182+ pci_err (err_port , FW_BUG "This device doesn't support DPC\n" );
183183 goto send_ost ;
184184 }
185185
186186 /* Check if there is a valid DPC trigger */
187- pci_read_config_word (edev , edev -> dpc_cap + PCI_EXP_DPC_STATUS , & status );
187+ pci_read_config_word (err_port , err_port -> dpc_cap + PCI_EXP_DPC_STATUS , & status );
188188 if (!(status & PCI_EXP_DPC_STATUS_TRIGGER )) {
189- pci_err (edev , "Invalid DPC trigger %#010x\n" , status );
189+ pci_err (err_port , "Invalid DPC trigger %#010x\n" , status );
190190 goto send_ost ;
191191 }
192192
193- dpc_process_error (edev );
194- pci_aer_raw_clear_status (edev );
193+ err_dev = dpc_process_error (err_port );
194+ pci_aer_raw_clear_status (err_port );
195195
196196 /*
197197 * Irrespective of whether the DPC event is triggered by ERR_FATAL
198198 * or ERR_NONFATAL, since the link is already down, use the FATAL
199199 * error recovery path for both cases.
200200 */
201- estate = pcie_do_recovery (edev , pci_channel_io_frozen , dpc_reset_link );
201+ estate = pcie_do_recovery (err_dev , pci_channel_io_frozen , dpc_reset_link );
202+ pci_dev_put (err_dev );
202203
203204send_ost :
204205
@@ -207,15 +208,15 @@ static void edr_handle_event(acpi_handle handle, u32 event, void *data)
207208 * to firmware. If not successful, send _OST(0xF, BDF << 16 | 0x81).
208209 */
209210 if (estate == PCI_ERS_RESULT_RECOVERED ) {
210- pci_dbg (edev , "DPC port successfully recovered\n" );
211- pcie_clear_device_status (edev );
212- acpi_send_edr_status (pdev , edev , EDR_OST_SUCCESS );
211+ pci_dbg (err_port , "DPC port successfully recovered\n" );
212+ pcie_clear_device_status (err_port );
213+ acpi_send_edr_status (pdev , err_port , EDR_OST_SUCCESS );
213214 } else {
214- pci_dbg (edev , "DPC port recovery failed\n" );
215- acpi_send_edr_status (pdev , edev , EDR_OST_FAILED );
215+ pci_dbg (err_port , "DPC port recovery failed\n" );
216+ acpi_send_edr_status (pdev , err_port , EDR_OST_FAILED );
216217 }
217218
218- pci_dev_put (edev );
219+ pci_dev_put (err_port );
219220}
220221
221222void pci_acpi_add_edr_notifier (struct pci_dev * pdev )
0 commit comments