* [PATCH v2] PCI: endpoint: Set endpoint controller pointer to null
@ 2019-05-23 21:45 Alan Mikhak
2019-05-23 23:57 ` Alan Mikhak
2019-06-11 10:07 ` Lorenzo Pieralisi
0 siblings, 2 replies; 4+ messages in thread
From: Alan Mikhak @ 2019-05-23 21:45 UTC (permalink / raw)
To: linux-pci, linux-kernel, kishon, lorenzo.pieralisi, linux-riscv,
palmer, paul.walmsley
Cc: Alan Mikhak
Set endpoint controller pointer to null in pci_epc_remove_epf()
to avoid -EBUSY on subsequent call to pci_epc_add_epf().
Requires checking for null endpoint function pointer.
Signed-off-by: Alan Mikhak <alan.mikhak@sifive.com>
---
drivers/pci/endpoint/pci-epc-core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index e4712a0f249c..2091508c1620 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -519,11 +519,12 @@ void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf)
{
unsigned long flags;
- if (!epc || IS_ERR(epc))
+ if (!epc || IS_ERR(epc) || !epf)
return;
spin_lock_irqsave(&epc->lock, flags);
list_del(&epf->list);
+ epf->epc = NULL;
spin_unlock_irqrestore(&epc->lock, flags);
}
EXPORT_SYMBOL_GPL(pci_epc_remove_epf);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: endpoint: Set endpoint controller pointer to null
2019-05-23 21:45 [PATCH v2] PCI: endpoint: Set endpoint controller pointer to null Alan Mikhak
@ 2019-05-23 23:57 ` Alan Mikhak
2019-05-24 8:41 ` Kishon Vijay Abraham I
2019-06-11 10:07 ` Lorenzo Pieralisi
1 sibling, 1 reply; 4+ messages in thread
From: Alan Mikhak @ 2019-05-23 23:57 UTC (permalink / raw)
To: linux-pci, linux-kernel, kishon, lorenzo.pieralisi, linux-riscv,
Palmer Dabbelt, Paul Walmsley, Bjorn Helgaas
+Bjorn Helgaas
On Thu, May 23, 2019 at 2:46 PM Alan Mikhak <alan.mikhak@sifive.com> wrote:
>
> Set endpoint controller pointer to null in pci_epc_remove_epf()
> to avoid -EBUSY on subsequent call to pci_epc_add_epf().
>
> Requires checking for null endpoint function pointer.
>
> Signed-off-by: Alan Mikhak <alan.mikhak@sifive.com>
> ---
> drivers/pci/endpoint/pci-epc-core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
> index e4712a0f249c..2091508c1620 100644
> --- a/drivers/pci/endpoint/pci-epc-core.c
> +++ b/drivers/pci/endpoint/pci-epc-core.c
> @@ -519,11 +519,12 @@ void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf)
> {
> unsigned long flags;
>
> - if (!epc || IS_ERR(epc))
> + if (!epc || IS_ERR(epc) || !epf)
> return;
>
> spin_lock_irqsave(&epc->lock, flags);
> list_del(&epf->list);
> + epf->epc = NULL;
> spin_unlock_irqrestore(&epc->lock, flags);
> }
> EXPORT_SYMBOL_GPL(pci_epc_remove_epf);
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: endpoint: Set endpoint controller pointer to null
2019-05-23 23:57 ` Alan Mikhak
@ 2019-05-24 8:41 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 4+ messages in thread
From: Kishon Vijay Abraham I @ 2019-05-24 8:41 UTC (permalink / raw)
To: Alan Mikhak, linux-pci, linux-kernel, lorenzo.pieralisi,
linux-riscv, Palmer Dabbelt, Paul Walmsley, Bjorn Helgaas
On 24/05/19 5:27 AM, Alan Mikhak wrote:
> +Bjorn Helgaas
>
> On Thu, May 23, 2019 at 2:46 PM Alan Mikhak <alan.mikhak@sifive.com> wrote:
>>
>> Set endpoint controller pointer to null in pci_epc_remove_epf()
>> to avoid -EBUSY on subsequent call to pci_epc_add_epf().
>>
>> Requires checking for null endpoint function pointer.
>>
>> Signed-off-by: Alan Mikhak <alan.mikhak@sifive.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>> drivers/pci/endpoint/pci-epc-core.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
>> index e4712a0f249c..2091508c1620 100644
>> --- a/drivers/pci/endpoint/pci-epc-core.c
>> +++ b/drivers/pci/endpoint/pci-epc-core.c
>> @@ -519,11 +519,12 @@ void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf)
>> {
>> unsigned long flags;
>>
>> - if (!epc || IS_ERR(epc))
>> + if (!epc || IS_ERR(epc) || !epf)
>> return;
>>
>> spin_lock_irqsave(&epc->lock, flags);
>> list_del(&epf->list);
>> + epf->epc = NULL;
>> spin_unlock_irqrestore(&epc->lock, flags);
>> }
>> EXPORT_SYMBOL_GPL(pci_epc_remove_epf);
>> --
>> 2.7.4
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: endpoint: Set endpoint controller pointer to null
2019-05-23 21:45 [PATCH v2] PCI: endpoint: Set endpoint controller pointer to null Alan Mikhak
2019-05-23 23:57 ` Alan Mikhak
@ 2019-06-11 10:07 ` Lorenzo Pieralisi
1 sibling, 0 replies; 4+ messages in thread
From: Lorenzo Pieralisi @ 2019-06-11 10:07 UTC (permalink / raw)
To: Alan Mikhak
Cc: linux-pci, linux-kernel, kishon, linux-riscv, palmer, paul.walmsley
On Thu, May 23, 2019 at 02:45:44PM -0700, Alan Mikhak wrote:
> Set endpoint controller pointer to null in pci_epc_remove_epf()
> to avoid -EBUSY on subsequent call to pci_epc_add_epf().
>
> Requires checking for null endpoint function pointer.
>
> Signed-off-by: Alan Mikhak <alan.mikhak@sifive.com>
> ---
> drivers/pci/endpoint/pci-epc-core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Applied to pci/endpoint for v5.3, thanks.
Lorenzo
> diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
> index e4712a0f249c..2091508c1620 100644
> --- a/drivers/pci/endpoint/pci-epc-core.c
> +++ b/drivers/pci/endpoint/pci-epc-core.c
> @@ -519,11 +519,12 @@ void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf)
> {
> unsigned long flags;
>
> - if (!epc || IS_ERR(epc))
> + if (!epc || IS_ERR(epc) || !epf)
> return;
>
> spin_lock_irqsave(&epc->lock, flags);
> list_del(&epf->list);
> + epf->epc = NULL;
> spin_unlock_irqrestore(&epc->lock, flags);
> }
> EXPORT_SYMBOL_GPL(pci_epc_remove_epf);
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-11 10:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-23 21:45 [PATCH v2] PCI: endpoint: Set endpoint controller pointer to null Alan Mikhak
2019-05-23 23:57 ` Alan Mikhak
2019-05-24 8:41 ` Kishon Vijay Abraham I
2019-06-11 10:07 ` Lorenzo Pieralisi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).