Skip to contentSkip to conversation

accel/amdxdna: use modern PM helpers

PATCH Applied Arnd Bergmann 3 participants 8 messages Dec 13, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 accel/amdxdna: use modern PM helpers

From: Arnd Bergmann <[email protected]>

The old SET_SYSTEM_SLEEP_PM_OPS and SET_RUNTIME_PM_OPS macros cause a build warning when CONFIG_PM is disabled:

drivers/accel/amdxdna/amdxdna_pci_drv.c:343:12: error: 'amdxdna_pmops_resume' defined but not used [-Werror=unused-function]
343 | static int amdxdna_pmops_resume(struct device *dev)

      |            ^~~~~~~~~~~~~~~~~~~~
drivers/accel/amdxdna/amdxdna_pci_drv.c:328:12: error: 'amdxdna_pmops_suspend' defined but not used [-Werror=unused-function]
  328 | static int amdxdna_pmops_suspend(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~

Change these to the modern replacements.

---
 drivers/accel/amdxdna/amdxdna_pci_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/accel/amdxdna/amdxdna_pci_drv.c +2 -2
index 02533732d4ca..b2342abdddc6 100644
@@ -390,8 +390,8 @@ static int amdxdna_rpmops_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops amdxdna_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(amdxdna_pmops_suspend, amdxdna_pmops_resume)
-	SET_RUNTIME_PM_OPS(amdxdna_rpmops_suspend, amdxdna_rpmops_resume, NULL)
+	SYSTEM_SLEEP_PM_OPS(amdxdna_pmops_suspend, amdxdna_pmops_resume)
+	RUNTIME_PM_OPS(amdxdna_rpmops_suspend, amdxdna_rpmops_resume, NULL)
 };
 
 static struct pci_driver amdxdna_pci_driver = {
Signature · 1 line
2.39.5
#1 lore raw

PATCH 2/2 accel/amdxdna: add missing includes

From: Arnd Bergmann <[email protected]>

This driver fails to build in random configurations:

drivers/accel/amdxdna/amdxdna_mailbox.c:357:8: error: unknown type name 'irqreturn_t'
357 | static irqreturn_t mailbox_irq_handler(int irq, void *p)

      |        ^~~~~~~~~~~
drivers/accel/amdxdna/amdxdna_mailbox.c: In function 'mailbox_irq_handler':
drivers/accel/amdxdna/amdxdna_mailbox.c:367:16: error: 'IRQ_HANDLED' undeclared (first use in this function)
  367 |         return IRQ_HANDLED;
      |                ^~~~~~~~~~~
drivers/accel/amdxdna/amdxdna_mailbox.c:367:16: note: each undeclared identifier is reported only once for each function it appears in
drivers/accel/amdxdna/amdxdna_mailbox.c: In function 'mailbox_rx_worker':
drivers/accel/amdxdna/amdxdna_mailbox.c:395:25: error: implicit declaration of function 'disable_irq'; did you mean 'disable_work'? [-Wimplicit-function-declaration]
  395 |                         disable_irq(mb_chann->msix_irq);
      |                         ^~~~~~~~~~~
drivers/accel/amdxdna/aie2_solver.c: In function 'remove_partition_node':
drivers/accel/amdxdna/aie2_solver.c:121:9: error: implicit declaration of function 'kfree' [-Wimplicit-function-declaration]
  121 |         kfree(pt_node);
      |         ^~~~~

drivers/accel/amdxdna/aie2_solver.c: In function 'get_free_partition':
drivers/accel/amdxdna/aie2_solver.c:153:19: error: implicit declaration of function 'kzalloc' [-Wimplicit-function-declaration]
153 | pt_node = kzalloc(sizeof(*pt_node), GFP_KERNEL);

Include the headers that have the necessary declarations.

Fixes c88d3325ae69 ("accel/amdxdna: Add hardware resource solver")

amdxdna: includ linux/interrupt.h

---
 drivers/accel/amdxdna/aie2_solver.c     | 1 +
 drivers/accel/amdxdna/amdxdna_mailbox.c | 1 +
 2 files changed, 2 insertions(+)
drivers/accel/amdxdna/aie2_solver.c +1 -0
index a537c66589a4..0bbf91cad334 100644
@@ -8,6 +8,7 @@
 #include <drm/drm_print.h>
 #include <linux/bitops.h>
 #include <linux/bitmap.h>
+#include <linux/slab.h>
 
 #include "aie2_solver.h"
 
drivers/accel/amdxdna/amdxdna_mailbox.c +1 -0
index 415d99abaaa3..41bbc5796e11 100644
@@ -7,6 +7,7 @@
 #include <drm/drm_managed.h>
 #include <linux/bitfield.h>
 #include <linux/iopoll.h>
+#include <linux/interrupt.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/amdxdna.h>
Signature · 1 line
2.39.5
#3 lore raw
In reply to Arnd Bergmann
Quoted 7 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The old SET_SYSTEM_SLEEP_PM_OPS and SET_RUNTIME_PM_OPS macros cause a build warning when CONFIG_PM is disabled:

drivers/accel/amdxdna/amdxdna_pci_drv.c:343:12: error: 'amdxdna_pmops_resume' defined but not used [-Werror=unused-function]
343 | static int amdxdna_pmops_resume(struct device *dev)

Quoted 8 lines
       |            ^~~~~~~~~~~~~~~~~~~~
drivers/accel/amdxdna/amdxdna_pci_drv.c:328:12: error: 'amdxdna_pmops_suspend' defined but not used [-Werror=unused-function]
   328 | static int amdxdna_pmops_suspend(struct device *dev)
       |            ^~~~~~~~~~~~~~~~~~~~~

Change these to the modern replacements.

Looks sane to me.

Lizhi, can you verify that this works as expected for you? I'd hate to accidentally break something.

-Jeff

Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] accel/amdxdna: add missing includes

