linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: gadget: at91_udc: stop using legacy pm ops
@ 2022-07-26  9:59 Claudiu Beznea
  2022-07-26  9:59 ` [PATCH 2/2] usb: gadget: udc: atmel: remove #ifdef CONFIG_PM_SLEEP Claudiu Beznea
  2022-07-26 17:11 ` [PATCH 1/2] usb: gadget: at91_udc: stop using legacy pm ops Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Claudiu Beznea @ 2022-07-26  9:59 UTC (permalink / raw)
  To: balbi, gregkh, nicolas.ferre, alexandre.belloni, cristian.birsan
  Cc: linux-usb, linux-arm-kernel, linux-kernel, Claudiu Beznea

Stop using legacy PM ops and switch using dev_pm_ops.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/usb/gadget/udc/at91_udc.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c
index 728987280373..2f522f77c553 100644
--- a/drivers/usb/gadget/udc/at91_udc.c
+++ b/drivers/usb/gadget/udc/at91_udc.c
@@ -27,6 +27,7 @@
 #include <linux/of.h>
 #include <linux/gpio/consumer.h>
 #include <linux/platform_data/atmel.h>
+#include <linux/pm.h>
 #include <linux/regmap.h>
 #include <linux/mfd/syscon.h>
 #include <linux/mfd/syscon/atmel-matrix.h>
@@ -1948,11 +1949,10 @@ static int at91udc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int at91udc_suspend(struct platform_device *pdev, pm_message_t mesg)
+static int at91udc_suspend(struct device *dev)
 {
-	struct at91_udc *udc = platform_get_drvdata(pdev);
-	int		wake = udc->driver && device_may_wakeup(&pdev->dev);
+	struct at91_udc *udc = dev_get_drvdata(dev);
+	int		wake = udc->driver && device_may_wakeup(dev);
 	unsigned long	flags;
 
 	/* Unless we can act normally to the host (letting it wake us up
@@ -1976,9 +1976,9 @@ static int at91udc_suspend(struct platform_device *pdev, pm_message_t mesg)
 	return 0;
 }
 
-static int at91udc_resume(struct platform_device *pdev)
+static int at91udc_resume(struct device *dev)
 {
-	struct at91_udc *udc = platform_get_drvdata(pdev);
+	struct at91_udc *udc = dev_get_drvdata(dev);
 	unsigned long	flags;
 
 	if (udc->board.vbus_pin && !udc->board.vbus_polled &&
@@ -1995,19 +1995,17 @@ static int at91udc_resume(struct platform_device *pdev)
 	}
 	return 0;
 }
-#else
-#define	at91udc_suspend	NULL
-#define	at91udc_resume	NULL
-#endif
+
+static DEFINE_SIMPLE_DEV_PM_OPS(at91_udc_pm_ops, at91udc_suspend,
+				at91udc_resume);
 
 static struct platform_driver at91_udc_driver = {
 	.remove		= at91udc_remove,
 	.shutdown	= at91udc_shutdown,
-	.suspend	= at91udc_suspend,
-	.resume		= at91udc_resume,
 	.driver		= {
 		.name	= driver_name,
 		.of_match_table	= at91_udc_dt_ids,
+		.pm = pm_ptr(&at91_udc_pm_ops),
 	},
 };
 
-- 
2.34.1


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

end of thread, other threads:[~2022-07-26 17:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-26  9:59 [PATCH 1/2] usb: gadget: at91_udc: stop using legacy pm ops Claudiu Beznea
2022-07-26  9:59 ` [PATCH 2/2] usb: gadget: udc: atmel: remove #ifdef CONFIG_PM_SLEEP Claudiu Beznea
2022-07-26 17:11 ` [PATCH 1/2] usb: gadget: at91_udc: stop using legacy pm ops Greg KH

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).