mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 08:03:01 +09:00
PCI: endpoint: Add linkdown notifier support
Add support to notify the EPF device about the linkdown event from the EPC device. Link: https://lore.kernel.org/r/20230602114756.36586-5-manivannan.sadhasivam@linaro.org Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Kishon Vijay Abraham I <kishon@kernel.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
This commit is contained in:
committed by
Bjorn Helgaas
parent
a504c96558
commit
a1f6c3d7d3
@@ -706,6 +706,32 @@ void pci_epc_linkup(struct pci_epc *epc)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pci_epc_linkup);
|
||||
|
||||
/**
|
||||
* pci_epc_linkdown() - Notify the EPF device that EPC device has dropped the
|
||||
* connection with the Root Complex.
|
||||
* @epc: the EPC device which has dropped the link with the host
|
||||
*
|
||||
* Invoke to Notify the EPF device that the EPC device has dropped the
|
||||
* connection with the Root Complex.
|
||||
*/
|
||||
void pci_epc_linkdown(struct pci_epc *epc)
|
||||
{
|
||||
struct pci_epf *epf;
|
||||
|
||||
if (!epc || IS_ERR(epc))
|
||||
return;
|
||||
|
||||
mutex_lock(&epc->list_lock);
|
||||
list_for_each_entry(epf, &epc->pci_epf, list) {
|
||||
mutex_lock(&epf->lock);
|
||||
if (epf->event_ops && epf->event_ops->link_down)
|
||||
epf->event_ops->link_down(epf);
|
||||
mutex_unlock(&epf->lock);
|
||||
}
|
||||
mutex_unlock(&epc->list_lock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pci_epc_linkdown);
|
||||
|
||||
/**
|
||||
* pci_epc_init_notify() - Notify the EPF device that EPC device's core
|
||||
* initialization is completed.
|
||||
|
||||
@@ -203,6 +203,7 @@ void pci_epc_destroy(struct pci_epc *epc);
|
||||
int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf,
|
||||
enum pci_epc_interface_type type);
|
||||
void pci_epc_linkup(struct pci_epc *epc);
|
||||
void pci_epc_linkdown(struct pci_epc *epc);
|
||||
void pci_epc_init_notify(struct pci_epc *epc);
|
||||
void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf,
|
||||
enum pci_epc_interface_type type);
|
||||
|
||||
@@ -71,10 +71,12 @@ struct pci_epf_ops {
|
||||
* struct pci_epf_event_ops - Callbacks for capturing the EPC events
|
||||
* @core_init: Callback for the EPC initialization complete event
|
||||
* @link_up: Callback for the EPC link up event
|
||||
* @link_down: Callback for the EPC link down event
|
||||
*/
|
||||
struct pci_epc_event_ops {
|
||||
int (*core_init)(struct pci_epf *epf);
|
||||
int (*link_up)(struct pci_epf *epf);
|
||||
int (*link_down)(struct pci_epf *epf);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user