From patchwork Fri Apr 12 14:22:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13627852 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5362127E11; Fri, 12 Apr 2024 14:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712931823; cv=none; b=mT9Tal8Bc1gB6Ion6v6Rw6xu7vX9l9/HQY56yX/2F5r6dcegHsPJ4T4eftx9tWQLJLq8sJWYxsXmmfYgZguHtgha3vbkQTAn4V0MIvORYuSShRuUhF6o1//AvjmaLOVtL3u06wZ8Mg555Vy74P/wdzJnyKa+28fpTcOp2y3hWAg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712931823; c=relaxed/simple; bh=8a4gsNEadLOtIZghi2tFBrfU/msc1IOPDhK9K4Lmb8s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bm/Td1ljSTL6Xxq+/5sj7P1eibM2SGDVipwG/thhqL4+kMiFqHFSMfiTfAAsIxA40fLtA/nY3X6xZc5BAr9cHV3Dy2h2fColcptILk1qbTfFmmfRoTNGPAfYcXHeuhanb/SsSueVlmgG2HBQ88gjR8V3NghY4U4uR0p6IdcvFdc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EaGQ5Sa3; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EaGQ5Sa3" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6e782e955adso946331b3a.3; Fri, 12 Apr 2024 07:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712931821; x=1713536621; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YbcIWXIZQhqjePjNygTPT5SO2Zgomq/T2Ylg5jMiQ34=; b=EaGQ5Sa3TXy4Sf74mlIe/opKMC6qEh9UJ8iUU9b0Rb9zodEUIJgPJhbRZ3OUdEIXKS ffWGv9eB7/CX34cznWLxVrQWt1sDcxlKxXfZTXLWav2f4+fz3uJFuSRR8beK6U0iwPcj 1epTQa/M205E+EkM2Mh6xn6FhcK5kGxnrstZ18LL8heCmU0Jiy1+3DdM9SSh0oI81wLz LxjfdcWoxUQGbJuSf00Ngd9jfrv3YRSBoKxOqdsoN9aTdGXoIRi8Lc3p7SSqJ1GTh0Ep vHj3i8zLSc7gLXcR+C5ag8CYh3FOLln4M2Z6Olx+dXkdIgluNKCUqKon04vowvgi1WVf wboA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712931821; x=1713536621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YbcIWXIZQhqjePjNygTPT5SO2Zgomq/T2Ylg5jMiQ34=; b=RmPIKRocVo1+lPHoBBXgFyyInh5dMhVwZwwc8gHuuj/zdwZzRavsjUZWxTuxUuYRNm 1zE/sL1eC8Tto5Mb+w9sIZEu6Og/Rxau+EdNZhhwWW1QKnmcPbNuSkXvdpz8Gh6vA6Vh rXi7zG1SEY9mcoeCaF0Z5lPi3e11KJ1IQsw3Feqh+lyra/rYhXFu3+82C5LbhzzRSSep bRtozh7ao+oqQAipmc1jqcrlSiHBoExv1VEvJ+P3r88uHj9fVnhtx/0hk6zLmuyVNTn9 KcgxTpTqPMVyauJPvxbHxy4HmTQUEaN0yI3xkWn+vqHXzNKro88WUR5o3N2PZoMT0F5h V8ZQ== X-Forwarded-Encrypted: i=1; AJvYcCWTygsT20JMUHXF6Y23owx/LqpsNvuznl2jSIRETFtH+j3D2rqsSWq8dMbUX6LGbxy11scJRYmWUdAL0V0Fy13KkzC3e2zTMywMZS2tqF/34ImyEfBQfjCX+cqPzugkvv16mGlHganLb6LaIjgMxqku2c6yl9Ybk4Uzl9emySmdtcHwMlHKbu044bo= X-Gm-Message-State: AOJu0YwH+LlXgyDApbUlWXpRxta+WqBiN7YJ6TvvysKUvPB9GEfHb34N dokNRgWTmmjtYA3GGosu/VvKQ15BPMpw3l1wAqWwIWZm3YnyQzF9 X-Google-Smtp-Source: AGHT+IEIWwkiKFZ0hzuBzAJRk9Ofk9JFitFBkWwieWH2JxFuFxdmYqQ6OtOWlIDk1o1/OEoLCXoo5Q== X-Received: by 2002:a05:6a21:99b:b0:1a7:6894:cec3 with SMTP id li27-20020a056a21099b00b001a76894cec3mr2899249pzb.32.1712931820933; Fri, 12 Apr 2024 07:23:40 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id n43-20020a056a000d6b00b006e5af565b1dsm2946952pfv.201.2024.04.12.07.23.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 07:23:40 -0700 (PDT) From: Anand Moon To: Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , Johan Hovold , Thinh Nguyen , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/5] usb: ehci-exynos: Use devm_clk_get_enabled() helpers Date: Fri, 12 Apr 2024 19:52:50 +0530 Message-ID: <20240412142317.5191-2-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240412142317.5191-1-linux.amoon@gmail.com> References: <20240412142317.5191-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The devm_clk_get_enabled() helpers: - call devm_clk_get() - call clk_prepare_enable() and register what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids the calls to clk_disable_unprepare(). Signed-off-by: Anand Moon Reviewed-by: Alan Stern --- v3: drop dev_err_probe to simplify the error handle. v2: drop the clk_disable_unprepare in suspend/resume functions fix the usb_put_hcd return before the devm_clk_get_enabled --- drivers/usb/host/ehci-exynos.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index f644b131cc0b..e2303757bc0f 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -159,20 +159,16 @@ static int exynos_ehci_probe(struct platform_device *pdev) err = exynos_ehci_get_phy(&pdev->dev, exynos_ehci); if (err) - goto fail_clk; + goto fail_io; - exynos_ehci->clk = devm_clk_get(&pdev->dev, "usbhost"); + exynos_ehci->clk = devm_clk_get_enabled(&pdev->dev, "usbhost"); if (IS_ERR(exynos_ehci->clk)) { dev_err(&pdev->dev, "Failed to get usbhost clock\n"); err = PTR_ERR(exynos_ehci->clk); - goto fail_clk; + goto fail_io; } - err = clk_prepare_enable(exynos_ehci->clk); - if (err) - goto fail_clk; - hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(hcd->regs)) { err = PTR_ERR(hcd->regs); @@ -223,8 +219,6 @@ static int exynos_ehci_probe(struct platform_device *pdev) exynos_ehci_phy_disable(&pdev->dev); pdev->dev.of_node = exynos_ehci->of_node; fail_io: - clk_disable_unprepare(exynos_ehci->clk); -fail_clk: usb_put_hcd(hcd); return err; } @@ -240,8 +234,6 @@ static void exynos_ehci_remove(struct platform_device *pdev) exynos_ehci_phy_disable(&pdev->dev); - clk_disable_unprepare(exynos_ehci->clk); - usb_put_hcd(hcd); } From patchwork Fri Apr 12 14:22:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13627853 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D563B127E14; Fri, 12 Apr 2024 14:23:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712931831; cv=none; b=VRBI5d8Ky+V8dj87de+CQwu8WYUS51QpnK0yKAfHM0uzRYeR9uPzE3YSRxja3TEbXY13H3RSaXw+m5dYVu7mgevWsKtVjFmrzwWCwD0EhGTxPLxr5NwIPvAYPWcAjGG7sD0dPdwldpZTVG34aqklJTYejf9LlqPRaqtYdW3BQsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712931831; c=relaxed/simple; bh=RrFmeckkxLSFqYTd/rrSC0usssCyWG9iD+ADLmZ++Ns=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O8DBG7OVRFPNss+WQl0gLgbaWze2FTwbDQLqwdJsbNzXO4EtBeAfgNK+1wEZdmcxt5Is6KA2ZWlaufscO8MVYGSK6MnAYOnERXotYPFIi28Sz+WsWfkPjHDxT0HRdQ/fSqa5tyuCpk5bB3SN/cihvEkTczSuAHiavxBMyxEnf3w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=admVldIk; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="admVldIk" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6ed5109d924so884718b3a.0; Fri, 12 Apr 2024 07:23:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712931829; x=1713536629; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U7xaoM/t7sWthomv9Zj/NBnEov5ePJmCQG8giDyuvlc=; b=admVldIkP5Mqe2Kku6tPUtIPrXCiL/dzoAvk8fTM+5+JZ0jfhapbfieQ5YIJbSVXiK D0zTY6p4a+Rbf6NfiRCFtpe2t9XAm9TkKFUC/wLh0ntjuabgyDBvK/X+/X1GsLfZk5Bu d3D/ZvBQqJZidR0tOZiB0ICNg6fbGKuFAdy1r+a4GFWX2USC2KOV/AMw8t4yQFCYpYDP AZR1AK3dURnrHNgBkoHauvIaa1YAua4Fr0T0C7c81vJPzgAfaIUz+AcYlg4Q9raVuF2n Hpzs5intNs+tQ4/4waWKpuso+sEbhCkZ7jAnCUHgGx8kXMhsHis8lFI3yqxfJcTbsynR tqqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712931829; x=1713536629; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U7xaoM/t7sWthomv9Zj/NBnEov5ePJmCQG8giDyuvlc=; b=EguJMppm8l2kKbdopx+cVwYPUgbd5XycxMy9Uxcx+8CGH58e1ffLAwQSU4K52v1ZjJ 6FHngbaxv8irlzz4/1JSV0a9naivzyjF/DM0VVhnUofSc+w9/TqpkZiAltkB2CAb9UGm kayaE7U1CynNpkDSL5XqTUHaQtJzMsoEqZTjlQbqjM76tTC29QwjfriXL+V3Fv19zEhl MGypMGqoMllkqXMwb/Yu1emKZ6B017ZnyEZIDSDyAEFTjrUoL464QK+MiWn8VZccbO6x f94kAg1Ewa5mxln240LuJUv/X1FFcXMynarNQNOE2Q6TBdafMki+Za0V/N3z2KeIKHid 1bdg== X-Forwarded-Encrypted: i=1; AJvYcCXXiCrISB80lP+phicQ1960zIFea9lDti698gSclfHQffBToxHuKgU9Y++7X18q3ZGVpsdY9SYRjyjuY4D46gjifHWpW+85VKQYseUd5T5Jobh0sWr7OU9fSwuLTbdXFMS0VMAGRBD1bX2HzwviPIEEwKsB8hUE/TM82eZDHa0GgJYDErO4z7fJAks= X-Gm-Message-State: AOJu0Yx9Eotj5wemYitMIcHVvjpdo8veY0903bxV8Dm5TLK9aJR8B3Ff OmP46pfUU4FfzrVzesA0rLeVi/YpXeskNWZA2nZheNXN0lb4rgZiA67q0A== X-Google-Smtp-Source: AGHT+IGgvnF6BriGZyRXskbwwm477hSiQyryuqYwynoyzyRo+4cTcjt9St+9+DXj+W6ilmPPRPfQ3w== X-Received: by 2002:a05:6a00:a87:b0:6ed:4a80:133c with SMTP id b7-20020a056a000a8700b006ed4a80133cmr3144178pfl.1.1712931828510; Fri, 12 Apr 2024 07:23:48 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id n43-20020a056a000d6b00b006e5af565b1dsm2946952pfv.201.2024.04.12.07.23.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 07:23:48 -0700 (PDT) From: Anand Moon To: Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , Johan Hovold , Thinh Nguyen , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/5] usb: ehci-exynos: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Date: Fri, 12 Apr 2024 19:52:51 +0530 Message-ID: <20240412142317.5191-3-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240412142317.5191-1-linux.amoon@gmail.com> References: <20240412142317.5191-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to care about when the functions are actually used. Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM isn't enabled. Signed-off-by: Anand Moon --- v3: fix using new DEFINE_SIMPLE_DEV_PM_OPS PM macro hence change the $subject and the commit message v2: add __maybe_unused to suspend/resume functions in case CONFIG_PM is disabled. dropped RUNTIME_PM_OPS --- drivers/usb/host/ehci-exynos.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index e2303757bc0f..f40bc2a7a124 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -237,7 +237,6 @@ static void exynos_ehci_remove(struct platform_device *pdev) usb_put_hcd(hcd); } -#ifdef CONFIG_PM static int exynos_ehci_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); @@ -280,15 +279,9 @@ static int exynos_ehci_resume(struct device *dev) ehci_resume(hcd, false); return 0; } -#else -#define exynos_ehci_suspend NULL -#define exynos_ehci_resume NULL -#endif -static const struct dev_pm_ops exynos_ehci_pm_ops = { - .suspend = exynos_ehci_suspend, - .resume = exynos_ehci_resume, -}; +static DEFINE_SIMPLE_DEV_PM_OPS(exynos_ehci_pm_ops, + exynos_ehci_suspend, exynos_ehci_resume); #ifdef CONFIG_OF static const struct of_device_id exynos_ehci_match[] = { @@ -304,7 +297,7 @@ static struct platform_driver exynos_ehci_driver = { .shutdown = usb_hcd_platform_shutdown, .driver = { .name = "exynos-ehci", - .pm = &exynos_ehci_pm_ops, + .pm = pm_ptr(&exynos_ehci_pm_ops), .of_match_table = of_match_ptr(exynos_ehci_match), } }; From patchwork Fri Apr 12 14:22:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13627854 Received: from mail-oa1-f51.google.com (mail-oa1-f51.google.com [209.85.160.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E2BF127E18; Fri, 12 Apr 2024 14:23:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712931838; cv=none; b=BS4eWvREid1zIeOk349SbJm+i5FLYhrSsh8gvFn8wYmSmGN30r/xTTvVZg+aTW6iK7vH01yp+BRnXr/r3fB5+jXupjPD0S2MfRFBD6wgciZQD3DtfrdJpZ12k+kCn9yk4bJT2xoSERq7JHiEMIe/LjGLS/HcPR+9P9u2OKVx4Dw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712931838; c=relaxed/simple; bh=kpmI1kJ5CiC906Na2qpuKgKUS/Inlp19HDZ3ukQQDqk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HVPfzZFO7LdKaLGPsD1CjbFvESuPuW7wWpVjq2PDJdXsr2taF61paxY+MLVAUyNAIk5gQxsvEJiFHHiAitN2ceT2B4271MLrttFtaT8WzgI6a/565z8tl1DIkhWQR5TrfLBJmoHerIa8bNN+NvFfppMaZRkVmim3QSR9Mo5y1VQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XtdUTAvW; arc=none smtp.client-ip=209.85.160.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XtdUTAvW" Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-22edcfcd187so316641fac.2; Fri, 12 Apr 2024 07:23:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712931836; x=1713536636; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rnop7Tz3u3A6Y7l9rLZDgV358HdsfnR1FGKtIeVuKBc=; b=XtdUTAvWBSHMwTnvEh5gBc+1XQ5VjscOHCK2pTsP+RPcYWaFyKOO8XXpvbIJy2Gnif 5fT4JOavbQk7nNvAj7+L3EmjTEMI4grCClbLfdP4n6svj2MGh77jbYtmRMzyLJmbkq9e 0P6Ln4+Z0mb2ERvn9w2J/BauCKVIuRbEv1q6WBn2Uiap0t3gxFX86bFx7I4C24lnP81G Ki1zQE0r4x2O4hmT892HF7L8W3z6RIo+iR587v/9q5qN8aclJRfEWxXEguDZ5L+S+3Eo ZAfW0abjGs4EYw1fbXEaXwdu3vYfcj+PzT45uwdRyrI3chgZhr/jBtBEVejoeIJhLcp5 akaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712931836; x=1713536636; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rnop7Tz3u3A6Y7l9rLZDgV358HdsfnR1FGKtIeVuKBc=; b=JV7L/jdnh8xMI4GMwthxb2zKGlTsm67nLWJYyXCu+FhzerR/gHzFus6GjTfsplUi6R 4eevqLgwFFU+bFJPJnjV7wJqEeNedoXLa6Pa+sl7Ox8vdHoYH35K8ztTO7UgGAiOYSZR cWlv+inFXCzU1L4rF/zXCf6qlOWJvYLguSyQaBhmXzQxLWlrUzWv//Pr5Qvgo5/qOgaF CCymJULD5U0ag2d0YwOdnKxAu/FMO3q2PVwg7VFjeF2MzR7kdW7UuMME4ymONdk0+JGH 2myaVH1kuS+v2XkNsfa8aH+NmICimSaVn+9Pzv+83Zkq9QiV+Ghy8glntNdNMDbtRktk BxJw== X-Forwarded-Encrypted: i=1; AJvYcCWJWHLA5aAZmgvLUTFzNSHHdz+EGfeqqBho+6iXsbFpL02B6fOtTRfIiVZW69tAyo7aqkZ7gUqVABobHNIpQISfWJCc6sj+BYHUQlwuhkvdgqAEzwFgMXjr1N+nHY6kuC4FaFmltJx8pejJGa5jekHfJ7zjI+PULaqKQfkV/68Cny8QpvN73L+UKlY= X-Gm-Message-State: AOJu0Yw4YyeqSW7LaiJCv2pZ9pgIY56e3oRrUb7uFFhP7FKxMHZLHB/r 2zWAPs0lWas14MUV8JYgVxJA5/gouL/i7zoNMJ0CBopMQuh406b+ X-Google-Smtp-Source: AGHT+IESH4fkXQOzELFKbwow3I/3zmYaBjB31FBeox2i7Lpcl/4hma+H6YA6EljsfIfiVAabwskJIQ== X-Received: by 2002:a05:6870:4194:b0:22a:f96:28b3 with SMTP id y20-20020a056870419400b0022a0f9628b3mr3085006oac.53.1712931836388; Fri, 12 Apr 2024 07:23:56 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id n43-20020a056a000d6b00b006e5af565b1dsm2946952pfv.201.2024.04.12.07.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 07:23:56 -0700 (PDT) From: Anand Moon To: Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , Johan Hovold , Thinh Nguyen , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/5] usb: ohci-exynos: Use devm_clk_get_enabled() helpers Date: Fri, 12 Apr 2024 19:52:52 +0530 Message-ID: <20240412142317.5191-4-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240412142317.5191-1-linux.amoon@gmail.com> References: <20240412142317.5191-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The devm_clk_get_enabled() helpers: - call devm_clk_get() - call clk_prepare_enable() and register what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids the calls to clk_disable_unprepare(). Signed-off-by: Anand Moon --- v3: drop dev_err_probe to simplify the error handle. v2: new patch in this series --- drivers/usb/host/ohci-exynos.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 20e26a474591..89e6587c089b 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -135,20 +135,16 @@ static int exynos_ohci_probe(struct platform_device *pdev) err = exynos_ohci_get_phy(&pdev->dev, exynos_ohci); if (err) - goto fail_clk; + goto fail_io; - exynos_ohci->clk = devm_clk_get(&pdev->dev, "usbhost"); + exynos_ohci->clk = devm_clk_get_enabled(&pdev->dev, "usbhost"); if (IS_ERR(exynos_ohci->clk)) { dev_err(&pdev->dev, "Failed to get usbhost clock\n"); err = PTR_ERR(exynos_ohci->clk); - goto fail_clk; + goto fail_io; } - err = clk_prepare_enable(exynos_ohci->clk); - if (err) - goto fail_clk; - hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(hcd->regs)) { err = PTR_ERR(hcd->regs); @@ -191,8 +187,6 @@ static int exynos_ohci_probe(struct platform_device *pdev) exynos_ohci_phy_disable(&pdev->dev); pdev->dev.of_node = exynos_ohci->of_node; fail_io: - clk_disable_unprepare(exynos_ohci->clk); -fail_clk: usb_put_hcd(hcd); return err; } @@ -208,8 +202,6 @@ static void exynos_ohci_remove(struct platform_device *pdev) exynos_ohci_phy_disable(&pdev->dev); - clk_disable_unprepare(exynos_ohci->clk); - usb_put_hcd(hcd); } From patchwork Fri Apr 12 14:22:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13627855 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABBC61327E8; Fri, 12 Apr 2024 14:24:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712931846; cv=none; b=ZxQM0fe7sL/mN07AvEKdQ081GPS10QLR4QQF+jC1ok+Kg0I0eyTYVfdOKlqS2vq+1b/TU7x5RSmH2GNf5EErffb8luqcELTcWd8p9Rf/hj+ZdkjSHFRp9QBDRgZj2c/4SYoe+TvEDxxzZiNh8EfFkqVS5JQ8XYxnZI29CuuWl4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712931846; c=relaxed/simple; bh=pvXRn+SGEozybqS3lhGoTzYl9NGJHGRBmtZjeThvLDU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g6zn6mcwsBOqeLDbDZL7R+fh6zaPAWuUafZ51jsXYeLZGCHU+RKlZ/PrV6ghuJyij+161/iVQgOjGC+4vfcRM/+VP+T/mCQN4DXierj7BM77soQJaKyhC0C/O2NZyPObOBDncKqXM1NLRV7VbCCv2dOhvajFve2Vo0ffFy4ZviQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=G7MJAlsu; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="G7MJAlsu" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6ecf3943040so856158b3a.0; Fri, 12 Apr 2024 07:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712931844; x=1713536644; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DAWpmgXV6PrUtIYpHal4V+0TG6cIPqQRmUscp00ed0M=; b=G7MJAlsuVLIRuhGaGesqPK5VxkY1R7sL2AXNUzLDY2ejAIITu0WAmVQrJEsM1uj4xa IAEcIpXJGkSOR/MNMB0F/elWR6YBS6yhz+uUBoC/OuFs6G3ETxTrDtIquCF57JYp1cGp rUrpl0SJnECb95p82ALPIATSyD34Jw1yE0CHp+bRdHFaDio1Ue1GHEUGIm9sWk1pwdFE rWdHVPx9YGg26/QMAKPIWqj21mkO/60uVrdVkAWq9T6mel7LU8SaOFYilj13ozn4LRv0 nKBzBSjrlASvKVjMHNPUQ/Ozm2fsUdCaBYG8nxaKSbqAfcap+zxLN2eL2fwOEZfYTKQj BHeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712931844; x=1713536644; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DAWpmgXV6PrUtIYpHal4V+0TG6cIPqQRmUscp00ed0M=; b=YgV3C96Ed2DdEfyrLjPUmw5RYOyjVYiehCEPVKgFHHXPdX5czvdQgTcmsNNC1iK64M cLk3gdIn6fpD4ZP8GKVO9Z/TPpoXQiPFwQkDEckakTEq+r7LrLlahV0x92sGhwGQFli5 bPQcFNAxui/tnQ2+CJaVKjMMN2GkUab06b+BISTOw0uXhKTLvqd9Qkj7DM+6JId8cXH/ +Thivjax/WzjhiMdFwBfua6Z2Jiy/QYgi7NlROxGXTP68oLgnM6pYyMmDz01jtVOb6y9 G7v/QTZfYtfZc7vV34PlbRCi10pEKCbT3Ol1MVdddwHguMVbSjJCnrcm0cUP5pFtXywJ Digw== X-Forwarded-Encrypted: i=1; AJvYcCU8DguMeetFdNIGudSAH7WfX1AY3P8dHaCHSRWCjHw7oWcMttGLrwJvBM95LBcmBNcryPVzL0ZASUujMebvw7TiypOCFWIVikWpZihej5yxU9PEqeDiC3cq05kXuMYLGoWyytnvna/EcnXGBWzzNjkvzAYeXbyXlfvSnS//sKrB3iLufQHfp/it6CQ= X-Gm-Message-State: AOJu0YzDtEfK6nfwUj3puSCd+mpC0hHCLZ2cuU8I3JhlPDRIdd7askcA 8Odj6zg6/nUCAPJZDFdUUSWpiP2PDYMkFy8bIZEacOX5dAxPXpJq X-Google-Smtp-Source: AGHT+IEpGPBZdmTxxL9lDAtC+tf3WS6lK3QOjNLU9P/kh8HtQfqldD/Ks3PSn5Y+HC7kfzAkGlppsQ== X-Received: by 2002:a05:6a20:5659:b0:1a7:34c5:d141 with SMTP id is25-20020a056a20565900b001a734c5d141mr2909862pzc.24.1712931843931; Fri, 12 Apr 2024 07:24:03 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id n43-20020a056a000d6b00b006e5af565b1dsm2946952pfv.201.2024.04.12.07.24.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 07:24:03 -0700 (PDT) From: Anand Moon To: Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , Johan Hovold , Thinh Nguyen , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/5] usb: ohci-exynos: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Date: Fri, 12 Apr 2024 19:52:53 +0530 Message-ID: <20240412142317.5191-5-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240412142317.5191-1-linux.amoon@gmail.com> References: <20240412142317.5191-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to care about when the functions are actually used. Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM isn't enabled. Signed-off-by: Anand Moon --- v3: fix using new DEFINE_SIMPLE_DEV_PM_OPS PM macro hence change the $subject and the commit message v2: new file --- drivers/usb/host/ohci-exynos.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 89e6587c089b..3c4d68fd5c33 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -213,7 +213,6 @@ static void exynos_ohci_shutdown(struct platform_device *pdev) hcd->driver->shutdown(hcd); } -#ifdef CONFIG_PM static int exynos_ohci_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); @@ -250,19 +249,13 @@ static int exynos_ohci_resume(struct device *dev) return 0; } -#else -#define exynos_ohci_suspend NULL -#define exynos_ohci_resume NULL -#endif static const struct ohci_driver_overrides exynos_overrides __initconst = { .extra_priv_size = sizeof(struct exynos_ohci_hcd), }; -static const struct dev_pm_ops exynos_ohci_pm_ops = { - .suspend = exynos_ohci_suspend, - .resume = exynos_ohci_resume, -}; +static DEFINE_SIMPLE_DEV_PM_OPS(exynos_ohci_pm_ops, + exynos_ohci_suspend, exynos_ohci_resume); #ifdef CONFIG_OF static const struct of_device_id exynos_ohci_match[] = { @@ -278,7 +271,7 @@ static struct platform_driver exynos_ohci_driver = { .shutdown = exynos_ohci_shutdown, .driver = { .name = "exynos-ohci", - .pm = &exynos_ohci_pm_ops, + .pm = pm_ptr(&exynos_ohci_pm_ops), .of_match_table = of_match_ptr(exynos_ohci_match), } }; From patchwork Fri Apr 12 14:22:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13627856 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BB8813329F; Fri, 12 Apr 2024 14:24:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712931854; cv=none; b=CdcTOWTqwgmKjuRHoODzYVK8bKP8hWyn1ge7PvKimUcrANONEmSuYOjlPA8oNJxGBJrX6mtNEIqnHNFtKpmGviIt/isELl8jxMotJ8P3SOBZrZG4A4SmBMiLD1t9MBaRX/GgiyUJIVdsq/yt0/0/ZR7rz68sQxO+FqGJGrh4bXo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712931854; c=relaxed/simple; bh=nQsr4zJZqo6g2ONPE9BPL84r5IX3WtjDVrxRxwxOwDI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qkC9XMB8E/qG6ElH2XoxkQGXkVdOZgNimpWPGelYhaGTuMqQjowko8xSDX6m78vcrcPXBQKDcSlH/z9neCzQ2ZdCTBuDJyFiY2QfMWAGopkIVrTGUvpGAa44juCVDbmll8ztrFpohnB+74kOfid766fvl//Xtqj+y574AJa5jZU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mQkhiatD; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mQkhiatD" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6ed20fb620fso779325b3a.2; Fri, 12 Apr 2024 07:24:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712931852; x=1713536652; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8ycTUqQHx5D5MreNoECYZAdXjkRI9aE0qu1OLjEN7fk=; b=mQkhiatDI8+/MZxF39XJhGVw5Rr/7KXW3ENYJKhqGDRzGIZ7t2g8oiusGwsW6oXtXD JVwXNcIODk4IXR1C8c6X9eeqFSyThBmmF0nlajyUNAYoRUuOkB2wWBtV4ebNL6Oheiby 0tnduggMED3JciR1VvpXoOxMI25FXXnc8w+zNehyZ3V864EM4uSFJ3zX2OO0O/QOPv85 oGOAB5b3r1vDMsdNm00SHQosQr5XayBm4KH1QpeTMkOiHWWlwwNK9OYQR+QJBMViX3Lo CsqQokfMLP+vKBF6ZKsJBHJru07k9juXwXORhC8bhW8w2mfkXKHo9i0Z59OSARWpL506 FKdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712931852; x=1713536652; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8ycTUqQHx5D5MreNoECYZAdXjkRI9aE0qu1OLjEN7fk=; b=k08K0VP5728GOjlKIh2/LApMDSIxA+Dti5tK5aHWguF0xJEHyGsvoNZEbbUKP+xn2D 4thrvj8m+1QOPFecvDa/eybiAfJqECA+WXVIIUcp5PkytU0zY7ScR9PX3CU2387KrQb7 3G2UyjYbp/NfA7FS/uzubAtFKAo8BZeYTTop2PpYuuba7UFEEd5oj7S+hEqaw06p4yTZ zRe6WCQmjUgNTzcBbpWJsecJI1gjy1PGMwK+fx7QP/Kt5HDJm/3t3EPi1ySDivjtVc5c 81h3A0d51+HdVADBUDJ3kce0ahibqkfBaDGTAATeGtPE2isXAqVIM8VWZ3Q1jSqC7+8Z rcEg== X-Forwarded-Encrypted: i=1; AJvYcCXtLnKHgKv+mR8eMmzbwpyDNT49FZxQp9dOG06W+gkLV6jjwP/X73m8HxyqpWzDneoV6DdEAESDMG4xZZupP/jbn56mal4gfC+j8AfmFlPjZBT4myoSW+8m9vSxMIgOI29aH0oIP9QPuUfeWrgiVB2geX1ker9CyTYX2L3WVgnr845H/djrUZf+DJ8= X-Gm-Message-State: AOJu0YykvthCsvGJsHN5md7jgxXzrU+LBIpDpbO9u8H7VTVDoVazn/+U YF5pzuHYhreaDyeqikDMondQvAqjRGPOpIlW1hI/Xi18Y/agW/5f X-Google-Smtp-Source: AGHT+IEVIzMZY6CCMhIHZf+aL4aqZNSAeFET5jkH5mSvmrZ4I4gbLuytamFXU/gqKehAc/d6O6nkoA== X-Received: by 2002:a05:6a00:acf:b0:6ea:ad01:358e with SMTP id c15-20020a056a000acf00b006eaad01358emr3589380pfl.0.1712931852323; Fri, 12 Apr 2024 07:24:12 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id n43-20020a056a000d6b00b006e5af565b1dsm2946952pfv.201.2024.04.12.07.24.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 07:24:11 -0700 (PDT) From: Anand Moon To: Thinh Nguyen , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , Johan Hovold , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/5] usb: dwc3: exynos: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Date: Fri, 12 Apr 2024 19:52:54 +0530 Message-ID: <20240412142317.5191-6-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240412142317.5191-1-linux.amoon@gmail.com> References: <20240412142317.5191-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to care about when the functions are actually used. Also make use of pm_sleep_ptr() to discard all PM_SLEEP related stuff if CONFIG_PM_SLEEP isn't enabled. Signed-off-by: Anand Moon Acked-by: Thinh Nguyen --- v3: fix using new DEFINE_SIMPLE_DEV_PM_OPS PM macro hence change the $subject and the commit message v2: add __maybe_unused to suspend/resume functions in case CONFIG_PM is disabled. --- drivers/usb/dwc3/dwc3-exynos.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 5d365ca51771..3427522a7c6a 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -187,7 +187,6 @@ static const struct of_device_id exynos_dwc3_match[] = { }; MODULE_DEVICE_TABLE(of, exynos_dwc3_match); -#ifdef CONFIG_PM_SLEEP static int dwc3_exynos_suspend(struct device *dev) { struct dwc3_exynos *exynos = dev_get_drvdata(dev); @@ -230,14 +229,8 @@ static int dwc3_exynos_resume(struct device *dev) return 0; } -static const struct dev_pm_ops dwc3_exynos_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(dwc3_exynos_suspend, dwc3_exynos_resume) -}; - -#define DEV_PM_OPS (&dwc3_exynos_dev_pm_ops) -#else -#define DEV_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +static DEFINE_SIMPLE_DEV_PM_OPS(dwc3_exynos_dev_pm_ops, + dwc3_exynos_suspend, dwc3_exynos_resume); static struct platform_driver dwc3_exynos_driver = { .probe = dwc3_exynos_probe, @@ -245,7 +238,7 @@ static struct platform_driver dwc3_exynos_driver = { .driver = { .name = "exynos-dwc3", .of_match_table = exynos_dwc3_match, - .pm = DEV_PM_OPS, + .pm = pm_sleep_ptr(&dwc3_exynos_dev_pm_ops), }, };