All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI/AER: Move pci_uevent_ers() out of pci.h
@ 2018-02-08 12:20 Michael Ellerman
  2018-02-08 15:05 ` Bryant G. Ly
  2018-02-22 23:12 ` Bjorn Helgaas
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Ellerman @ 2018-02-08 12:20 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, linuxppc-dev, torvalds, ruscur, bryantly, jjalvare

There's no reason pci_uevent_ers() needs to be inline in pci.h, so
move it out to a C file.

Given it's used by AER the obvious location would be somewhere in
drivers/pci/pcie/aer, but because it's also used by powerpc EEH code
unfortunately that doesn't work in the case where EEH is enabled but
PCIEPORTBUS is not.

So for now put it in pci-driver.c, next to pci_uevent(), with an
appropriate #ifdef so it's not built if AER and EEH are both disabled.

While we're moving it also fix up the kernel doc comment for @pdev to
be accurate.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 drivers/pci/pci-driver.c | 36 ++++++++++++++++++++++++++++++++++++
 include/linux/pci.h      | 38 +++-----------------------------------
 2 files changed, 39 insertions(+), 35 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 3bed6beda051..f21e8b1bef80 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1517,6 +1517,42 @@ static int pci_uevent(struct device *dev, struct kobj_uevent_env *env)
 	return 0;
 }
 
+#if defined(CONFIG_PCIEAER) || defined(CONFIG_EEH)
+/**
+ * pci_uevent_ers - emit a uevent during recovery path of pci device
+ * @pdev: pci device undergoing error recovery
+ * @err_type: type of error event
+ */
+void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type)
+{
+	int idx = 0;
+	char *envp[3];
+
+	switch (err_type) {
+	case PCI_ERS_RESULT_NONE:
+	case PCI_ERS_RESULT_CAN_RECOVER:
+		envp[idx++] = "ERROR_EVENT=BEGIN_RECOVERY";
+		envp[idx++] = "DEVICE_ONLINE=0";
+		break;
+	case PCI_ERS_RESULT_RECOVERED:
+		envp[idx++] = "ERROR_EVENT=SUCCESSFUL_RECOVERY";
+		envp[idx++] = "DEVICE_ONLINE=1";
+		break;
+	case PCI_ERS_RESULT_DISCONNECT:
+		envp[idx++] = "ERROR_EVENT=FAILED_RECOVERY";
+		envp[idx++] = "DEVICE_ONLINE=0";
+		break;
+	default:
+		break;
+	}
+
+	if (idx > 0) {
+		envp[idx++] = NULL;
+		kobject_uevent_env(&pdev->dev.kobj, KOBJ_CHANGE, envp);
+	}
+}
+#endif
+
 static int pci_bus_num_vf(struct device *dev)
 {
 	return pci_num_vf(to_pci_dev(dev));
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 024a1beda008..19c1dbcff0c6 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2280,41 +2280,9 @@ static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev)
 	return false;
 }
 
-/**
- * pci_uevent_ers - emit a uevent during recovery path of pci device
- * @pdev: pci device to check
- * @err_type: type of error event
- *
- */
-static inline void pci_uevent_ers(struct pci_dev *pdev,
-				  enum  pci_ers_result err_type)
-{
-	int idx = 0;
-	char *envp[3];
-
-	switch (err_type) {
-	case PCI_ERS_RESULT_NONE:
-	case PCI_ERS_RESULT_CAN_RECOVER:
-		envp[idx++] = "ERROR_EVENT=BEGIN_RECOVERY";
-		envp[idx++] = "DEVICE_ONLINE=0";
-		break;
-	case PCI_ERS_RESULT_RECOVERED:
-		envp[idx++] = "ERROR_EVENT=SUCCESSFUL_RECOVERY";
-		envp[idx++] = "DEVICE_ONLINE=1";
-		break;
-	case PCI_ERS_RESULT_DISCONNECT:
-		envp[idx++] = "ERROR_EVENT=FAILED_RECOVERY";
-		envp[idx++] = "DEVICE_ONLINE=0";
-		break;
-	default:
-		break;
-	}
-
-	if (idx > 0) {
-		envp[idx++] = NULL;
-		kobject_uevent_env(&pdev->dev.kobj, KOBJ_CHANGE, envp);
-	}
-}
+#if defined(CONFIG_PCIEAER) || defined(CONFIG_EEH)
+void pci_uevent_ers(struct pci_dev *pdev, enum  pci_ers_result err_type);
+#endif
 
 /* Provide the legacy pci_dma_* API */
 #include <linux/pci-dma-compat.h>
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] PCI/AER: Move pci_uevent_ers() out of pci.h
  2018-02-08 12:20 [PATCH] PCI/AER: Move pci_uevent_ers() out of pci.h Michael Ellerman
