From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0FFFFCD1284 for ; Thu, 4 Apr 2024 07:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gCaKDYngQmaq+LSnSPMkvXMrEXiNtzwD2wRRBKZ8Bn0=; b=JkuJFKDEdP8eHQ 8aIgouTFqsmZy9Im27df8i+Kk0/uc4pCtZGCGv6loE5b1O5TEvtTr6OxSyvj7eaIAOjELdM6FOB8R 8gpVwRvSu8EaPZwvbPfV23mXtRmEmaQSG4HTiG4dS/FJvXONZdFVeyNBcLYSbYlD6Egn9J6P9W51u dDWKb4TA3Q31XEDYAMDEfNSxwKHela1XEmP7oDqLduQ0SCP1oDiMyPo/cPrsEkZ8bnaovD/GR5Ybx jv3/vG0ZJ1nCuEJK60+bdLuZzyZb8zWoaFFw24KZbSv6E14NejNdtDbLJIzyxbddDUAI+We/MctLi CzsPFOtby+M0/EV1RJJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJY-00000001b3y-3sS5; Thu, 04 Apr 2024 07:15:12 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJU-00000001b0d-2gAS for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2024 07:15:10 +0000 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1e0d82d441bso5879935ad.3 for ; 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=lists.infradead.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=kCGzcsz994OBpFjv0nH81Atu9SX6Ul5yy6NnZGMsFSNn4Rh90BshE1V9+z4PZjQBLK Q0b2VzbUocMPp0/rPTraukS+iA23F82i0O44bykJoBlWgv2drelzHDZwu07YG2Fr9n9f jhEzsa7+vK//LWCv3dlL6ISLsWswtKq3httR0hCHbzT1HImkYjsBQoZVU2SpYLYB7bKP OUoZcsrN9PJfmQ4sHrGVe1JeXgu81uGYP7q0qrK9o2E0db5JtYIF7YAfeebqF0KTiN59 dhLV7V6+IP4fGBXH6uLG6UZmNVX/XRFUGqeLVLOQHJY2QsWjMRVBk7KU8qCoiGsb9Eh7 MIdw== 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=jltr9OcHh9+mN9HAyxbnkFWh/hwqlY0ZsZAmxkqDYkj4FqQxd9D0nqCEiym7HQ+6RK 6dwYsCjnYxO7imGvMRNs3bBmS7E/88awCs26Wz6MtPR8L7HlzF5RT0zNTRduzMQVNfUH GepO7HEcuJyj0D/xY15wKK4KCrHav8nxQ5AR7uGP5lP5rUBJJnOdEyL+cNGpZ9/jvad5 NU/un82FOetyhQH3VMREQPnuTjSj0z8QVlz5MeC7gXZZS2NuBlpvby7eQ2rsSp+QCoTT fbLls6xgbm28Mlzw/rz9mFK/ZBWIYgb2pjHVy2F5SBvrmVJdI8ZB7bpe16Fmx6gyn4Fa JaMw== X-Forwarded-Encrypted: i=1; AJvYcCWQSXYArsr9dWkAs47HlP4DMO3BzdcOCYoUvaBlKEnL5bR13PuNqBJZkCviPQyb3sPEXeDtXGj/JNRMDWXr/QWiDeVA7EERRwiYpca9Runnm7bHDgw= X-Gm-Message-State: AOJu0YyA9SF+wQ3cK4YieSRm7dDf/FGSmBP2itnme9WvvPQ7hvXhT3LB nNYuuzJL22QssgIh3FtEHUf005bF1KQ/I287SlZ7ZmtgWKHWjBTd 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240404_001508_732657_6FF2BD89 X-CRM114-Status: GOOD ( 17.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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); } -- 2.44.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel