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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F514C433F5 for ; Fri, 20 May 2022 00:37:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344066AbiETAh2 (ORCPT ); Thu, 19 May 2022 20:37:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344057AbiETAh1 (ORCPT ); Thu, 19 May 2022 20:37:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ED6C12FEE7; Thu, 19 May 2022 17:37:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8965661ABD; Fri, 20 May 2022 00:37:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD88EC385AA; Fri, 20 May 2022 00:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653007045; bh=LTTQowMe5fIFG76ASzuMYoCSU9Z8TH3Z9IDQ21ShTMo=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=V+pWojR87D4Tdluo1EBAh/3o6oMjRUB/uTPjQ+4keHDYRbuqZQ+p4ifk5Q+RIUK1R O+CxyOOkdDTSE+TkInjzZykmJAU1wqMSacAnpO2vn7h/smTwGNCs6PWwAV0eINw6Up 5xfm/htovEfTgONomyG2vhCsTGv1FW1J46IrNtht9IXXHjYI9ggNOY/NSVFnc7P+BB hZA9Ns/kuKaqPE79DrCZUo8mC6NhhUPpYwYNMZd8jyuoTVQzO1/zB5hqrig4WX3mgL i0L5eu1ZX87w2lDBBMvPbyOBA8rhCEmt9BLHVfhlCzzpHLbkoDPxrij+NRFMxlYCvl 0PE0hZobAiSvg== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20220519071610.423372-4-wenst@chromium.org> References: <20220519071610.423372-1-wenst@chromium.org> <20220519071610.423372-4-wenst@chromium.org> Subject: Re: [PATCH v3 3/5] clk: mediatek: Replace 'struct clk' with 'struct clk_hw' From: Stephen Boyd Cc: Chen-Yu Tsai , Chun-Jie Chen , Miles Chen , Rex-BC Chen , Matthias Brugger , AngeloGioacchino Del Regno , linux-clk@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org To: Chen-Yu Tsai , Michael Turquette Date: Thu, 19 May 2022 17:37:21 -0700 User-Agent: alot/0.10 Message-Id: <20220520003724.DD88EC385AA@smtp.kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Chen-Yu Tsai (2022-05-19 00:16:08) > As part of the effort to improve the MediaTek clk drivers, the next step > is to switch from the old 'struct clk' clk prodivder APIs to the new > 'struct clk_hw' ones. >=20 > Instead of adding new APIs to the MediaTek clk driver library mirroring > the existing ones, moving all drivers to the new APIs, and then removing > the old ones, just migrate everything at the same time. This involves > replacing 'struct clk' with 'struct clk_hw', and 'struct clk_onecell_data' > with 'struct clk_hw_onecell_data', and fixing up all usages. >=20 > For now, the clk_register() and co. usage is retained, with __clk_get_hw() > and (struct clk_hw *)->clk used to bridge the difference between the APIs. > These will be replaced in subsequent patches. >=20 > Fix up mtk_{alloc,free}_clk_data to use 'struct clk_hw' by hand. Fix up > all other affected call sites with the following coccinelle script. >=20 > // Replace type > @@ > @@ > - struct clk_onecell_data > + struct clk_hw_onecell_data >=20 > // Replace of_clk_add_provider() & of_clk_src_simple_get() > @@ > expression NP, DATA; > symbol of_clk_src_onecell_get; > @@ > - of_clk_add_provider( > + of_clk_add_hw_provider( > NP, > - of_clk_src_onecell_get, > + of_clk_hw_onecell_get, > DATA > ) >=20 > // Fix register/unregister > @@ > identifier CD; > expression E; > identifier fn =3D~ "unregister"; > @@ > fn(..., > - CD->clks[E] > + CD->hws[E]->clk > ,... > ); >=20 > // Fix calls to clk_prepare_enable() > @@ > identifier CD; > expression E; > @@ > clk_prepare_enable( > - CD->clks[E] > + CD->hws[E]->clk > ); >=20 > // Fix pointer assignment > @@ > identifier CD; > identifier CLK; > expression E; > @@ > - CD->clks[E] > + CD->hws[E] > =3D > ( > - CLK > + __clk_get_hw(CLK) > | > ERR_PTR(...) > ) > ; >=20 > // Fix pointer usage > @@ > identifier CD; > expression E; > @@ > - CD->clks[E] > + CD->hws[E] >=20 > // Fix mtk_clk_pll_get_base() > @@ > symbol clk, hw, data; > @@ > mtk_clk_pll_get_base( > - struct clk *clk, > + struct clk_hw *hw, > const struct mtk_pll_data *data > ) { > - struct clk_hw *hw =3D __clk_get_hw(clk); > ... > } >=20 > // Fix mtk_clk_pll_get_base() usage > @@ > identifier CD; > expression E; > @@ > mtk_clk_pll_get_base( > - CD->clks[E] > + CD->hws[E]->clk > ,... > ); >=20 > Signed-off-by: Chen-Yu Tsai > Reviewed-by: AngeloGioacchino Del Regno > Reviewed-by: Miles Chen > Tested-by: AngeloGioacchino Del Regno > Tested-by: Miles Chen > --- Applied to clk-next