From patchwork Thu Apr 4 07:13:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 786062 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 5C09E548F1; Thu, 4 Apr 2024 07:14:52 +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=1712214893; cv=none; b=HUrYkLZjWcW9IlXHHYcZBbjIrj6Z/YoFONRBANl/dtZS9ojfkXWWk1atSB6Ru+3NxHEqWp3Vz2I6jOFKmqVFvMGsvhEELrsWgt1VMmaEmePdWqqt42z7HXUk83CpEe4BdUDZQKvOG0e19zHiesSWEOZfLaw82C2RuJTAqKws0Ms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712214893; c=relaxed/simple; bh=0bCffHZydn92x8yoNUXuHk+MA8fJZmpo7AjWbrkLjnw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h8gv5RKoPyIaN1Srp4sdOUNWD+34Y+d5YVhtd1n4n3g2b5CKijwifSfgNSL2y278CGWtH0jFb5dmkrwbADlhTo9frhEZPdLKac15Ez/xccxq5q+y5/umaA+YMhG1ZyOH88MWPJp/Gl+P97xgKbG/ZPCIWFIhTAiIxBuPxcVuhwo= 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=EhZo5lNE; 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="EhZo5lNE" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6e709e0c123so563174b3a.1; Thu, 04 Apr 2024 00:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712214891; x=1712819691; 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=gPsiPELCBmPe+inzzwVVOC2M0IyyDSE04BMeZYanz5U=; b=EhZo5lNEZTKmNt2pPaqRzICEP3DiaZ9rJk5WLcu7RRi44ltMTerLOmZf2LmeBZMzQH lItpmypOvpU5k2dknF7XjHMePoxUMsdYLCKe3rJsjFtlAkgR5vDdHc1AlXVHFXMu96op vplcX0FQIdRSroWBrUvwkCw7td2uV1rXPBvdR6rUinTsJwSH37sJSsOOBg++KPReZNW7 z3Qi2HvshGaYPtPgeVTXELyCk0xxQBAUN8ZMhupCBV3PZy+ZjVQxwyKui+IjWijTSABH ariSbNhJpglRftsQOw/L5KMd9f3O0A9yOksarUajVVGmofYpTRGYjrI20skRCWM+acfa f+BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712214891; x=1712819691; 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=gPsiPELCBmPe+inzzwVVOC2M0IyyDSE04BMeZYanz5U=; b=Jonw7l+KhaOUTzTC9jsYXXdDBN0rMCtVTxk3F+1Dk+OwVoeh2YYqeObi5sWhmaZpia qZKA9U2BDXXDY6hhQrd9+zqYSLsc2C4EE8gGBMEKX45DvaUOwS7UGfwfedRf1n4XhetV xSFhIFiBK5KWnFPMD+X6yPGgFpY4nNPXj2HgNZ9+FpM7/S0+mafkXesHGRcoN+QZAdi1 jNdxbEg5a24fnBRMscb8UjBNxO95v9U3uyVP39EgGcabpOJ75uZOrLBhn9JerrIO0rHP sq/D6WhwpGpyDE9EroaFDh8SN/VpUu2HSAFTntdOrPkUwmlqDNUfWuh2JHY/deSAGDuu +AHw== X-Forwarded-Encrypted: i=1; AJvYcCW5LOmQDOjo+Yn8qavgpywm6f116taAI7cqThSUVFP12JK5ZuxxAJX80qL7laS1rGZdgsrN5qhR6pJGvT+BufoPQhRwYBejpLAqGVIRZtSk14XlNiqpvVr9k4+IQxwzLSINDD3FKxqwN5aAFy3znQEEve8dLkYayFG9AeQr7J2VrgMqcRNiMx9zByE= X-Gm-Message-State: AOJu0Yy0gRS5Nd+N24tX+xq8qf5OE5SA2OauxQzLlcLL32U7NNJWkeZu ikeEjc0GzKnr3VysaDAlSTON2EAI5AvFx2cdQ9/iLUDZtbCIx/te X-Google-Smtp-Source: AGHT+IEOUU0nmmBZv0QGpPzeOsGA0kvWFTC8435Koof082b4jzgNWQOx1hwsm6KroWSjntyQkUqNXg== X-Received: by 2002:a05:6a20:8407:b0:1a3:4863:f70e with SMTP id c7-20020a056a20840700b001a34863f70emr1909375pzd.46.1712214891652; Thu, 04 Apr 2024 00:14:51 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id h20-20020a170902f2d400b001e26c4823d0sm5220873plc.52.2024.04.04.00.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:14:51 -0700 (PDT) From: Anand Moon To: Alan Stern , 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 v2 1/6] usb: ehci-exynos: Use devm_clk_get_enabled() helpers Date: Thu, 4 Apr 2024 12:43:17 +0530 Message-ID: <20240404071350.4242-2-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240404071350.4242-1-linux.amoon@gmail.com> References: <20240404071350.4242-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(). While at it, use dev_err_probe consistently, and use its return value to return the error code. Signed-off-by: Anand Moon --- 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 | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index f644b131cc0b..f00bfd0b13dc 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -159,20 +159,15 @@ static int exynos_ehci_probe(struct platform_device *pdev) err = exynos_ehci_get_phy(&pdev->dev, exynos_ehci); if (err) - goto fail_clk; - - exynos_ehci->clk = devm_clk_get(&pdev->dev, "usbhost"); + goto fail_io; + 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; + usb_put_hcd(hcd); + return dev_err_probe(&pdev->dev, PTR_ERR(exynos_ehci->clk), + "Failed to get usbhost clock\n"); } - 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 +218,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 +233,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 Thu Apr 4 07:13:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 786669 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 C360856B86; Thu, 4 Apr 2024 07:14:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712214901; cv=none; b=AA2uUWfwCWqgPTmYup5wd0DpFp4wbws6sZexLjjZLzJcNvwKJ2CcQK5a0cm1zeGU1HNQGpDBH1EDhwko/bneTX6eg89oVhUE3DQE6IUSpojlmqwkYt2qYzgJe7YpWbnIA/XY+SAP73G5TeGVlxxjr7SrgCY4HtUhbKntDfqBKwY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712214901; c=relaxed/simple; bh=7VfsWiQ1l31jCN/4UAoYZTHSVvv7BRUDCNtRMnpIbUI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ApfTYLQEbO85cagV/uJqLXCVi+RBD+6muhsNdirGUttvcGuibZujo8l0EKZ/PDcZO4FSrXqfINgz2Cqj/rrsLKaRFBrdbcpIsGcXbIc8cSgpAvnMifqO7oWUXTejxY8cXZb6qlfvFuBETqYIFelKVvENr6ggyyksuZBBEBVd+Oc= 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=Un1wmfk/; arc=none smtp.client-ip=209.85.214.176 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="Un1wmfk/" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1e27f800ad0so4481015ad.1; Thu, 04 Apr 2024 00:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712214899; x=1712819699; 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=vZ4F7NXXW550+bos8lcUggXlnE8ksWoIQYNv7Dbni9Q=; b=Un1wmfk/gc+C1iqFO5hUVVQXP1QrBN10SckrgexDxWX35aluTfn0KMRzroGBVGGlWC qtEtwxgv4ebL+YsO1G6/wXNHDgbVIC6ocjYhEHEXxSpB3upa1g5ks0rys2XE3cy6IbQr c2ED+ApIDiwR233MVLsR+9m0GpKdv9gwacmCQZhOWpdBjs88rYkPulqN8yiElDxrv+b5 qVZscDAT8TWzZ/BfUK27a1Ood7TqosbsZ7mcn88TFYdXnZKcqCVXjbcItQT1IXiObTjY Q5qKG0HxfdvawJvJZAC1lm0+fk/qhs2AOxQ3Jb6OJ6NjXWBfXZUYorOX7sCVe7I4mXS4 vSpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712214899; x=1712819699; 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=vZ4F7NXXW550+bos8lcUggXlnE8ksWoIQYNv7Dbni9Q=; b=fUIFATd0RtTyyrrqWYuObiuousmXkB3unGMphdR2S4akzCH4+FieHg3m4MH3MSZzxg pz0ekeSwpuGuKD6daa8R30h33M6fLxL+YFE6q2qrEwmp5IgnIQPwjsQwWWqFxuu21wWd 0+qkIE2rDAP3l/uqQoQYuTiKXt4eWDW+Bln2SeSwrf58K2m2ya3+c9dTGMmVvHSknAsT 5IiC/N8KBTGyCvao+DoHOoaRYt25SAbmmb5cdQIpmTchxrtHO567aKJzHMkrZSXx8o+e OXC/gEYEsrb1e7RNhIPph7Ce1645gZ1nQMtbOn8GQDIvhKMQ/SVnzfALfFn0+T3SS/bK Az6Q== X-Forwarded-Encrypted: i=1; AJvYcCU+lVzCuPKkOEqb+l7ulDgmNjoAc4h6joqeUs9ovFxanKmMlx9xyFQPbtO1yiy1PZTC3l0oEuD9KcEAREF6TfYbNoZCixE0UYcJqeQYO5ncqGzMAfTlYwNcmRR3M9Iy7ujo0a7pzSZjp/gcajO5PZh2DHrO7uRPiqY7cEZol9Izl+I9LCJ9ktq2HKo= X-Gm-Message-State: AOJu0YyrYF92FZnQCFX1yxoI+QU0x5CEnIfiiR1Plehd1vT8YS3mtAf+ l9SgyfYL5LPPiX8AhLXePYV5SsrpQnXpB1/1UOFMT0CrAKCknkFo X-Google-Smtp-Source: AGHT+IF4BglLZMXCnf9J9jEVYynLdLpCHS08eS/S41aNbkggt6yBZJUUl2YbEY/gGHbUJI38+3Orow== X-Received: by 2002:a17:902:ec83:b0:1e2:6240:fe46 with SMTP id x3-20020a170902ec8300b001e26240fe46mr1426005plg.56.1712214899018; Thu, 04 Apr 2024 00:14:59 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id h20-20020a170902f2d400b001e26c4823d0sm5220873plc.52.2024.04.04.00.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:14:58 -0700 (PDT) From: Anand Moon To: Alan Stern , 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 v2 2/6] usb: ehci-exynos: Switch from CONFIG_PM guards to pm_ptr() Date: Thu, 4 Apr 2024 12:43:18 +0530 Message-ID: <20240404071350.4242-3-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240404071350.4242-1-linux.amoon@gmail.com> References: <20240404071350.4242-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 Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM are disabled, without having to use #ifdef guards. If CONFIG_PM unused, they will simply be discarded by the compiler. Signed-off-by: Anand Moon --- v2: add __maybe_unused to suspend/resume functions in case CONFIG_PM is disabled. dropped RUNTIME_PM_OPS --- drivers/usb/host/ehci-exynos.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index f00bfd0b13dc..4cfde1af32be 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -236,8 +236,7 @@ static void exynos_ehci_remove(struct platform_device *pdev) usb_put_hcd(hcd); } -#ifdef CONFIG_PM -static int exynos_ehci_suspend(struct device *dev) +static int __maybe_unused exynos_ehci_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct exynos_ehci_hcd *exynos_ehci = to_exynos_ehci(hcd); @@ -256,7 +255,7 @@ static int exynos_ehci_suspend(struct device *dev) return rc; } -static int exynos_ehci_resume(struct device *dev) +static int __maybe_unused exynos_ehci_resume(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct exynos_ehci_hcd *exynos_ehci = to_exynos_ehci(hcd); @@ -279,10 +278,6 @@ 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, @@ -303,7 +298,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 Thu Apr 4 07:13:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 786061 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 3D8535B1EB; Thu, 4 Apr 2024 07:15:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712214908; cv=none; b=ovNZf7jf8jicgBzM7Fvm4pQR3oPTqDxOQar9wBh/ixHxJVtytMuSMiWHkk5S8oj2jt7x7WAQ67PpTihYMN1bBvepOoRohdxXb6jWNb2+QWMQa+nzjKp0Ja+rnniP5YwaungfeK7UgegYBZaiIS6NZVcUhf7zeN4+OAqSP/iIziI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712214908; c=relaxed/simple; bh=l2jjsxz/9h2qnDtVCAtjskSge0cYGkUEZQyYbiVVEGw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JZOd+KAaRuC1xOKLOLO4VvwbkIk1E5VZsjcb4NQlY1UV+OyP9xm0J9LbVVFV81TKkzOn0405jtZrhJqKwdyQAyp43oxj9pqz6PJfKa6RLvTbVyk9aFo4NOwn0V9LSJEXwvOOlT85oQoMqa74S+GA8SUyaqmdYAE0zFsG6Fn6EjY= 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=VjYeF7qO; arc=none smtp.client-ip=209.85.214.174 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="VjYeF7qO" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1e220e40998so4674415ad.1; Thu, 04 Apr 2024 00:15:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712214906; x=1712819706; 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=rinkV9M1GdwvRaIXYpdNquzoQdVjkSfszcTQAo+0cCg=; b=VjYeF7qOTbMtgUKZBrptmHYLaTvJlK1DEJVgWVEZlIfylGOdJpqdZV2wyqtUbDGe1I uwmFNVGUVqCR6jiYJMetThjGoMPDtN0M92o+FVr1ACryNf6DOaos2D5ro+PXOzGSpHkZ FZk0ItX5RiFJtTL5wb1QUImddrDZEju4XRy0ytBXVtagIcNj7sqSGzwCoU7w9cj+WlMT DB8VmueI7eu4sBRwp+tlhX+zNCwtk2qpbNapjs4f8cHoxZ+DazJxrdIxI91M0aGafWC5 ClZVGgqkpM4GXEmmvaGoJG+yTD6yY1hOlrc/tfvARrcYlTYsHXGmhu+F10NzTe5WxHZh Kb5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712214906; x=1712819706; 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=rinkV9M1GdwvRaIXYpdNquzoQdVjkSfszcTQAo+0cCg=; b=MwTiyNgDAX45L7Pgw5F8EfSO5QyoO8tzU2+3BNec0gPbUJgXfnz6TVAlD3kkNLP3vT +Ha33m9wn9YRD4zDqks63eSlCkWXh//rBNsFEL2Bcy+cLsraso8qjD39LCSH/3u8iaqO Ysfo7//exRI1gumxpKZM7PbURhQHbOxzhVPqiH6Syw120lmxHqGbvXzxXR45a+jtx1Lo 4Ju9yxCivuv2T1QfEHKb63SPkr+R3xh6F+RGjoVEuT8HOa9q1Cl9+FErwhPOseF4yVRH O0M541GO1FRTyTTf8gxgM5nMwU19dDt7GT4vI4HdAwsvEvU+OmIQco7zNvHVoaoBcwIe kw1w== X-Forwarded-Encrypted: i=1; AJvYcCVC2W9mfMUojxD58AHWm8Co/kqns1iVGNAHOg6b9YRG5xWDBFKVdcq/GikrKKEAWuz03l3q4spYwVn9EvJQ6CFAKPM/w9aDyscPxAas0wY0dEpALdIQNB0/HkTYF4hYFpXGeGPKTKaUStB8du/l8azw1v2xheYZ10Km7M+JUvqz3VIT8QPmXUQbfZY= X-Gm-Message-State: AOJu0Yyy6z4C1hSsbBZ5vHBff4Zw5xUjobO98r2KKbnNrUhRQI64A6c/ eLrKF8emaB9h7Uza8mfqpBNQl96KL1Go6q9xr44GhGKNtA30ZwD9 X-Google-Smtp-Source: AGHT+IE538Vd8oFoNsf4W8iPSGIGPmsJQtB4mfqWsgTvwN90yY9UPLOYOos5v0PPJN/c45lpauVNXw== X-Received: by 2002:a17:902:ca8d:b0:1e2:9d65:253f with SMTP id v13-20020a170902ca8d00b001e29d65253fmr1362119pld.29.1712214906423; Thu, 04 Apr 2024 00:15:06 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id h20-20020a170902f2d400b001e26c4823d0sm5220873plc.52.2024.04.04.00.15.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:15:06 -0700 (PDT) From: Anand Moon To: Alan Stern , 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 v2 3/6] usb: ohci-exynos: Use devm_clk_get_enabled() helpers Date: Thu, 4 Apr 2024 12:43:19 +0530 Message-ID: <20240404071350.4242-4-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240404071350.4242-1-linux.amoon@gmail.com> References: <20240404071350.4242-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(). While at it, use dev_err_probe consistently, and use its return value to return the error code. Signed-off-by: Anand Moon --- v2: new changes in this series. --- drivers/usb/host/ohci-exynos.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 20e26a474591..85d04ae0ae40 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -135,20 +135,15 @@ static int exynos_ohci_probe(struct platform_device *pdev) err = exynos_ohci_get_phy(&pdev->dev, exynos_ohci); if (err) - goto fail_clk; - - exynos_ohci->clk = devm_clk_get(&pdev->dev, "usbhost"); + goto fail_io; + 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; + usb_put_hcd(hcd); + return dev_err_probe(&pdev->dev, PTR_ERR(exynos_ohci->clk), + "Failed to get usbhost clock\n"); } - 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 +186,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 +201,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 Thu Apr 4 07:13:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 786668 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 6CEDC5CDC0; Thu, 4 Apr 2024 07:15:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712214915; cv=none; b=KT2zFCwX+AB1PDh8KLnh44HGgmR9vyRIkPTFu5paKDfDCg/nadIFzECCFuPWMoP+a9ZyNk7Rq5sZywc8NRIxr0GlSDl3yZ3+DIBeYg5j88pSpWq6nmXQmc/rtGkBsPe5HtXeCQPoCe7ZvrhZhJvp82ehiSE/OVpc0/Ui2Y+2xP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712214915; c=relaxed/simple; bh=XQ53YgJ+KiTfINBFq/O6Z48P14zbeZM01KRRTndoD/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sXljbkhr5cO77igl1wcVh/Mht8uS++eZF3BixBrQ8bhUSdIkuft+5Bo8or5fXLDUbastnab5NEjdNbX2z7ka67jcpPsSUAeBy9Y4+CrBH+GXGlXi6i1XC+9qiN2PuJxNqCm31yV5GN4gJghkTWni5KhyB/bdcwRfp6MKhavqpSY= 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=CEtu3kxa; arc=none smtp.client-ip=209.85.214.182 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="CEtu3kxa" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1def89f0cfdso13774335ad.0; Thu, 04 Apr 2024 00:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712214914; x=1712819714; 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=qXppvwNAhzN97k5Naw+YEyw1OS4lAQ4l14Ygn5h0IzM=; b=CEtu3kxaeUGSbXfcb+b/Z0z8AEGg2nbyhEZAv/s+Y0hEIhmAVJosmNFX0CHtVldU4J +8UBbQBAjP+zxIz5DE9OlUMk+JwtiEIOSFDTiatUBF1MjtgoB9hHpBB0qot97YMl2OrZ nMqCr/IwT6CoGnbLyJfMXpRhQodRH+ZRmL/h2m33MXH5BkJZ779fiEukUDUw6Wi8ikPs 8uSbrW5ouSh0aN8hRtqoxTeNED9U8dPBRZLGZYFIBdKM1WJnI5g9wKw6L67/3xzR8/Hv as+PTNFPP2c4fe1qHNmhJ19onGG6hV457QpY1NvYtLYmkyUqQv1Vk+JqMdTU25mf+P1E K7xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712214914; x=1712819714; 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=qXppvwNAhzN97k5Naw+YEyw1OS4lAQ4l14Ygn5h0IzM=; b=E/mBYLFvDOEcKihi2BSJsVFDBi1vRJVdDYBdzDfPrh8qBD111rDqZrO9TU+DdRIof6 QkMu9vR6txPbSPHAKvbAcvxRqctv0MCFzQS3WP83HedX5BWF/9C2fDJO4RVPNkegrv6g O3rlQ4NE2wJ35t7Doyt5BrjL6/ZC5ZmaXfYr/cVJj0U0VeOMAPMBHNonuTRpmMO7W4Lm b1fbVVKL3DVX3FRL5BclsjCJ7/dsRjwWbnaw2FoR2jO8AUel5SPifyDqZZlewMUJLOFT eokM5ZmZngDFV0dnq8BmT4g1NZRYZnsgkJLOQUEvYTXLhWTqF+2r+58Sq4Iy6s5vlmha LDOQ== X-Forwarded-Encrypted: i=1; AJvYcCW1h/NVeG+5n8XqEij4/6MPw5+4pZx3VL8IwALrx+Qjq9nSwQbMLLXySLjlF4eShqMJ8MYZTno/FBP5WBsK1zrG9KahrO18fblEnp9lzgGOXv6kNHeyWT0D7MAOOYrtGcaJyL9WyNTufAWriXw1v861UiZFdvKGwSMQRdhdVB7ApQlGDujcL2sGgXA= X-Gm-Message-State: AOJu0YzN5qFTE3PIfEkxTx0sfIVyYhxdaGoEUWrTwAaWEs6RSxrtWnSH 6W7RDqUMFCWwqy0bb0ruSQsDcYOqswg9SCC1YAgGe1+LRF/dMJIs X-Google-Smtp-Source: AGHT+IG026jtHHMrN+DwLrmD2VL2UxEvIawtAyzH9cBcIzRtMNoZHVr0l8h2fdo3y1I/kj5sABCjBA== X-Received: by 2002:a17:903:2350:b0:1e2:908f:5d6c with SMTP id c16-20020a170903235000b001e2908f5d6cmr2692549plh.10.1712214913748; Thu, 04 Apr 2024 00:15:13 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id h20-20020a170902f2d400b001e26c4823d0sm5220873plc.52.2024.04.04.00.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:15:13 -0700 (PDT) From: Anand Moon To: Alan Stern , 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 v2 4/6] usb: ohci-exynos: Switch from CONFIG_PM guards to pm_ptr() Date: Thu, 4 Apr 2024 12:43:20 +0530 Message-ID: <20240404071350.4242-5-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240404071350.4242-1-linux.amoon@gmail.com> References: <20240404071350.4242-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 Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM are disabled, without having to use #ifdef guards. If CONFIG_PM unused, they will simply be discarded by the compiler. Signed-off-by: Anand Moon --- v2: new changes in this series. --- drivers/usb/host/ohci-exynos.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 85d04ae0ae40..3e647e0b341d 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -212,8 +212,7 @@ static void exynos_ohci_shutdown(struct platform_device *pdev) hcd->driver->shutdown(hcd); } -#ifdef CONFIG_PM -static int exynos_ohci_suspend(struct device *dev) +static int __maybe_unused exynos_ohci_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); @@ -230,7 +229,7 @@ static int exynos_ohci_suspend(struct device *dev) return 0; } -static int exynos_ohci_resume(struct device *dev) +static int __maybe_unused exynos_ohci_resume(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); @@ -249,10 +248,6 @@ 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), @@ -277,7 +272,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 Thu Apr 4 07:13:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 786667 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 53BA667752; Thu, 4 Apr 2024 07:15:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712214925; cv=none; b=rJbOJUlW52kWwX2TNUCknmTqh1nph+KDz/KCqaTcILMfzBSRHxk7fS4FlfcvYLRyYmjGKwroEvhVx0+4nx/Ip/y35s0w1SeXyviXe7RGd46/2hdR7jJeMTSw63c8hoBLojMGCEVhbNHYI6dXNbTl7qW0UaxjIUO5mBiawzMmtfE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712214925; c=relaxed/simple; bh=wgjQ6hs1WdKrUgn+0rZQ1XCl2d718PGJFkE2UIE/wio=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dAnqZZYaamJXgf+SsJxTy15QPhAWlhehvP6ad6CBLDYEA/WUEpVGu/3reFxUw1heoWaNU3B/Wv2WN+PEJenvPkoeya13CGyplwCaijrZvQN6+qZyv//Ki5Ci+UfonmVhTzB2TiUdcsqOxs7nq0oOnrwJhbacOgbrf8TjCf1nb5I= 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=GlmjUwl6; arc=none smtp.client-ip=209.85.214.177 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="GlmjUwl6" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1e29328289eso5115485ad.0; Thu, 04 Apr 2024 00:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712214921; x=1712819721; 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=J5f9n7odinT4RWqYkmTS+WDxKhbPNOevirl7nLpKZ3Q=; b=GlmjUwl65RNBWtIeG9gZEqwtz39P4It2w9t38u5HiyCnBwP+9pCwpQEjy4wDI8vQ9q 8I6DSQFZ8LKisTvMUY2tXbaS3c8pOWSCkCOSazFEiObHSNq/KHgNEBzIQ5dtx2Q5pzfU ZWFQngphcHMnJKyFgTlyN7ckW+BrKVOVPqmTbbHex9OuM59yV42C1Y1u1eMtkV5HmMhO A0sOECkVtCqXPhGqZnBEdf4602+NKtRQQsd3ct8/xlpsxDGabpQjJnmp0wwiZFG6Fh9x zQrGPkJqwfRW22h8Xqo1omOj50IYDqbeGs1xXuQcm8O5IUxIImzPUnRsoV2Kcwa9ZmF4 hSrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712214921; x=1712819721; 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=J5f9n7odinT4RWqYkmTS+WDxKhbPNOevirl7nLpKZ3Q=; b=YgDCwRoPOS3XMMLRlxEFojvSNlOpp0X91z8entjiWMIDeDLa3E47bxnLebFQaHHqGT 4eC7eGlalfomI3XkH/4lBglQFFv8cc9DdRL1YmsoFJnMkc+XfpLuzhgw1wqGuzGVAYgg Z3h/u35VNatUC6Bos+sgDPc6o3nst+yLiYuz18gpcbkU1MbwP6PhhQAN2FCJnXWAuYQ1 FkY04wd7s+gr+DFRsVVNsgQtllqG4TTjhtqeTef8VhHUVbdUo2EG4eqGFAnxgENCQ3pG 5NMs56ctIZzqUKnpmEuVvzI5ycEzlZpQW+NVgvFFZHjmmfYpKLHPMmOfmDoZWAKZ8GBS T3sg== X-Forwarded-Encrypted: i=1; AJvYcCVRcbcxPMZ7Ry16oPwSI4Nrvs3S4WfrHch85mpu6BcrB69z/aUW4L1M2ULHmxReu0sCgtnUkoOsFZNKNvg+FQ6TwK0zZFqwtjetywG21k/Y56UjqOf5Gx2z0AnLeLQVYhhJLxDn1vC4eA4day2nQK/FY6SMkrSokeIlWjQU+6btg3UpICJDT1/n8l4= X-Gm-Message-State: AOJu0YwOifY9PVNEcPwVZLM+AgKMHDIlaVZOSM3CkKnJSRbcLcCoU2o2 TQG83eXBSpC+mBZxWDxYUYacF6cXU2NKJ13BdrM3eeyZUgWdZBRK X-Google-Smtp-Source: AGHT+IHQ71BzPE2Jd50DpY5Uuexh9bB292p9+PnwiYCQnWyndjL0lunoEy0BKwsQ/jrKET916igh/Q== X-Received: by 2002:a17:902:db0e:b0:1e2:b1e6:4f69 with SMTP id m14-20020a170902db0e00b001e2b1e64f69mr518986plx.40.1712214921534; Thu, 04 Apr 2024 00:15:21 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id h20-20020a170902f2d400b001e26c4823d0sm5220873plc.52.2024.04.04.00.15.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:15:21 -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 v2 5/6] usb: dwc3: exynos: Use devm_regulator_bulk_get_enable() helper function Date: Thu, 4 Apr 2024 12:43:21 +0530 Message-ID: <20240404071350.4242-6-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240404071350.4242-1-linux.amoon@gmail.com> References: <20240404071350.4242-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 Use devm_regulator_bulk_get_enable() instead of open coded 'devm_regulator_get(), regulator_enable(), regulator_disable(). Signed-off-by: Anand Moon --- V2: no changes, did not find any regression in pm suspend/resume. --- drivers/usb/dwc3/dwc3-exynos.c | 50 ++++------------------------------ 1 file changed, 5 insertions(+), 45 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 5d365ca51771..2d341f0e22a3 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -32,9 +32,6 @@ struct dwc3_exynos { struct clk *clks[DWC3_EXYNOS_MAX_CLOCKS]; int num_clks; int suspend_clk_idx; - - struct regulator *vdd33; - struct regulator *vdd10; }; static int dwc3_exynos_probe(struct platform_device *pdev) @@ -44,6 +41,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev) struct device_node *node = dev->of_node; const struct dwc3_exynos_driverdata *driver_data; int i, ret; + static const char * const regulators[] = { "vdd33", "vdd10" }; exynos = devm_kzalloc(dev, sizeof(*exynos), GFP_KERNEL); if (!exynos) @@ -78,27 +76,10 @@ static int dwc3_exynos_probe(struct platform_device *pdev) if (exynos->suspend_clk_idx >= 0) clk_prepare_enable(exynos->clks[exynos->suspend_clk_idx]); - exynos->vdd33 = devm_regulator_get(dev, "vdd33"); - if (IS_ERR(exynos->vdd33)) { - ret = PTR_ERR(exynos->vdd33); - goto vdd33_err; - } - ret = regulator_enable(exynos->vdd33); - if (ret) { - dev_err(dev, "Failed to enable VDD33 supply\n"); - goto vdd33_err; - } - - exynos->vdd10 = devm_regulator_get(dev, "vdd10"); - if (IS_ERR(exynos->vdd10)) { - ret = PTR_ERR(exynos->vdd10); - goto vdd10_err; - } - ret = regulator_enable(exynos->vdd10); - if (ret) { - dev_err(dev, "Failed to enable VDD10 supply\n"); - goto vdd10_err; - } + ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulators), + regulators); + if (ret) + return dev_err_probe(dev, ret, "Failed to enable regulators\n"); if (node) { ret = of_platform_populate(node, NULL, NULL, dev); @@ -115,10 +96,6 @@ static int dwc3_exynos_probe(struct platform_device *pdev) return 0; populate_err: - regulator_disable(exynos->vdd10); -vdd10_err: - regulator_disable(exynos->vdd33); -vdd33_err: for (i = exynos->num_clks - 1; i >= 0; i--) clk_disable_unprepare(exynos->clks[i]); @@ -140,9 +117,6 @@ static void dwc3_exynos_remove(struct platform_device *pdev) if (exynos->suspend_clk_idx >= 0) clk_disable_unprepare(exynos->clks[exynos->suspend_clk_idx]); - - regulator_disable(exynos->vdd33); - regulator_disable(exynos->vdd10); } static const struct dwc3_exynos_driverdata exynos5250_drvdata = { @@ -196,9 +170,6 @@ static int dwc3_exynos_suspend(struct device *dev) for (i = exynos->num_clks - 1; i >= 0; i--) clk_disable_unprepare(exynos->clks[i]); - regulator_disable(exynos->vdd33); - regulator_disable(exynos->vdd10); - return 0; } @@ -207,17 +178,6 @@ static int dwc3_exynos_resume(struct device *dev) struct dwc3_exynos *exynos = dev_get_drvdata(dev); int i, ret; - ret = regulator_enable(exynos->vdd33); - if (ret) { - dev_err(dev, "Failed to enable VDD33 supply\n"); - return ret; - } - ret = regulator_enable(exynos->vdd10); - if (ret) { - dev_err(dev, "Failed to enable VDD10 supply\n"); - return ret; - } - for (i = 0; i < exynos->num_clks; i++) { ret = clk_prepare_enable(exynos->clks[i]); if (ret) { From patchwork Thu Apr 4 07:13:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 786060 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 A60D66CDD8; Thu, 4 Apr 2024 07:15:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712214931; cv=none; b=YBX2WY+EXH3Ekr8xdobdopOA/J7EMoyGcutBvBKOcncUdaWnNIPgq1so6VNpqQqxY0Rq1V4MA44PQUbQQnhtum5eGzezmnr1m2gIeOfK7aEMn4p5xR9u+l6aAkk3l8b3J9X+TvmwADIaiiqRDDM6Fweu7g+CZ+037ZbJQ8ccchg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712214931; c=relaxed/simple; bh=D9m1RLiyFGpECVoIEX1Hn7WeagTQyO17nLGEaIGv/pc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FwSFM8OI5Ij+RrSj4+kdYxiuNbA7k8Q3eLcO7dqXH5azpsE3GdbVJmgE7PlkmH4oXZCe36fIQx7HyWtd5pDUO9l5n3WyYdPVfGKXKBeKfRC12uvvv2Syv2FK3GwasLF1MJrJsp7pbeYj+X5JLf1/DTGaqyD1CkJruhKAGojpX/M= 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=A5Dm2VgC; arc=none smtp.client-ip=209.85.214.182 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="A5Dm2VgC" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1e0878b76f3so5937615ad.0; Thu, 04 Apr 2024 00:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712214929; x=1712819729; 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=J37xgQA9uGX+wBOKJnojy8QxNGELdhvGrNPpqIWXrM4=; b=A5Dm2VgCNSZaMm8mZyJfRoECkTADuMibmSN85wyo1TkR2dYQbD9Kfm9mkZ0t2DE3jj wkQA51QSVAcr/y+xy//nM/ZGex50UCwfdDPDDB96Je46MQbY9aSOagmhhSVbDw3GScRy eAWSfL7H9+zYHlFZutSdieWNkYOvTc1ZICxdCQwg5aytJ7W3DDiT1bwOx2NpXf2gHNqX EZSFaUVWBrpZq4g1qXvMrtcF8LuE9OYeTDk1X8n58vv5Bb2SJDMvsFzYkH0784G91tm6 uNRE3Hp1QDWOB5iv8uANhuzBIO9jI7X6NgPLrRytBqXP65HjBvCNlqiEWF/wnxnkg5t3 5Jbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712214929; x=1712819729; 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=J37xgQA9uGX+wBOKJnojy8QxNGELdhvGrNPpqIWXrM4=; b=L9gxjaTRDi8ZMLnaue2qE5uo9hn+S8tZU7JGeYI6Y2womoxRCnFPMI4gWFC/E7qqTt ND3lFFkmVfi/2FN6F1IBGJE4TTA+vA0c7Modq6vAfuO5DEv+KKBPbJ3H4Fai9W7JUVkB M/wXjRv6cRyHavGo95FxP5VI2treou7ExKmBpyuN+QcCp/RrHVxqB3aVKSqdwS4tT6c7 WZuJPVPWwpP0Covk2I7z26rKFmiF67JE3A8Y92va14h81A62AYnkzESy9CdupDghEfCS 4o9ez51TVyIh3S8WKFdNaUKDcpnl09z6ljCPR14b+jLzYPA17IjJnHj4RoTH3LSl8ndI a4UA== X-Forwarded-Encrypted: i=1; AJvYcCVIhsuVzN9pNiP/5h+o7ljbxSsM0rFg+uoujf4s+kj3Sl+hP1hzezSNAn31VlGQiUjDqDOPROpq2dgOI9cIHgd884gSNShyS7K9Ri+yJ8krdTDxsl04vNp5HGeVG6Sle7n0+TuMT/6ZzHKcsxjrih/bmQfTcFxx5RnJ6ZIW07fZeVuLgP+tx0hdbB0= X-Gm-Message-State: AOJu0YzMVxibi0wf7G7Skq2z/tH9eSwEigDclZBZ8x2rcBWMrexet0zk asQUSqFgtntHmuOCGeBuflBP68XhYbyy4xZ5iGURzggukK6kFYzP X-Google-Smtp-Source: AGHT+IFho3nsnGV/Vraj6b236VW0aMhIhz4R5zKUYzxQDKs11VTEws5/th4dV0E4KIv3/LNWrhSraQ== X-Received: by 2002:a17:903:32c8:b0:1e0:b628:a752 with SMTP id i8-20020a17090332c800b001e0b628a752mr6820836plr.7.1712214928864; Thu, 04 Apr 2024 00:15:28 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id h20-20020a170902f2d400b001e26c4823d0sm5220873plc.52.2024.04.04.00.15.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:15:28 -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 v2 6/6] usb: dwc3: exynos: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Date: Thu, 4 Apr 2024 12:43:22 +0530 Message-ID: <20240404071350.4242-7-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240404071350.4242-1-linux.amoon@gmail.com> References: <20240404071350.4242-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 Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards. If CONFIG_PM_SLEEP unused, they will simply be discarded by the compiler. Signed-off-by: Anand Moon --- v2: add __maybe_unused to suspend/resume functions in case CONFIG_PM is disabled. --- drivers/usb/dwc3/dwc3-exynos.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 2d341f0e22a3..90259ad1d0d9 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -161,8 +161,7 @@ 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) +static int __maybe_unused dwc3_exynos_suspend(struct device *dev) { struct dwc3_exynos *exynos = dev_get_drvdata(dev); int i; @@ -173,7 +172,7 @@ static int dwc3_exynos_suspend(struct device *dev) return 0; } -static int dwc3_exynos_resume(struct device *dev) +static int __maybe_unused dwc3_exynos_resume(struct device *dev) { struct dwc3_exynos *exynos = dev_get_drvdata(dev); int i, ret; @@ -194,18 +193,13 @@ 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 struct platform_driver dwc3_exynos_driver = { .probe = dwc3_exynos_probe, .remove_new = dwc3_exynos_remove, .driver = { .name = "exynos-dwc3", .of_match_table = exynos_dwc3_match, - .pm = DEV_PM_OPS, + .pm = pm_sleep_ptr(&dwc3_exynos_dev_pm_ops), }, };