[PATCH 1/2] usb: gadget: at91_udc: stop using legacy pm ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stop using legacy PM ops and switch using dev_pm_ops.

Signed-off-by: Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux