PCI: endpoint: Add new pci_epc_ops to get EPC features

Add a new pci_epc_ops ->get_features() to get the features
supported by the EPC. Since EPC can provide different features to
different functions, the ->get_features() ops takes _func_no_ as
an argument.

Tested-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
This commit is contained in:
Kishon Vijay Abraham I
2019-01-14 16:44:59 +05:30
gecommit door Lorenzo Pieralisi
bovenliggende 726dabfde6
commit 41cb8d189c
2 gewijzigde bestanden met toevoegingen van 52 en 0 verwijderingen

Bestand weergeven

@@ -83,6 +83,36 @@ err:
}
EXPORT_SYMBOL_GPL(pci_epc_get);
/**
* pci_epc_get_features() - get the features supported by EPC
* @epc: the features supported by *this* EPC device will be returned
* @func_no: the features supported by the EPC device specific to the
* endpoint function with func_no will be returned
*
* Invoke to get the features provided by the EPC which may be
* specific to an endpoint function. Returns pci_epc_features on success
* and NULL for any failures.
*/
const struct pci_epc_features *pci_epc_get_features(struct pci_epc *epc,
u8 func_no)
{
const struct pci_epc_features *epc_features;
unsigned long flags;
if (IS_ERR_OR_NULL(epc) || func_no >= epc->max_functions)
return NULL;
if (!epc->ops->get_features)
return NULL;
spin_lock_irqsave(&epc->lock, flags);
epc_features = epc->ops->get_features(epc, func_no);
spin_unlock_irqrestore(&epc->lock, flags);
return epc_features;
}
EXPORT_SYMBOL_GPL(pci_epc_get_features);
/**
* pci_epc_stop() - stop the PCI link
* @epc: the link of the EPC device that has to be stopped