Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp42816ioo; Fri, 20 May 2022 13:25:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOR2hgCMLKNtpcGFZws7O6IWGBYb6rzsAkziaWIWZbGK2YnN5CBp+O26/s0JOAMyCkW9md X-Received: by 2002:aa7:949c:0:b0:518:16a3:6a26 with SMTP id z28-20020aa7949c000000b0051816a36a26mr11821044pfk.13.1653078353513; Fri, 20 May 2022 13:25:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653078353; cv=none; d=google.com; s=arc-20160816; b=v1HSwv8idGvDeTG1mJ4dFeqHqUV1O3xKz9y3eQbqpmSU886r8/+kMpS3mPl15XhHT+ hTjL+xpMMWwLiT1AFM9s2FV2+PUe+5IUswv7iNdd/ZbMYIIaSMclyKS9i17d0A391K9H jJu7ZyIjL7Z5Os8u/NASfq+ir4Tte+swdIgA6EaAxQLGz9hd5ta4TGdtnUmlefvNXYSw wbKwC9Z0EIiZH+9O9AjOy9kbufFV3abncm/mXGVnmVs/AcCI71s8Yv9S+tQqKsedWTTC rxLL1+zLCptROb29LXQ/rb52HHW23rlvqJotMkFULLT+Y2pntOulNvOKZ4dYNjrwvMHk 3uLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:date:to:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=rJQfl+z1NcGpnXgXpzVG93VJdW9uWPuHickoB/ddx6M=; b=dNXHRDy/M7Tw8h6M+dgf8SWEAAz4K5vy85R7bVld+PQi2qdTNj13P1W8bZHAbChikG ULV7coggtPEAIwLWHLWeegUydgWebrBXEb8bBYi/vSbPTWZ/wgcP/X4oc3wMNefKnI7G ZBTkKN1gTvCB3XZEYLtbc1Jo49EtURkyqmguoHhSrWlCfcCRjasufhFVP+jB2pD4oWzS 7g6UZYCCUQ5Czb4KpJ2YpJvUs+Y6izsOxRnTwQazsUw/3ytVVWgm0FIRczc+A53Co5Nv 6XOBqTX+Pffb7l0/Y0dQEAeXW9VaGEyftl2pyzZ61IQVA6g2e/Qw6vxdM4PvFyO+1gmM /RlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=V+pWojR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m1-20020a170902db0100b00161ae4734d6si685929plx.57.2022.05.20.13.25.21; Fri, 20 May 2022 13:25:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=V+pWojR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239462AbiETAh1 (ORCPT + 99 others); Thu, 19 May 2022 20:37:27 -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> X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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