Revert "PCI: endpoint: Use a separate lock for protecting epc->pci_epf list"

This reverts commit 9102582762 which is
commit d6dd5bafaa upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: I9446f192e30f403cb3e9ea377f566e076aa73604
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2024-12-30 10:42:35 +00:00
parent 703a8674df
commit e8a4474f16
2 changed files with 4 additions and 7 deletions

View File

@@ -613,7 +613,7 @@ int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf,
if (type == SECONDARY_INTERFACE && epf->sec_epc) if (type == SECONDARY_INTERFACE && epf->sec_epc)
return -EBUSY; return -EBUSY;
mutex_lock(&epc->list_lock); mutex_lock(&epc->lock);
func_no = find_first_zero_bit(&epc->function_num_map, func_no = find_first_zero_bit(&epc->function_num_map,
BITS_PER_LONG); BITS_PER_LONG);
if (func_no >= BITS_PER_LONG) { if (func_no >= BITS_PER_LONG) {
@@ -640,7 +640,7 @@ int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf,
list_add_tail(list, &epc->pci_epf); list_add_tail(list, &epc->pci_epf);
ret: ret:
mutex_unlock(&epc->list_lock); mutex_unlock(&epc->lock);
return ret; return ret;
} }
@@ -672,11 +672,11 @@ void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf,
list = &epf->sec_epc_list; list = &epf->sec_epc_list;
} }
mutex_lock(&epc->list_lock); mutex_lock(&epc->lock);
clear_bit(func_no, &epc->function_num_map); clear_bit(func_no, &epc->function_num_map);
list_del(list); list_del(list);
epf->epc = NULL; epf->epc = NULL;
mutex_unlock(&epc->list_lock); mutex_unlock(&epc->lock);
} }
EXPORT_SYMBOL_GPL(pci_epc_remove_epf); EXPORT_SYMBOL_GPL(pci_epc_remove_epf);
@@ -773,7 +773,6 @@ __pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
} }
mutex_init(&epc->lock); mutex_init(&epc->lock);
mutex_init(&epc->list_lock);
INIT_LIST_HEAD(&epc->pci_epf); INIT_LIST_HEAD(&epc->pci_epf);
ATOMIC_INIT_NOTIFIER_HEAD(&epc->notifier); ATOMIC_INIT_NOTIFIER_HEAD(&epc->notifier);

View File

@@ -122,7 +122,6 @@ struct pci_epc_mem {
* struct pci_epc - represents the PCI EPC device * struct pci_epc - represents the PCI EPC device
* @dev: PCI EPC device * @dev: PCI EPC device
* @pci_epf: list of endpoint functions present in this EPC device * @pci_epf: list of endpoint functions present in this EPC device
* list_lock: Mutex for protecting pci_epf list
* @ops: function pointers for performing endpoint operations * @ops: function pointers for performing endpoint operations
* @windows: array of address space of the endpoint controller * @windows: array of address space of the endpoint controller
* @mem: first window of the endpoint controller, which corresponds to * @mem: first window of the endpoint controller, which corresponds to
@@ -140,7 +139,6 @@ struct pci_epc_mem {
struct pci_epc { struct pci_epc {
struct device dev; struct device dev;
struct list_head pci_epf; struct list_head pci_epf;
struct mutex list_lock;
const struct pci_epc_ops *ops; const struct pci_epc_ops *ops;
struct pci_epc_mem **windows; struct pci_epc_mem **windows;
struct pci_epc_mem *mem; struct pci_epc_mem *mem;