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 D2A3CC3DA66 for ; Wed, 23 Aug 2023 17:14:10 +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:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3OsA36VQ6Jcev8wNh5wFAmVMtcFemDqCysyoaLYS0bM=; b=e9uRzcGjhCH6vd rK3rasBQxN12QJ0fipnNxn6tdRPKKNJMKagLheEc0PLki8rrF70m5Pr8nqr4Nm0JIPvl+aQKWaPxb qjxn0I8Kwzv3O7qSZ+axE9wZPncnnRIl4WHi56qUiHQyNdb8nwPX3NvX4TkMpS/r5uabd2B3pjRan bli7nIwX3zsh1wlUC2nIVau1Ar57yGyrTfe87qdB5jsXVyOvOLujgncGHzP8Y1Szu7VTN3Ioficmz IpLezqO3o1FLTzLE9XwZ2jk78hv6/73TnUZhG8tAoPlSK3i+cz0GEeWD4eOLK+IpZhyFY0wa0c2QY gKhnnuwjiqwNHi7gCs/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYrQY-001Bvs-1A; Wed, 23 Aug 2023 17:13:54 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYrQU-001BvA-19; Wed, 23 Aug 2023 17:13:52 +0000 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4RWCTW26MVz6HJh9; Thu, 24 Aug 2023 01:13:03 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 23 Aug 2023 18:13:45 +0100 Date: Wed, 23 Aug 2023 18:13:44 +0100 From: Jonathan Cameron To: Serge Semin CC: Li Zetao , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH -next v2 11/25] spi: dw-bt1: Use helper function devm_clk_get_enabled() Message-ID: <20230823181344.000026bd@Huawei.com> In-Reply-To: References: <20230822131237.1022815-1-lizetao1@huawei.com> <20230823133938.1359106-1-lizetao1@huawei.com> <20230823133938.1359106-12-lizetao1@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100004.china.huawei.com (7.191.162.219) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230823_101350_699661_D4482B03 X-CRM114-Status: GOOD ( 25.72 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org On Wed, 23 Aug 2023 17:35:35 +0300 Serge Semin wrote: > On Wed, Aug 23, 2023 at 09:39:24PM +0800, Li Zetao wrote: > > Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared > > and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be > > replaced by devm_clk_get_enabled() when driver enables (and possibly > > prepares) the clocks for the whole lifetime of the device. Moreover, it is > > no longer necessary to unprepare and disable the clocks explicitly. > > > > > Reviewed-by: Jonathan Cameron > > Acked-by: Serge Semin > > Signed-off-by: Li Zetao > > Just for the record, the tags order is normally supposed to reflect a > patch route. Even though AFAICS it's explicitly defined for the Sob > tags only (see Documentation/process/submitting-patches.rst), but > almost all kernel developers apply that rule to all the tags. See the > kernel git log as the brightest example. So your Sob tag should have > been kept first, then either my Ab or Jonathan' Rb tags. There have been far too many discussions about this over the years. There is an argument (I'm not saying I agree with it) that tags given on an earlier version than the one posted should be before the SoB of the author on basis that the SoB is occurring later (as it's on the new version). That is a slightly stronger argument if there are changes to the patch, but then things get inconsistent between patches with minor changes and those without. *sigh* So this pattern is fairly common if a bit weird in my view :) Jonathan > > -Serge(y) > > > --- > > v1 -> v2: None > > > > drivers/spi/spi-dw-bt1.c | 23 +++++------------------ > > 1 file changed, 5 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/spi/spi-dw-bt1.c b/drivers/spi/spi-dw-bt1.c > > index 5e1c01822967..5391bcac305c 100644 > > --- a/drivers/spi/spi-dw-bt1.c > > +++ b/drivers/spi/spi-dw-bt1.c > > @@ -269,43 +269,32 @@ static int dw_spi_bt1_probe(struct platform_device *pdev) > > > > dws->paddr = mem->start; > > > > - dwsbt1->clk = devm_clk_get(&pdev->dev, NULL); > > + dwsbt1->clk = devm_clk_get_enabled(&pdev->dev, NULL); > > if (IS_ERR(dwsbt1->clk)) > > return PTR_ERR(dwsbt1->clk); > > > > - ret = clk_prepare_enable(dwsbt1->clk); > > - if (ret) > > - return ret; > > - > > dws->bus_num = pdev->id; > > dws->reg_io_width = 4; > > dws->max_freq = clk_get_rate(dwsbt1->clk); > > - if (!dws->max_freq) { > > - ret = -EINVAL; > > - goto err_disable_clk; > > - } > > + if (!dws->max_freq) > > + return -EINVAL; > > > > init_func = device_get_match_data(&pdev->dev); > > ret = init_func(pdev, dwsbt1); > > if (ret) > > - goto err_disable_clk; > > + return ret; > > > > pm_runtime_enable(&pdev->dev); > > > > ret = dw_spi_add_host(&pdev->dev, dws); > > if (ret) { > > pm_runtime_disable(&pdev->dev); > > - goto err_disable_clk; > > + return ret; > > } > > > > platform_set_drvdata(pdev, dwsbt1); > > > > return 0; > > - > > -err_disable_clk: > > - clk_disable_unprepare(dwsbt1->clk); > > - > > - return ret; > > } > > > > static void dw_spi_bt1_remove(struct platform_device *pdev) > > @@ -315,8 +304,6 @@ static void dw_spi_bt1_remove(struct platform_device *pdev) > > dw_spi_remove_host(&dwsbt1->dws); > > > > pm_runtime_disable(&pdev->dev); > > - > > - clk_disable_unprepare(dwsbt1->clk); > > } > > > > static const struct of_device_id dw_spi_bt1_of_match[] = { > > -- > > 2.34.1 > > _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Cameron Date: Wed, 23 Aug 2023 18:13:44 +0100 Subject: [PATCH -next v2 11/25] spi: dw-bt1: Use helper function devm_clk_get_enabled() In-Reply-To: References: <20230822131237.1022815-1-lizetao1@huawei.com> <20230823133938.1359106-1-lizetao1@huawei.com> <20230823133938.1359106-12-lizetao1@huawei.com> Message-ID: <20230823181344.000026bd@Huawei.com> List-Id: To: linux-aspeed@lists.ozlabs.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Wed, 23 Aug 2023 17:35:35 +0300 Serge Semin wrote: > On Wed, Aug 23, 2023 at 09:39:24PM +0800, Li Zetao wrote: > > Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared > > and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be > > replaced by devm_clk_get_enabled() when driver enables (and possibly > > prepares) the clocks for the whole lifetime of the device. Moreover, it is > > no longer necessary to unprepare and disable the clocks explicitly. > > > > > Reviewed-by: Jonathan Cameron > > Acked-by: Serge Semin > > Signed-off-by: Li Zetao > > Just for the record, the tags order is normally supposed to reflect a > patch route. Even though AFAICS it's explicitly defined for the Sob > tags only (see Documentation/process/submitting-patches.rst), but > almost all kernel developers apply that rule to all the tags. See the > kernel git log as the brightest example. So your Sob tag should have > been kept first, then either my Ab or Jonathan' Rb tags. There have been far too many discussions about this over the years. There is an argument (I'm not saying I agree with it) that tags given on an earlier version than the one posted should be before the SoB of the author on basis that the SoB is occurring later (as it's on the new version). That is a slightly stronger argument if there are changes to the patch, but then things get inconsistent between patches with minor changes and those without. *sigh* So this pattern is fairly common if a bit weird in my view :) Jonathan > > -Serge(y) > > > --- > > v1 -> v2: None > > > > drivers/spi/spi-dw-bt1.c | 23 +++++------------------ > > 1 file changed, 5 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/spi/spi-dw-bt1.c b/drivers/spi/spi-dw-bt1.c > > index 5e1c01822967..5391bcac305c 100644 > > --- a/drivers/spi/spi-dw-bt1.c > > +++ b/drivers/spi/spi-dw-bt1.c > > @@ -269,43 +269,32 @@ static int dw_spi_bt1_probe(struct platform_device *pdev) > > > > dws->paddr = mem->start; > > > > - dwsbt1->clk = devm_clk_get(&pdev->dev, NULL); > > + dwsbt1->clk = devm_clk_get_enabled(&pdev->dev, NULL); > > if (IS_ERR(dwsbt1->clk)) > > return PTR_ERR(dwsbt1->clk); > > > > - ret = clk_prepare_enable(dwsbt1->clk); > > - if (ret) > > - return ret; > > - > > dws->bus_num = pdev->id; > > dws->reg_io_width = 4; > > dws->max_freq = clk_get_rate(dwsbt1->clk); > > - if (!dws->max_freq) { > > - ret = -EINVAL; > > - goto err_disable_clk; > > - } > > + if (!dws->max_freq) > > + return -EINVAL; > > > > init_func = device_get_match_data(&pdev->dev); > > ret = init_func(pdev, dwsbt1); > > if (ret) > > - goto err_disable_clk; > > + return ret; > > > > pm_runtime_enable(&pdev->dev); > > > > ret = dw_spi_add_host(&pdev->dev, dws); > > if (ret) { > > pm_runtime_disable(&pdev->dev); > > - goto err_disable_clk; > > + return ret; > > } > > > > platform_set_drvdata(pdev, dwsbt1); > > > > return 0; > > - > > -err_disable_clk: > > - clk_disable_unprepare(dwsbt1->clk); > > - > > - return ret; > > } > > > > static void dw_spi_bt1_remove(struct platform_device *pdev) > > @@ -315,8 +304,6 @@ static void dw_spi_bt1_remove(struct platform_device *pdev) > > dw_spi_remove_host(&dwsbt1->dws); > > > > pm_runtime_disable(&pdev->dev); > > - > > - clk_disable_unprepare(dwsbt1->clk); > > } > > > > static const struct of_device_id dw_spi_bt1_of_match[] = { > > -- > > 2.34.1 > > 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 4243EC3DA6F for ; Wed, 23 Aug 2023 17:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:CC:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HQP21UiWnaaGe2w8JS+zK9Z7JfR5YDc7pI0zYHd0YXk=; b=D+/x2ILEfv8J68I3Y6+1JzPENq ItJEUSi8E+j0AjIVlg0IwkagtUQWXEHZ3QXUcLIweyj7UnKX1S+dljhPSg3fdjmIowYORidEV4WDL Oa70f9BK4my4WIS0L8vA3354jR2wouZzSlkhrYGUs8uTHw420kZLvFPWvfTXDBIxh4L7BT7TARb/I Q9zFlarxRDWwqEf3ZKtpReLRiZqpuumiVqR+so1xRW+ul+YV0IPKsKI1U0NTMRg1YWJuruEaPjsfZ ySRVTUO25owOzWl04YuBtg0r2X9xAqleubqJ2tO4vNQPp00RkGjH10JaawjcjoGvsKGlkgAu9sicc +3uID3Hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYrQZ-001BwF-0e; Wed, 23 Aug 2023 17:13:55 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYrQU-001BvA-19; Wed, 23 Aug 2023 17:13:52 +0000 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4RWCTW26MVz6HJh9; Thu, 24 Aug 2023 01:13:03 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 23 Aug 2023 18:13:45 +0100 Date: Wed, 23 Aug 2023 18:13:44 +0100 From: Jonathan Cameron To: Serge Semin CC: Li Zetao , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH -next v2 11/25] spi: dw-bt1: Use helper function devm_clk_get_enabled() Message-ID: <20230823181344.000026bd@Huawei.com> In-Reply-To: References: <20230822131237.1022815-1-lizetao1@huawei.com> <20230823133938.1359106-1-lizetao1@huawei.com> <20230823133938.1359106-12-lizetao1@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100004.china.huawei.com (7.191.162.219) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230823_101350_699661_D4482B03 X-CRM114-Status: GOOD ( 25.72 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Wed, 23 Aug 2023 17:35:35 +0300 Serge Semin wrote: > On Wed, Aug 23, 2023 at 09:39:24PM +0800, Li Zetao wrote: > > Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared > > and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be > > replaced by devm_clk_get_enabled() when driver enables (and possibly > > prepares) the clocks for the whole lifetime of the device. Moreover, it is > > no longer necessary to unprepare and disable the clocks explicitly. > > > > > Reviewed-by: Jonathan Cameron > > Acked-by: Serge Semin > > Signed-off-by: Li Zetao > > Just for the record, the tags order is normally supposed to reflect a > patch route. Even though AFAICS it's explicitly defined for the Sob > tags only (see Documentation/process/submitting-patches.rst), but > almost all kernel developers apply that rule to all the tags. See the > kernel git log as the brightest example. So your Sob tag should have > been kept first, then either my Ab or Jonathan' Rb tags. There have been far too many discussions about this over the years. There is an argument (I'm not saying I agree with it) that tags given on an earlier version than the one posted should be before the SoB of the author on basis that the SoB is occurring later (as it's on the new version). That is a slightly stronger argument if there are changes to the patch, but then things get inconsistent between patches with minor changes and those without. *sigh* So this pattern is fairly common if a bit weird in my view :) Jonathan > > -Serge(y) > > > --- > > v1 -> v2: None > > > > drivers/spi/spi-dw-bt1.c | 23 +++++------------------ > > 1 file changed, 5 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/spi/spi-dw-bt1.c b/drivers/spi/spi-dw-bt1.c > > index 5e1c01822967..5391bcac305c 100644 > > --- a/drivers/spi/spi-dw-bt1.c > > +++ b/drivers/spi/spi-dw-bt1.c > > @@ -269,43 +269,32 @@ static int dw_spi_bt1_probe(struct platform_device *pdev) > > > > dws->paddr = mem->start; > > > > - dwsbt1->clk = devm_clk_get(&pdev->dev, NULL); > > + dwsbt1->clk = devm_clk_get_enabled(&pdev->dev, NULL); > > if (IS_ERR(dwsbt1->clk)) > > return PTR_ERR(dwsbt1->clk); > > > > - ret = clk_prepare_enable(dwsbt1->clk); > > - if (ret) > > - return ret; > > - > > dws->bus_num = pdev->id; > > dws->reg_io_width = 4; > > dws->max_freq = clk_get_rate(dwsbt1->clk); > > - if (!dws->max_freq) { > > - ret = -EINVAL; > > - goto err_disable_clk; > > - } > > + if (!dws->max_freq) > > + return -EINVAL; > > > > init_func = device_get_match_data(&pdev->dev); > > ret = init_func(pdev, dwsbt1); > > if (ret) > > - goto err_disable_clk; > > + return ret; > > > > pm_runtime_enable(&pdev->dev); > > > > ret = dw_spi_add_host(&pdev->dev, dws); > > if (ret) { > > pm_runtime_disable(&pdev->dev); > > - goto err_disable_clk; > > + return ret; > > } > > > > platform_set_drvdata(pdev, dwsbt1); > > > > return 0; > > - > > -err_disable_clk: > > - clk_disable_unprepare(dwsbt1->clk); > > - > > - return ret; > > } > > > > static void dw_spi_bt1_remove(struct platform_device *pdev) > > @@ -315,8 +304,6 @@ static void dw_spi_bt1_remove(struct platform_device *pdev) > > dw_spi_remove_host(&dwsbt1->dws); > > > > pm_runtime_disable(&pdev->dev); > > - > > - clk_disable_unprepare(dwsbt1->clk); > > } > > > > static const struct of_device_id dw_spi_bt1_of_match[] = { > > -- > > 2.34.1 > > 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 E0AA3C71134 for ; Wed, 23 Aug 2023 17:14:00 +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:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5rqSuCQr/AL7zARCIY5338/lnIK0D1mJoeMRcy3ZdHM=; b=i9zTTD8HIlCQuJ sCq8T50uGVb9eugbTSI6GMZGmt38JqqM+3OWsbBw2tYZ4vTJW27rFxZSVb3ymt4xPKi0vIGj33eSu yhDKojWa9pYSukMxIfQjF3jipE+hmTV1r/ZdBjBvf5RCIicopH7Ks8Ex8oTsnYa8sPsAMVDLTy0p2 xFcicyBZ4wyvJxO3m3nbmEzfe3DqL+aKQvVtZ17kCaIY07bKZzdZT2s9wiKxFnaic4VwMcgSG9B+M uJih/+nyNVUHA+aUvY+8Z5TuWeSyqt27/fzW8plgCJbm58tcd9YT1NB65Zou06KHBDAptbVFPQn2A eXOAsGZiyDUEfIq4665w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYrQa-001Bws-0Q; Wed, 23 Aug 2023 17:13:56 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYrQU-001BvA-19; Wed, 23 Aug 2023 17:13:52 +0000 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4RWCTW26MVz6HJh9; Thu, 24 Aug 2023 01:13:03 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 23 Aug 2023 18:13:45 +0100 Date: Wed, 23 Aug 2023 18:13:44 +0100 From: Jonathan Cameron To: Serge Semin CC: Li Zetao , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH -next v2 11/25] spi: dw-bt1: Use helper function devm_clk_get_enabled() Message-ID: <20230823181344.000026bd@Huawei.com> In-Reply-To: References: <20230822131237.1022815-1-lizetao1@huawei.com> <20230823133938.1359106-1-lizetao1@huawei.com> <20230823133938.1359106-12-lizetao1@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100004.china.huawei.com (7.191.162.219) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230823_101350_699661_D4482B03 X-CRM114-Status: GOOD ( 25.72 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org On Wed, 23 Aug 2023 17:35:35 +0300 Serge Semin wrote: > On Wed, Aug 23, 2023 at 09:39:24PM +0800, Li Zetao wrote: > > Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared > > and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be > > replaced by devm_clk_get_enabled() when driver enables (and possibly > > prepares) the clocks for the whole lifetime of the device. Moreover, it is > > no longer necessary to unprepare and disable the clocks explicitly. > > > > > Reviewed-by: Jonathan Cameron > > Acked-by: Serge Semin > > Signed-off-by: Li Zetao > > Just for the record, the tags order is normally supposed to reflect a > patch route. Even though AFAICS it's explicitly defined for the Sob > tags only (see Documentation/process/submitting-patches.rst), but > almost all kernel developers apply that rule to all the tags. See the > kernel git log as the brightest example. So your Sob tag should have > been kept first, then either my Ab or Jonathan' Rb tags. There have been far too many discussions about this over the years. There is an argument (I'm not saying I agree with it) that tags given on an earlier version than the one posted should be before the SoB of the author on basis that the SoB is occurring later (as it's on the new version). That is a slightly stronger argument if there are changes to the patch, but then things get inconsistent between patches with minor changes and those without. *sigh* So this pattern is fairly common if a bit weird in my view :) Jonathan > > -Serge(y) > > > --- > > v1 -> v2: None > > > > drivers/spi/spi-dw-bt1.c | 23 +++++------------------ > > 1 file changed, 5 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/spi/spi-dw-bt1.c b/drivers/spi/spi-dw-bt1.c > > index 5e1c01822967..5391bcac305c 100644 > > --- a/drivers/spi/spi-dw-bt1.c > > +++ b/drivers/spi/spi-dw-bt1.c > > @@ -269,43 +269,32 @@ static int dw_spi_bt1_probe(struct platform_device *pdev) > > > > dws->paddr = mem->start; > > > > - dwsbt1->clk = devm_clk_get(&pdev->dev, NULL); > > + dwsbt1->clk = devm_clk_get_enabled(&pdev->dev, NULL); > > if (IS_ERR(dwsbt1->clk)) > > return PTR_ERR(dwsbt1->clk); > > > > - ret = clk_prepare_enable(dwsbt1->clk); > > - if (ret) > > - return ret; > > - > > dws->bus_num = pdev->id; > > dws->reg_io_width = 4; > > dws->max_freq = clk_get_rate(dwsbt1->clk); > > - if (!dws->max_freq) { > > - ret = -EINVAL; > > - goto err_disable_clk; > > - } > > + if (!dws->max_freq) > > + return -EINVAL; > > > > init_func = device_get_match_data(&pdev->dev); > > ret = init_func(pdev, dwsbt1); > > if (ret) > > - goto err_disable_clk; > > + return ret; > > > > pm_runtime_enable(&pdev->dev); > > > > ret = dw_spi_add_host(&pdev->dev, dws); > > if (ret) { > > pm_runtime_disable(&pdev->dev); > > - goto err_disable_clk; > > + return ret; > > } > > > > platform_set_drvdata(pdev, dwsbt1); > > > > return 0; > > - > > -err_disable_clk: > > - clk_disable_unprepare(dwsbt1->clk); > > - > > - return ret; > > } > > > > static void dw_spi_bt1_remove(struct platform_device *pdev) > > @@ -315,8 +304,6 @@ static void dw_spi_bt1_remove(struct platform_device *pdev) > > dw_spi_remove_host(&dwsbt1->dws); > > > > pm_runtime_disable(&pdev->dev); > > - > > - clk_disable_unprepare(dwsbt1->clk); > > } > > > > static const struct of_device_id dw_spi_bt1_of_match[] = { > > -- > > 2.34.1 > > _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip 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 1CF8EC3DA6F for ; Wed, 23 Aug 2023 17:13:59 +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:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=y/2Mi3x7iifd58qk4KQ5fdfvva04dCUBWWOh7zscuas=; b=3Vd8xnzsuOP2WT 7Vwz112sVpgpqo90oNm9NJDlVDnTeYR0OkMVIMDU1wwhlFKekVMQaSondv2pIEQvgkhLiYNFJVnzA J6p4SG3TUStx/+uQQ8uKH3d1AnVepDy+Hnz/mPrcm/8Yp6B7WHe8qRdkyt/cMj3kXsegDi1UEhcPU XwMMNI03Us+K9WsZxp+aaGX0m+p1KIi6kSCLzI4Dhsgz/7a9YiNRgOVjQynbNpjrmPVz0Dfpg1xcN ppTf/8ANuShPEE9BTQV+R2qLs8vHzjFVohmLovqbQ14s+TEpaSuW4E7/KFDkp0X3eocYU3o0S9E6s THJrRE9hiNMx7H4yoIaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYrQZ-001BwR-1l; Wed, 23 Aug 2023 17:13:55 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYrQU-001BvA-19; Wed, 23 Aug 2023 17:13:52 +0000 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4RWCTW26MVz6HJh9; Thu, 24 Aug 2023 01:13:03 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 23 Aug 2023 18:13:45 +0100 Date: Wed, 23 Aug 2023 18:13:44 +0100 From: Jonathan Cameron To: Serge Semin CC: Li Zetao , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH -next v2 11/25] spi: dw-bt1: Use helper function devm_clk_get_enabled() Message-ID: <20230823181344.000026bd@Huawei.com> In-Reply-To: References: <20230822131237.1022815-1-lizetao1@huawei.com> <20230823133938.1359106-1-lizetao1@huawei.com> <20230823133938.1359106-12-lizetao1@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100004.china.huawei.com (7.191.162.219) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230823_101350_699661_D4482B03 X-CRM114-Status: GOOD ( 25.72 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Wed, 23 Aug 2023 17:35:35 +0300 Serge Semin wrote: > On Wed, Aug 23, 2023 at 09:39:24PM +0800, Li Zetao wrote: > > Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared > > and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be > > replaced by devm_clk_get_enabled() when driver enables (and possibly > > prepares) the clocks for the whole lifetime of the device. Moreover, it is > > no longer necessary to unprepare and disable the clocks explicitly. > > > > > Reviewed-by: Jonathan Cameron > > Acked-by: Serge Semin > > Signed-off-by: Li Zetao > > Just for the record, the tags order is normally supposed to reflect a > patch route. Even though AFAICS it's explicitly defined for the Sob > tags only (see Documentation/process/submitting-patches.rst), but > almost all kernel developers apply that rule to all the tags. See the > kernel git log as the brightest example. So your Sob tag should have > been kept first, then either my Ab or Jonathan' Rb tags. There have been far too many discussions about this over the years. There is an argument (I'm not saying I agree with it) that tags given on an earlier version than the one posted should be before the SoB of the author on basis that the SoB is occurring later (as it's on the new version). That is a slightly stronger argument if there are changes to the patch, but then things get inconsistent between patches with minor changes and those without. *sigh* So this pattern is fairly common if a bit weird in my view :) Jonathan > > -Serge(y) > > > --- > > v1 -> v2: None > > > > drivers/spi/spi-dw-bt1.c | 23 +++++------------------ > > 1 file changed, 5 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/spi/spi-dw-bt1.c b/drivers/spi/spi-dw-bt1.c > > index 5e1c01822967..5391bcac305c 100644 > > --- a/drivers/spi/spi-dw-bt1.c > > +++ b/drivers/spi/spi-dw-bt1.c > > @@ -269,43 +269,32 @@ static int dw_spi_bt1_probe(struct platform_device *pdev) > > > > dws->paddr = mem->start; > > > > - dwsbt1->clk = devm_clk_get(&pdev->dev, NULL); > > + dwsbt1->clk = devm_clk_get_enabled(&pdev->dev, NULL); > > if (IS_ERR(dwsbt1->clk)) > > return PTR_ERR(dwsbt1->clk); > > > > - ret = clk_prepare_enable(dwsbt1->clk); > > - if (ret) > > - return ret; > > - > > dws->bus_num = pdev->id; > > dws->reg_io_width = 4; > > dws->max_freq = clk_get_rate(dwsbt1->clk); > > - if (!dws->max_freq) { > > - ret = -EINVAL; > > - goto err_disable_clk; > > - } > > + if (!dws->max_freq) > > + return -EINVAL; > > > > init_func = device_get_match_data(&pdev->dev); > > ret = init_func(pdev, dwsbt1); > > if (ret) > > - goto err_disable_clk; > > + return ret; > > > > pm_runtime_enable(&pdev->dev); > > > > ret = dw_spi_add_host(&pdev->dev, dws); > > if (ret) { > > pm_runtime_disable(&pdev->dev); > > - goto err_disable_clk; > > + return ret; > > } > > > > platform_set_drvdata(pdev, dwsbt1); > > > > return 0; > > - > > -err_disable_clk: > > - clk_disable_unprepare(dwsbt1->clk); > > - > > - return ret; > > } > > > > static void dw_spi_bt1_remove(struct platform_device *pdev) > > @@ -315,8 +304,6 @@ static void dw_spi_bt1_remove(struct platform_device *pdev) > > dw_spi_remove_host(&dwsbt1->dws); > > > > pm_runtime_disable(&pdev->dev); > > - > > - clk_disable_unprepare(dwsbt1->clk); > > } > > > > static const struct of_device_id dw_spi_bt1_of_match[] = { > > -- > > 2.34.1 > > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 9CEB5C3DA66 for ; Wed, 23 Aug 2023 17:14:21 +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:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9fuwdFoKYTlTCZP+Isv17x3/B4GCfNlrXrslX3nsX64=; b=0VpitCVToz67n8 YKs2xwWxgLw0mX3utSWN/53kzuxRGRq0lIcTJzq6571iLoG5MiF9YHbzpTaF+0fAJ2jw0f43eWEq/ am2OaafstNHP0T6x51ITywiDcXt1ZxhmhrAlsfC+BHcfNMla6qtxEt+xIP1QvhNsLowV48QFQDx/R eAJ35U7qDLBAeG2S+oGsM/n0YWzIMo+pMkLGvXsJ58J0RrHAxT8ZgZ3n58D7xrWuG6Gs3aAKmXoya VOIGfN64rBlbRBGt6pQxjHtyTSLu8XXPkY8sdcgpIWQVZf2nCc5WcegNFSTI+f64q19bGgqm+BeML AutIO8RB0pHFH8BfmPNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYrQY-001Bw0-2O; Wed, 23 Aug 2023 17:13:54 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYrQU-001BvA-19; Wed, 23 Aug 2023 17:13:52 +0000 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4RWCTW26MVz6HJh9; Thu, 24 Aug 2023 01:13:03 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 23 Aug 2023 18:13:45 +0100 Date: Wed, 23 Aug 2023 18:13:44 +0100 From: Jonathan Cameron To: Serge Semin CC: Li Zetao , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH -next v2 11/25] spi: dw-bt1: Use helper function devm_clk_get_enabled() Message-ID: <20230823181344.000026bd@Huawei.com> In-Reply-To: References: <20230822131237.1022815-1-lizetao1@huawei.com> <20230823133938.1359106-1-lizetao1@huawei.com> <20230823133938.1359106-12-lizetao1@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100004.china.huawei.com (7.191.162.219) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230823_101350_699661_D4482B03 X-CRM114-Status: GOOD ( 25.72 ) 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 On Wed, 23 Aug 2023 17:35:35 +0300 Serge Semin wrote: > On Wed, Aug 23, 2023 at 09:39:24PM +0800, Li Zetao wrote: > > Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared > > and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be > > replaced by devm_clk_get_enabled() when driver enables (and possibly > > prepares) the clocks for the whole lifetime of the device. Moreover, it is > > no longer necessary to unprepare and disable the clocks explicitly. > > > > > Reviewed-by: Jonathan Cameron > > Acked-by: Serge Semin > > Signed-off-by: Li Zetao > > Just for the record, the tags order is normally supposed to reflect a > patch route. Even though AFAICS it's explicitly defined for the Sob > tags only (see Documentation/process/submitting-patches.rst), but > almost all kernel developers apply that rule to all the tags. See the > kernel git log as the brightest example. So your Sob tag should have > been kept first, then either my Ab or Jonathan' Rb tags. There have been far too many discussions about this over the years. There is an argument (I'm not saying I agree with it) that tags given on an earlier version than the one posted should be before the SoB of the author on basis that the SoB is occurring later (as it's on the new version). That is a slightly stronger argument if there are changes to the patch, but then things get inconsistent between patches with minor changes and those without. *sigh* So this pattern is fairly common if a bit weird in my view :) Jonathan > > -Serge(y) > > > --- > > v1 -> v2: None > > > > drivers/spi/spi-dw-bt1.c | 23 +++++------------------ > > 1 file changed, 5 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/spi/spi-dw-bt1.c b/drivers/spi/spi-dw-bt1.c > > index 5e1c01822967..5391bcac305c 100644 > > --- a/drivers/spi/spi-dw-bt1.c > > +++ b/drivers/spi/spi-dw-bt1.c > > @@ -269,43 +269,32 @@ static int dw_spi_bt1_probe(struct platform_device *pdev) > > > > dws->paddr = mem->start; > > > > - dwsbt1->clk = devm_clk_get(&pdev->dev, NULL); > > + dwsbt1->clk = devm_clk_get_enabled(&pdev->dev, NULL); > > if (IS_ERR(dwsbt1->clk)) > > return PTR_ERR(dwsbt1->clk); > > > > - ret = clk_prepare_enable(dwsbt1->clk); > > - if (ret) > > - return ret; > > - > > dws->bus_num = pdev->id; > > dws->reg_io_width = 4; > > dws->max_freq = clk_get_rate(dwsbt1->clk); > > - if (!dws->max_freq) { > > - ret = -EINVAL; > > - goto err_disable_clk; > > - } > > + if (!dws->max_freq) > > + return -EINVAL; > > > > init_func = device_get_match_data(&pdev->dev); > > ret = init_func(pdev, dwsbt1); > > if (ret) > > - goto err_disable_clk; > > + return ret; > > > > pm_runtime_enable(&pdev->dev); > > > > ret = dw_spi_add_host(&pdev->dev, dws); > > if (ret) { > > pm_runtime_disable(&pdev->dev); > > - goto err_disable_clk; > > + return ret; > > } > > > > platform_set_drvdata(pdev, dwsbt1); > > > > return 0; > > - > > -err_disable_clk: > > - clk_disable_unprepare(dwsbt1->clk); > > - > > - return ret; > > } > > > > static void dw_spi_bt1_remove(struct platform_device *pdev) > > @@ -315,8 +304,6 @@ static void dw_spi_bt1_remove(struct platform_device *pdev) > > dw_spi_remove_host(&dwsbt1->dws); > > > > pm_runtime_disable(&pdev->dev); > > - > > - clk_disable_unprepare(dwsbt1->clk); > > } > > > > static const struct of_device_id dw_spi_bt1_of_match[] = { > > -- > > 2.34.1 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel