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

* [PATCH 2/2] usb: gadget: udc: atmel: remove #ifdef CONFIG_PM_SLEEP
  2022-07-26  9:59 [PATCH 1/2] usb: gadget: at91_udc: stop using legacy pm ops Claudiu Beznea
@ 2022-07-26  9:59 ` Claudiu Beznea
  2022-07-26 17:11 ` [PATCH 1/2] usb: gadget: at91_udc: stop using legacy pm ops Greg KH
  1 sibling, 0 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

Remove #ifdef CONFIG_PM_SLEEP and use DEFINE_SIMPLE_DEV_PM_OPS() along with
pm_sleep_ptr().

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index ae2bfbac603e..6c088f6e9afa 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -2384,7 +2384,6 @@ static int usba_udc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int usba_udc_suspend(struct device *dev)
 {
 	struct usba_udc *udc = dev_get_drvdata(dev);
@@ -2442,15 +2441,14 @@ static int usba_udc_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(usba_udc_pm_ops, usba_udc_suspend, usba_udc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(usba_udc_pm_ops, usba_udc_suspend, usba_udc_resume);
 
 static struct platform_driver udc_driver = {
 	.remove		= usba_udc_remove,
 	.driver		= {
 		.name		= "atmel_usba_udc",
-		.pm		= &usba_udc_pm_ops,
+		.pm		= pm_sleep_ptr(&usba_udc_pm_ops),
 		.of_match_table	= atmel_udc_dt_ids,
 	},
 };
-- 
2.34.1


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

* Re: [PATCH 1/2] usb: gadget: at91_udc: stop using legacy pm ops
  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 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2022-07-26 17:11 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: balbi, nicolas.ferre, alexandre.belloni, cristian.birsan,
	linux-usb, linux-arm-kernel, linux-kernel

On Tue, Jul 26, 2022 at 12:59:47PM +0300, Claudiu Beznea wrote:
> Stop using legacy PM ops and switch using dev_pm_ops.

That says what you did, but not why you are doing this.

Please read the kernel documentation for how to write a good kernel
changelog and resubmit.

thanks,

greg k-h

^ permalink raw reply	[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).