@ 2018-02-08 15:05 ` Bryant G. Ly
  2018-02-22 23:12   ` Bjorn Helgaas
  2018-02-22 23:12 ` Bjorn Helgaas
  1 sibling, 1 reply; 7+ messages in thread
From: Bryant G. Ly @ 2018-02-08 15:05 UTC (permalink / raw)
  To: Michael Ellerman, bhelgaas
  Cc: linux-pci, linuxppc-dev, torvalds, ruscur, jjalvare


On 2/8/18 6:20 AM, Michael Ellerman wrote:

> There's no reason pci_uevent_ers() needs to be inline in pci.h, so
> move it out to a C file.
>
> Given it's used by AER the obvious location would be somewhere in
> drivers/pci/pcie/aer, but because it's also used by powerpc EEH code
> unfortunately that doesn't work in the case where EEH is enabled but
> PCIEPORTBUS is not.
>
> So for now put it in pci-driver.c, next to pci_uevent(), with an
> appropriate #ifdef so it's not built if AER and EEH are both disabled.
>
> While we're moving it also fix up the kernel doc comment for @pdev to
> be accurate.
>
> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
>  drivers/pci/pci-driver.c | 36 ++++++++++++++++++++++++++++++++++++
>  include/linux/pci.h      | 38 +++-----------------------------------
>  2 files changed, 39 insertions(+), 35 deletions(-)

Looks good, thanks for fixing it!

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>

-Bryant

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] PCI/AER: Move pci_uevent_ers() out of pci.h
  2018-02-08 15:05 ` Bryant G. Ly
@ 2018-02-22 23:12   ` Bjorn Helgaas
  2018-02-23  4:10     ` Michael Ellerman
  0 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2018-02-22 23:12 UTC (permalink / raw)
  To: Bryant G. Ly
  Cc: Michael Ellerman, bhelgaas, linux-pci, linuxppc-dev, torvalds,
	ruscur, jjalvare

On Thu, Feb 08, 2018 at 09:05:45AM -0600, Bryant G. Ly wrote:
> 
> On 2/8/18 6:20 AM, Michael Ellerman wrote:
> 
> > There's no reason pci_uevent_ers() needs to be inline in pci.h, so
> > move it out to a C file.
> >
> > Given it's used by AER the obvious location would be somewhere in
> > drivers/pci/pcie/aer, but because it's also used by powerpc EEH code
> > unfortunately that doesn't work in the case where EEH is enabled but
> > PCIEPORTBUS is not.
> >
> > So for now put it in pci-driver.c, next to pci_uevent(), with an
> > appropriate #ifdef so it's not built if AER and EEH are both disabled.
> >
> > While we're moving it also fix up the kernel doc comment for @pdev to
> > be accurate.
> >
> > Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
> > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> > ---
> >  drivers/pci/pci-driver.c | 36 ++++++++++++++++++++++++++++++++++++
> >  include/linux/pci.h      | 38 +++-----------------------------------
> >  2 files changed, 39 insertions(+), 35 deletions(-)
> 
> Looks good, thanks for fixing it!
> 
> Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>

This would normally be a "Reviewed-by" unless you actually
participated in developing the patch, and in that case, your
"Signed-off-by" would normally be included in the original posting.

What do you intend?  I'll be glad to add either.

Bjorn

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] PCI/AER: Move pci_uevent_ers() out of pci.h
  2018-02-08 12:20 [PATCH] PCI/AER: Move pci_uevent_ers() out of pci.h Michael Ellerman
  2018-02-08 15:05 ` Bryant G. Ly
@ 2018-02-22 23:12 ` Bjorn Helgaas
  2018-02-23  4:09   ` Michael Ellerman
  1 sibling, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2018-02-22 23:12 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: bhelgaas, linux-pci, linuxppc-dev, torvalds, ruscur, bryantly, jjalvare

On Thu, Feb 08, 2018 at 11:20:35PM +1100, Michael Ellerman wrote:
> There's no reason pci_uevent_ers() needs to be inline in pci.h, so
> move it out to a C file.
> 
> Given it's used by AER the obvious location would be somewhere in
> drivers/pci/pcie/aer, but because it's also used by powerpc EEH code
> unfortunately that doesn't work in the case where EEH is enabled but
> PCIEPORTBUS is not.
> 
> So for now put it in pci-driver.c, next to pci_uevent(), with an
> appropriate #ifdef so it's not built if AER and EEH are both disabled.
> 
> While we're moving it also fix up the kernel doc comment for @pdev to
> be accurate.
> 
> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Applied to pci/aer for v4.17, thanks!

> ---
>  drivers/pci/pci-driver.c | 36 ++++++++++++++++++++++++++++++++++++
>  include/linux/pci.h      | 38 +++-----------------------------------
>  2 files changed, 39 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index 3bed6beda051..f21e8b1bef80 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -1517,6 +1517,42 @@ static int pci_uevent(struct device *dev, struct kobj_uevent_env *env)
>  	return 0;
>  }
>  
> +#if defined(CONFIG_PCIEAER) || defined(CONFIG_EEH)
> +/**
> + * pci_uevent_ers - emit a uevent during recovery path of pci device
> + * @pdev: pci device undergoing error recovery
> + * @err_type: type of error event
> + */
> +void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type)
> +{
> +	int idx = 0;
> +	char *envp[3];
> +
> +	switch (err_type) {
> +	case PCI_ERS_RESULT_NONE:
> +	case PCI_ERS_RESULT_CAN_RECOVER:
> +		envp[idx++] = "ERROR_EVENT=BEGIN_RECOVERY";
> +		envp[idx++] = "DEVICE_ONLINE=0";
> +		break;
> +	case PCI_ERS_RESULT_RECOVERED:
> +		envp[idx++] = "ERROR_EVENT=SUCCESSFUL_RECOVERY";
> +		envp[idx++] = "DEVICE_ONLINE=1";
> +		break;
> +	case PCI_ERS_RESULT_DISCONNECT:
> +		envp[idx++] = "ERROR_EVENT=FAILED_RECOVERY";
> +		envp[idx++] = "DEVICE_ONLINE=0";
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	if (idx > 0) {
> +		envp[idx++] = NULL;
> +		kobject_uevent_env(&pdev->dev.kobj, KOBJ_CHANGE, envp);
> +	}
> +}
> +#endif
> +
>  static int pci_bus_num_vf(struct device *dev)
>  {
>  	return pci_num_vf(to_pci_dev(dev));
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 024a1beda008..19c1dbcff0c6 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -2280,41 +2280,9 @@ static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev)
>  	return false;
>  }
>  
> -/**
> - * pci_uevent_ers - emit a uevent during recovery path of pci device
> - * @pdev: pci device to check
> - * @err_type: type of error event
> - *
> - */
> -static inline void pci_uevent_ers(struct pci_dev *pdev,
> -				  enum  pci_ers_result err_type)
> -{
> -	int idx = 0;
> -	char *envp[3];
> -
> -	switch (err_type) {
> -	case PCI_ERS_RESULT_NONE:
> -	case PCI_ERS_RESULT_CAN_RECOVER:
> -		envp[idx++] = "ERROR_EVENT=BEGIN_RECOVERY";
> -		envp[idx++] = "DEVICE_ONLINE=0";
> -		break;
> -	case PCI_ERS_RESULT_RECOVERED:
> -		envp[idx++] = "ERROR_EVENT=SUCCESSFUL_RECOVERY";
> -		envp[idx++] = "DEVICE_ONLINE=1";
> -		break;
> -	case PCI_ERS_RESULT_DISCONNECT:
> -		envp[idx++] = "ERROR_EVENT=FAILED_RECOVERY";
> -		envp[idx++] = "DEVICE_ONLINE=0";
> -		break;
> -	default:
> -		break;
> -	}
> -
> -	if (idx > 0) {
> -		envp[idx++] = NULL;
> -		kobject_uevent_env(&pdev->dev.kobj, KOBJ_CHANGE, envp);
> -	}
> -}
> +#if defined(CONFIG_PCIEAER) || defined(CONFIG_EEH)
> +void pci_uevent_ers(struct pci_dev *pdev, enum  pci_ers_result err_type);
> +#endif
>  
>  /* Provide the legacy pci_dma_* API */
>  #include <linux/pci-dma-compat.h>
> -- 
> 2.14.1
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] PCI/AER: Move pci_uevent_ers() out of pci.h
  2018-02-22 23:12 ` Bjorn Helgaas
@ 2018-02-23  4:09   ` Michael Ellerman
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2018-02-23  4:09 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: bhelgaas, linux-pci, linuxppc-dev, torvalds, ruscur, bryantly, jjalvare

Bjorn Helgaas <helgaas@kernel.org> writes:
> On Thu, Feb 08, 2018 at 11:20:35PM +1100, Michael Ellerman wrote:
>> There's no reason pci_uevent_ers() needs to be inline in pci.h, so
>> move it out to a C file.
>> 
>> Given it's used by AER the obvious location would be somewhere in
>> drivers/pci/pcie/aer, but because it's also used by powerpc EEH code
>> unfortunately that doesn't work in the case where EEH is enabled but
>> PCIEPORTBUS is not.
>> 
>> So for now put it in pci-driver.c, next to pci_uevent(), with an
>> appropriate #ifdef so it's not built if AER and EEH are both disabled.
>> 
>> While we're moving it also fix up the kernel doc comment for @pdev to
>> be accurate.
>> 
>> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
>> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>
> Applied to pci/aer for v4.17, thanks!

Thanks.

cheers

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] PCI/AER: Move pci_uevent_ers() out of pci.h
  2018-02-22 23:12   ` Bjorn Helgaas
@ 2018-02-23  4:10     ` Michael Ellerman
  2018-02-23 14:38       ` Bryant G. Ly
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Ellerman @ 2018-02-23  4:10 UTC (permalink / raw)
  To: Bjorn Helgaas, Bryant G. Ly
  Cc: bhelgaas, linux-pci, linuxppc-dev, torvalds, ruscur, jjalvare

Bjorn Helgaas <helgaas@kernel.org> writes:

> On Thu, Feb 08, 2018 at 09:05:45AM -0600, Bryant G. Ly wrote:
>> 
>> On 2/8/18 6:20 AM, Michael Ellerman wrote:
>> 
>> > There's no reason pci_uevent_ers() needs to be inline in pci.h, so
>> > move it out to a C file.
>> >
>> > Given it's used by AER the obvious location would be somewhere in
>> > drivers/pci/pcie/aer, but because it's also used by powerpc EEH code
>> > unfortunately that doesn't work in the case where EEH is enabled but
>> > PCIEPORTBUS is not.
>> >
>> > So for now put it in pci-driver.c, next to pci_uevent(), with an
>> > appropriate #ifdef so it's not built if AER and EEH are both disabled.
>> >
>> > While we're moving it also fix up the kernel doc comment for @pdev to
>> > be accurate.
>> >
>> > Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
>> > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>> > ---
>> >  drivers/pci/pci-driver.c | 36 ++++++++++++++++++++++++++++++++++++
>> >  include/linux/pci.h      | 38 +++-----------------------------------
>> >  2 files changed, 39 insertions(+), 35 deletions(-)
>> 
>> Looks good, thanks for fixing it!
>> 
>> Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
>
> This would normally be a "Reviewed-by" unless you actually
> participated in developing the patch, and in that case, your
> "Signed-off-by" would normally be included in the original posting.
>
> What do you intend?  I'll be glad to add either.

I wrote the patch, so Bryant meant Reviewed-by or maybe Acked-by.

cheers

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] PCI/AER: Move pci_uevent_ers() out of pci.h
  2018-02-23  4:10     ` Michael Ellerman
@ 2018-02-23 14:38       ` Bryant G. Ly
  0 siblings, 0 replies; 7+ messages in thread
From: Bryant G. Ly @ 2018-02-23 14:38 UTC (permalink / raw)
  To: Michael Ellerman, Bjorn Helgaas
  Cc: bhelgaas, linux-pci, linuxppc-dev, torvalds, ruscur, jjalvare



On 2/22/18 10:10 PM, Michael Ellerman wrote:
> Bjorn Helgaas <helgaas@kernel.org> writes:
>
>> On Thu, Feb 08, 2018 at 09:05:45AM -0600, Bryant G. Ly wrote:
>>> On 2/8/18 6:20 AM, Michael Ellerman wrote:
>>>
>>>> There's no reason pci_uevent_ers() needs to be inline in pci.h, so
>>>> move it out to a C file.
>>>>
>>>> Given it's used by AER the obvious location would be somewhere in
>>>> drivers/pci/pcie/aer, but because it's also used by powerpc EEH code
>>>> unfortunately that doesn't work in the case where EEH is enabled but
>>>> PCIEPORTBUS is not.
>>>>
>>>> So for now put it in pci-driver.c, next to pci_uevent(), with an
>>>> appropriate #ifdef so it's not built if AER and EEH are both disabled.
>>>>
>>>> While we're moving it also fix up the kernel doc comment for @pdev to
>>>> be accurate.
>>>>
>>>> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
>>>> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>>>> ---
>>>>  drivers/pci/pci-driver.c | 36 ++++++++++++++++++++++++++++++++++++
>>>>  include/linux/pci.h      | 38 +++-----------------------------------
>>>>  2 files changed, 39 insertions(+), 35 deletions(-)
>>> Looks good, thanks for fixing it!
>>>
>>> Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
>> This would normally be a "Reviewed-by" unless you actually
>> participated in developing the patch, and in that case, your
>> "Signed-off-by" would normally be included in the original posting.
>>
>> What do you intend?  I'll be glad to add either.
> I wrote the patch, so Bryant meant Reviewed-by or maybe Acked-by.
>
> cheers
>
Yes, I mean't, 

Reviewed-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>

Thanks, 

Bryant

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-23 14:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08 12:20 [PATCH] PCI/AER: Move pci_uevent_ers() out of pci.h Michael Ellerman
2018-02-08 15:05 ` Bryant G. Ly
2018-02-22 23:12   ` Bjorn Helgaas
2018-02-23  4:10     ` Michael Ellerman
2018-02-23 14:38       ` Bryant G. Ly
2018-02-22 23:12 ` Bjorn Helgaas
2018-02-23  4:09   ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.