In reply to Arnd Bergmann
Quoted 24 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

This driver fails to build in random configurations:

drivers/accel/amdxdna/amdxdna_mailbox.c:357:8: error: unknown type name 'irqreturn_t'
357 | static irqreturn_t mailbox_irq_handler(int irq, void *p)

       |        ^~~~~~~~~~~
drivers/accel/amdxdna/amdxdna_mailbox.c: In function 'mailbox_irq_handler':
drivers/accel/amdxdna/amdxdna_mailbox.c:367:16: error: 'IRQ_HANDLED' undeclared (first use in this function)
   367 |         return IRQ_HANDLED;
       |                ^~~~~~~~~~~
drivers/accel/amdxdna/amdxdna_mailbox.c:367:16: note: each undeclared identifier is reported only once for each function it appears in
drivers/accel/amdxdna/amdxdna_mailbox.c: In function 'mailbox_rx_worker':
drivers/accel/amdxdna/amdxdna_mailbox.c:395:25: error: implicit declaration of function 'disable_irq'; did you mean 'disable_work'? [-Wimplicit-function-declaration]
   395 |                         disable_irq(mb_chann->msix_irq);
       |                         ^~~~~~~~~~~
drivers/accel/amdxdna/aie2_solver.c: In function 'remove_partition_node':
drivers/accel/amdxdna/aie2_solver.c:121:9: error: implicit declaration of function 'kfree' [-Wimplicit-function-declaration]
   121 |         kfree(pt_node);
       |         ^~~~~

drivers/accel/amdxdna/aie2_solver.c: In function 'get_free_partition':
drivers/accel/amdxdna/aie2_solver.c:153:19: error: implicit declaration of function 'kzalloc' [-Wimplicit-function-declaration]
153 | pt_node = kzalloc(sizeof(*pt_node), GFP_KERNEL);

Quoted 8 lines

Include the headers that have the necessary declarations.

Fixes c88d3325ae69 ("accel/amdxdna: Add hardware resource solver")

amdxdna: includ linux/interrupt.h

The interrupt part of this is now fixed, see "accel/amdxdna: Add include interrupt.h to amdxdna_mailbox.c".

The slab portion looks sane. I'll trim the patch when applying unless you'd prefer something else.

maintainer
#4 lore raw
In reply to Jeffrey Hugo
Quoted 13 lines · Jeffrey Hugo
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The old SET_SYSTEM_SLEEP_PM_OPS and SET_RUNTIME_PM_OPS macros cause a build warning when CONFIG_PM is disabled:

drivers/accel/amdxdna/amdxdna_pci_drv.c:343:12: error: 'amdxdna_pmops_resume' defined but not used [-Werror=unused-function] 343 | static int amdxdna_pmops_resume(struct device *dev)
       |            ^~~~~~~~~~~~~~~~~~~~
drivers/accel/amdxdna/amdxdna_pci_drv.c:328:12: error: 'amdxdna_pmops_suspend' defined but not used [-Werror=unused-function] 328 | static int amdxdna_pmops_suspend(struct device *dev)
       |            ^~~~~~~~~~~~~~~~~~~~~

Quoted 7 lines
Quoted 3 lines

Change these to the modern replacements.

Looks sane to me.

Lizhi, can you verify that this works as expected for you?  I'd hate to accidentally break something.

Verified suspend/resume. It works fine.

Lizhi

Quoted 3 lines

-Jeff

#5 lore raw
Quoted 17 lines · Lizhi Hou
Quoted 15 lines · Jeffrey Hugo
Quoted 14 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The old SET_SYSTEM_SLEEP_PM_OPS and SET_RUNTIME_PM_OPS macros cause a build warning when CONFIG_PM is disabled:

drivers/accel/amdxdna/amdxdna_pci_drv.c:343:12: error: 'amdxdna_pmops_resume' defined but not used [-Werror=unused-function] 343 | static int amdxdna_pmops_resume(struct device *dev)
       |            ^~~~~~~~~~~~~~~~~~~~
drivers/accel/amdxdna/amdxdna_pci_drv.c:328:12: error: 'amdxdna_pmops_suspend' defined but not used [-Werror=unused-function] 328 | static int amdxdna_pmops_suspend(struct device *dev)
       |            ^~~~~~~~~~~~~~~~~~~~~

Change these to the modern replacements.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Looks sane to me.

Lizhi, can you verify that this works as expected for you?  I'd hate to accidentally break something.

Verified suspend/resume. It works fine.

Excellent. Would you like to give a reviewed-by and/or a tested-by?

-Jeff

maintainer Reviewed-by Tested-by
#6 lore raw
Quoted 20 lines · Jeffrey Hugo
Quoted 19 lines · Lizhi Hou
Quoted 17 lines · Jeffrey Hugo
Quoted 15 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The old SET_SYSTEM_SLEEP_PM_OPS and SET_RUNTIME_PM_OPS macros cause a build warning when CONFIG_PM is disabled:

drivers/accel/amdxdna/amdxdna_pci_drv.c:343:12: error: 'amdxdna_pmops_resume' defined but not used [-Werror=unused-function] 343 | static int amdxdna_pmops_resume(struct device *dev)
       |            ^~~~~~~~~~~~~~~~~~~~
drivers/accel/amdxdna/amdxdna_pci_drv.c:328:12: error: 'amdxdna_pmops_suspend' defined but not used [-Werror=unused-function] 328 | static int amdxdna_pmops_suspend(struct device *dev)
       |            ^~~~~~~~~~~~~~~~~~~~~

Change these to the modern replacements.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Looks sane to me.

Lizhi, can you verify that this works as expected for you? I'd hate to accidentally break something.

Verified suspend/resume. It works fine.

Excellent.  Would you like to give a reviewed-by and/or a tested-by?

Quoted 3 lines

-Jeff

Applied
#7 lore raw
Quoted 26 lines · Lizhi Hou
Quoted 24 lines · Jeffrey Hugo
Quoted 23 lines · Lizhi Hou
Quoted 20 lines · Jeffrey Hugo
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The old SET_SYSTEM_SLEEP_PM_OPS and SET_RUNTIME_PM_OPS macros cause a build warning when CONFIG_PM is disabled:

drivers/accel/amdxdna/amdxdna_pci_drv.c:343:12: error: 'amdxdna_pmops_resume' defined but not used [-Werror=unused-function] 343 | static int amdxdna_pmops_resume(struct device *dev)
       |            ^~~~~~~~~~~~~~~~~~~~
drivers/accel/amdxdna/amdxdna_pci_drv.c:328:12: error: 'amdxdna_pmops_suspend' defined but not used [-Werror=unused-function] 328 | static int amdxdna_pmops_suspend(struct device *dev)
       |            ^~~~~~~~~~~~~~~~~~~~~

Quoted 3 lines

Change these to the modern replacements.

Looks sane to me.

Lizhi, can you verify that this works as expected for you? I'd hate to accidentally break something.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Verified suspend/resume. It works fine.

Excellent.  Would you like to give a reviewed-by and/or a tested-by?

Thanks!

Pushed to drm-misc-next

-Jeff