From patchwork Fri Jul 12 07:26:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 11041647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD13413A4 for ; Fri, 12 Jul 2019 07:26:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4CBE28B8F for ; Fri, 12 Jul 2019 07:26:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B916F28BB9; Fri, 12 Jul 2019 07:26:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64D3828B8F for ; Fri, 12 Jul 2019 07:26:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726246AbfGLH0m (ORCPT ); Fri, 12 Jul 2019 03:26:42 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:36099 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbfGLH0m (ORCPT ); Fri, 12 Jul 2019 03:26:42 -0400 Received: by mail-pf1-f193.google.com with SMTP id r7so3927952pfl.3; Fri, 12 Jul 2019 00:26:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GM4E4omai6eUpjjddeuGvkdyjfxAyCJ8u0HfjV4CSgM=; b=VrtWikF60K5u7Np2ZPQAb5qhwb8APG0QWk6xD8wZVT5sAbatel/6WvweQLuiu+jOmH d8ghD9oVVCeD801BozuxJaAZ3yD4sP6hoI9FaM14Doig8m4cuxdIZOXu4MywMZQ1nl2Z cCVsAusIYq24+cD9r4BKrBhVvZF6Aawil78oZM3DAyUemEleBVmwKp/W88B8iEWpz5eP TzOcDvTe1KlxOkA5k1oOh5d5NplC0ltF3MPBIB8i7eFwiMD/WcrgKLtt4QkX4nzB5T6e 8wZQUQIV+0r/n3QVKHmJbWI7Ae+6MP4VhxdNwEe6/7IO7h38mFSHU+2x/27Dj1fctS5K twjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GM4E4omai6eUpjjddeuGvkdyjfxAyCJ8u0HfjV4CSgM=; b=GHyiLBfseuPCMT3aFPBS5wopkrAfV/4/h7tGUkvvR25Cbc81dEkpyaBWwacFdf2Bvu UVsBPSB5hEkkTplM586jf1bwoYRTlyUHC21u+X0jeLH8/eVo4K/QxZbYH+5vY5sN3wgl TC7qi+euSPYhBhQRQtFkHJKRlUkZNscQorOaqkPiiF3PEgnuoH9kbMhBNZQKdwqNsHL9 g7JRdrDtpEEkWuqOUW3EayDYjTWRvQTBjS3cpK5Bfch0uoIJRjm/tbzawm7nL7Xoajae bxyhVxS2r/1LDeSm3WjoSOaJxWXsUUehtsdWzE5/5Njho+BGd/uosxi0ZHTbXutw/Tgj m1LQ== X-Gm-Message-State: APjAAAUL9yHp+2xSf0OTiyS8os1Gdg9mosjR57L0t1EWz3hAmzqBMvHW IWuEHh8vK5gPKEeukD/GWoE9ipeZseE= X-Google-Smtp-Source: APXvYqztXegq2ZsLM8aK1h6VgHcW+DGB0dnrXVu7KE6Td9QrRPf+FzaxubdlwNmmHl3Unq6C2BXJEQ== X-Received: by 2002:a17:90a:5806:: with SMTP id h6mr9638201pji.126.1562916400651; Fri, 12 Jul 2019 00:26:40 -0700 (PDT) Received: from localhost.lan (c-67-185-54-80.hsd1.wa.comcast.net. [67.185.54.80]) by smtp.gmail.com with ESMTPSA id c8sm13795725pjq.2.2019.07.12.00.26.39 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 12 Jul 2019 00:26:40 -0700 (PDT) From: Andrey Smirnov To: linux-usb@vger.kernel.org Cc: Andrey Smirnov , Felipe Balbi , Chris Healy , Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] usb: dwc3: Use devres to get clocks Date: Fri, 12 Jul 2019 00:26:33 -0700 Message-Id: <20190712072634.3107-1-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use devres to get clocks and drop explicit clock freeing. No functional change intended. Signed-off-by: Andrey Smirnov Cc: Felipe Balbi Cc: Chris Healy Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/usb/dwc3/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index c9bb93a2c81e..768023a2553c 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1436,7 +1436,7 @@ static int dwc3_probe(struct platform_device *pdev) if (dev->of_node) { dwc->num_clks = ARRAY_SIZE(dwc3_core_clks); - ret = clk_bulk_get(dev, dwc->num_clks, dwc->clks); + ret = devm_clk_bulk_get(dev, dwc->num_clks, dwc->clks); if (ret == -EPROBE_DEFER) return ret; /* @@ -1449,7 +1449,7 @@ static int dwc3_probe(struct platform_device *pdev) ret = reset_control_deassert(dwc->reset); if (ret) - goto put_clks; + return ret; ret = clk_bulk_prepare(dwc->num_clks, dwc->clks); if (ret) @@ -1536,8 +1536,6 @@ static int dwc3_probe(struct platform_device *pdev) clk_bulk_unprepare(dwc->num_clks, dwc->clks); assert_reset: reset_control_assert(dwc->reset); -put_clks: - clk_bulk_put(dwc->num_clks, dwc->clks); return ret; } @@ -1560,7 +1558,6 @@ static int dwc3_remove(struct platform_device *pdev) dwc3_free_event_buffers(dwc); dwc3_free_scratch_buffers(dwc); - clk_bulk_put(dwc->num_clks, dwc->clks); return 0; } From patchwork Fri Jul 12 07:26:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 11041645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 503C51395 for ; Fri, 12 Jul 2019 07:26:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3830328B8F for ; Fri, 12 Jul 2019 07:26:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C13C28BB9; Fri, 12 Jul 2019 07:26:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1795B28B8F for ; Fri, 12 Jul 2019 07:26:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726265AbfGLH0o (ORCPT ); Fri, 12 Jul 2019 03:26:44 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:35763 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726260AbfGLH0m (ORCPT ); Fri, 12 Jul 2019 03:26:42 -0400 Received: by mail-pg1-f194.google.com with SMTP id s27so4152214pgl.2; Fri, 12 Jul 2019 00:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nWwViFouQwIqf+g6UOw7AyeWqZT4DAg0WEkB/L7FLMM=; b=cB0TVUt6dyKb/5lupeLcQvlW5q+/B9s2ocU5oy6XlYQw3nNCRrNPrWXgqDk+X828c5 tvMfwQ4ASQ7PSdCF2oEB1jZPCsDexgRfg3ElMjq4N6+bJhrXVb6CJGWNSjc+DrBjAIwK GQLLiLqB5a+je2oG5C6VlDl1LRrs0t2fduLKZ6iPXO2q5nYaPjyRfWtxHsT9pc3fFQ5/ ozW4sBTnyrIn3CBUgs7a2Z5WAfy+hTQfb699pFetLBxxZlGkT8Z03LQLKTIFmUgyqUHh +Fjz+2r7mvDnX6YzatFej80xBKk9TjMahbDSXKLi4flSgiuyUl/Hp72XSnQbk3NFetBV ct+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nWwViFouQwIqf+g6UOw7AyeWqZT4DAg0WEkB/L7FLMM=; b=LTdN8J7u/KB/tFm5YXAsy0ZEh1yRMmFMcVAO6BxKNCRr6nCxzm4Z2lepo3V0aK6HZ/ l94U/oQEjQHkmJXXutiFWOUsF3+LqjUgyLZnQbif3CsfY13wT3QsGuiQfnaHm1Kovmi+ SAVJC6jYiRzz+7Gxo2m4R9GsJLwuAVM2dkhn8PGOylsmT/tIxrXorPqq2lbbuX26NsKb RnQFT4+Il9u6MVsUay5yZnBO6cflTai4JH2evB0cIfSu6vzV0iyY1bUB/SlyVAUCUTDZ 0+FV+xZlKOmyQDDkAu2Vmfw4DEaX+MciZwcEZJz4jlfzIxRTpB1ANOnNhfyT4WkP/mhy WeYg== X-Gm-Message-State: APjAAAW94lJQecpJDL8LsqnZLN4XPDJh3PHRMAnqo9Ul0XX+EZ5RHkHv 0z0oSRbaD8/qAmV3XhU7z/vkQMt2QIs= X-Google-Smtp-Source: APXvYqz6HFxbeWNJWr/m54Pkxgp4cifA4bybur1EvREhe7MrAKgMwL+fneDTNbo/65f+WZ/+dyV1ew== X-Received: by 2002:a17:90a:32c7:: with SMTP id l65mr9950937pjb.1.1562916401807; Fri, 12 Jul 2019 00:26:41 -0700 (PDT) Received: from localhost.lan (c-67-185-54-80.hsd1.wa.comcast.net. [67.185.54.80]) by smtp.gmail.com with ESMTPSA id c8sm13795725pjq.2.2019.07.12.00.26.40 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 12 Jul 2019 00:26:41 -0700 (PDT) From: Andrey Smirnov To: linux-usb@vger.kernel.org Cc: Andrey Smirnov , Felipe Balbi , Chris Healy , Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] usb: dwc3: Use clk_bulk_prepare_enable() Date: Fri, 12 Jul 2019 00:26:34 -0700 Message-Id: <20190712072634.3107-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190712072634.3107-1-andrew.smirnov@gmail.com> References: <20190712072634.3107-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use clk_bulk_prepare_enable() and clk_bulk_disable_unprepare() to simplify code a bit. No functional change intended. Signed-off-by: Andrey Smirnov Cc: Felipe Balbi Cc: Chris Healy Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/usb/dwc3/core.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 768023a2553c..f0e0cbe9254a 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -686,8 +686,7 @@ static void dwc3_core_exit(struct dwc3 *dwc) usb_phy_set_suspend(dwc->usb3_phy, 1); phy_power_off(dwc->usb2_generic_phy); phy_power_off(dwc->usb3_generic_phy); - clk_bulk_disable(dwc->num_clks, dwc->clks); - clk_bulk_unprepare(dwc->num_clks, dwc->clks); + clk_bulk_disable_unprepare(dwc->num_clks, dwc->clks); reset_control_assert(dwc->reset); } @@ -1451,14 +1450,10 @@ static int dwc3_probe(struct platform_device *pdev) if (ret) return ret; - ret = clk_bulk_prepare(dwc->num_clks, dwc->clks); + ret = clk_bulk_prepare_enable(dwc->num_clks, dwc->clks); if (ret) goto assert_reset; - ret = clk_bulk_enable(dwc->num_clks, dwc->clks); - if (ret) - goto unprepare_clks; - if (!dwc3_core_is_valid(dwc)) { dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n"); ret = -ENODEV; @@ -1531,9 +1526,7 @@ static int dwc3_probe(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); disable_clks: - clk_bulk_disable(dwc->num_clks, dwc->clks); -unprepare_clks: - clk_bulk_unprepare(dwc->num_clks, dwc->clks); + clk_bulk_disable_unprepare(dwc->num_clks, dwc->clks); assert_reset: reset_control_assert(dwc->reset); @@ -1571,14 +1564,10 @@ static int dwc3_core_init_for_resume(struct dwc3 *dwc) if (ret) return ret; - ret = clk_bulk_prepare(dwc->num_clks, dwc->clks); + ret = clk_bulk_prepare_enable(dwc->num_clks, dwc->clks); if (ret) goto assert_reset; - ret = clk_bulk_enable(dwc->num_clks, dwc->clks); - if (ret) - goto unprepare_clks; - ret = dwc3_core_init(dwc); if (ret) goto disable_clks; @@ -1586,9 +1575,7 @@ static int dwc3_core_init_for_resume(struct dwc3 *dwc) return 0; disable_clks: - clk_bulk_disable(dwc->num_clks, dwc->clks); -unprepare_clks: - clk_bulk_unprepare(dwc->num_clks, dwc->clks); + clk_bulk_disable_unprepare(dwc->num_clks, dwc->clks); assert_reset: reset_control_assert(dwc->reset);