From patchwork Tue Jul 26 09:59:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 594491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAA0BC433EF for ; Tue, 26 Jul 2022 09:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237675AbiGZJ6E (ORCPT ); Tue, 26 Jul 2022 05:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238332AbiGZJ54 (ORCPT ); Tue, 26 Jul 2022 05:57:56 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6BEC32452; Tue, 26 Jul 2022 02:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1658829450; x=1690365450; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=i8ZzEPCPV1l7drUm54+sPDrEsQsrRaUXcWuEJ9BPPeU=; b=bCPSdz8e20vtMJuufwEG9jNNQB8GPPPgHqb+GbAZwqs0t3wc3IpM/a/d pF0cs4duU4GBOrI5n7mVW8R1ctbqsP+n3kVwjmseQABqo/agcI0gLSBP9 WkLRGceG7JB5F158APczj+tV9LdtFeQg5bR3jPsA1oolp5NHqhLvN3Yn5 ck3Yxo+cC4aEfxwOJ7QvGMG7ZrSHwSQ9O0lMxHzOWZvXJIQ1nw3Akmuyk W05g7KwGzGye7D+BzW4qLkjR+iXklXXJ3hlDflfch/jTeNEzmjWAf8wnP 5brDBPeeZzXwGhN44zP0sAwsp3BoyxYzM5MFbm9zhdp+kxL+nvDnLHKe0 Q==; X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="173652709" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2022 02:57:29 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 26 Jul 2022 02:57:28 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Tue, 26 Jul 2022 02:57:25 -0700 From: Claudiu Beznea To: , , , , CC: , , , Claudiu Beznea Subject: [PATCH 1/2] usb: gadget: at91_udc: stop using legacy pm ops Date: Tue, 26 Jul 2022 12:59:47 +0300 Message-ID: <20220726095948.1809038-1-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Stop using legacy PM ops and switch using dev_pm_ops. Signed-off-by: Claudiu Beznea --- 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 #include #include +#include #include #include #include @@ -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), }, }; From patchwork Tue Jul 26 09:59:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 593721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12413C43334 for ; Tue, 26 Jul 2022 09:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238721AbiGZJ6H (ORCPT ); Tue, 26 Jul 2022 05:58:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238708AbiGZJ55 (ORCPT ); Tue, 26 Jul 2022 05:57:57 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 571403245F; Tue, 26 Jul 2022 02:57:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1658829451; x=1690365451; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JG/ERXhf6xiKqQVd9uEykEdvGxS/Vz7RRikpu9AWpDE=; b=e8Q2al9e7nTbmFaFMXfgcnyMYdJkS63GYGhkkX+u4Ey6x8xh60Ap9TIR 8QKpmzROyXaPSKtoYVPIh2Qj290j9OZO3IX3T0Lx3ZGFACtsxv8L5aNaN 9K0UP8YyfPE5Q6qOwFrFngEasLx1T6tcSCpWQrNDv5Z7JL1oPnrbqAgW5 wZg1NldTiY5G9ayXW41wGlV1FZ3pkel5YWjKObQkzPKOt2sFcLbLSt6dP tDVUFWO2ulc5qRbLRAeDnNR84kfADJ20BmKfBmkz2/YFZXG/kSWQHkpO2 mO1DWMuYpHAEI22XJaQW3E8eDtMBRMMB5UBiZ7t2dZqSSvRpzrq/7wJEr g==; X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="166409646" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2022 02:57:30 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 26 Jul 2022 02:57:30 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Tue, 26 Jul 2022 02:57:28 -0700 From: Claudiu Beznea To: , , , , CC: , , , Claudiu Beznea Subject: [PATCH 2/2] usb: gadget: udc: atmel: remove #ifdef CONFIG_PM_SLEEP Date: Tue, 26 Jul 2022 12:59:48 +0300 Message-ID: <20220726095948.1809038-2-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220726095948.1809038-1-claudiu.beznea@microchip.com> References: <20220726095948.1809038-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Remove #ifdef CONFIG_PM_SLEEP and use DEFINE_SIMPLE_DEV_PM_OPS() along with pm_sleep_ptr(). Signed-off-by: Claudiu Beznea --- 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, }, };