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 23447C4332F for ; Mon, 26 Dec 2022 07:05:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231673AbiLZHFX (ORCPT ); Mon, 26 Dec 2022 02:05:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231557AbiLZHFT (ORCPT ); Mon, 26 Dec 2022 02:05:19 -0500 Received: from mail-vs1-xe2a.google.com (mail-vs1-xe2a.google.com [IPv6:2607:f8b0:4864:20::e2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AEAA25C6 for ; Sun, 25 Dec 2022 23:05:17 -0800 (PST) Received: by mail-vs1-xe2a.google.com with SMTP id i188so9663601vsi.8 for ; Sun, 25 Dec 2022 23:05:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=soa+SAFtKAZ0dT0XWd2urT+evcY34HAipQoZWgmMXbE=; b=AVkrZP9oZ8T5y66+Ca0o04Gd8v5/nPQ6wdjf01cJZw8AOtLBp2xbVGTc+6FIsZe+/4 asslmG7k7JHTzM7dCd4zA3ZFkilt8rsQ7sdIU9bsWaAp3BJ6gKoIWHvNEnoA831efiuz sygRl9HVWNwI99H8FztedcqzRHZVGNhPlepx4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=soa+SAFtKAZ0dT0XWd2urT+evcY34HAipQoZWgmMXbE=; b=3vqaRrWucW5F60ajjR5wPYC+Y7JaxzY4yDe6qwlfcUOfrGKR/Hb6Ob9tXyjoduMN0V 0vhLrP9QLoRAiV02tzQksw/UwfFgZLVm/K/YjBx2AVTeQvt32iJQfplaNtPDP8FLir8G V0OISRDcTJPBA5rENjK+5Rz3i4ctd4I10Ts6FJN5FZHfpB2fa5NFv6akrswhJwQS2ExI 4k0rocYnNvqFJSbGN4dpCWJDXMQ0xZlxnwdwhbSuXT7Q1WkTlNKg2onIyJCfD2XeuaYB vw/9Srwjw8YMtpTtpofQAqyn9YzxGEwDTNEpwzA/MtWbSM/fEApBVcA7gVGePRbKtCeJ mGVg== X-Gm-Message-State: AFqh2koZykIup8XFMacmSrbUMwTfbolQwwjnojoEgNMZF8ysfAq1IMJh LuR9YfOT/hqTx3jTD507KmSk4iWpn01t17ik1nhx7g== X-Google-Smtp-Source: AMrXdXsgQsNveB+g3fxLQ8RqpmCH85x9K4V8BIWAdTWcIummB2ZNtDC+Ulay47RwMG6g7adIPRyBPkhBwZ2aDQ6FwOo= X-Received: by 2002:a05:6102:74b:b0:3ad:3d65:22b with SMTP id v11-20020a056102074b00b003ad3d65022bmr2396976vsg.65.1672038316696; Sun, 25 Dec 2022 23:05:16 -0800 (PST) MIME-Version: 1.0 References: <20221223094259.87373-1-angelogioacchino.delregno@collabora.com> <20221223094259.87373-4-angelogioacchino.delregno@collabora.com> In-Reply-To: <20221223094259.87373-4-angelogioacchino.delregno@collabora.com> From: Chen-Yu Tsai Date: Mon, 26 Dec 2022 15:05:05 +0800 Message-ID: Subject: Re: [PATCH v2 03/23] clk: mediatek: clk-gate: Propagate struct device with mtk_clk_register_gates() To: AngeloGioacchino Del Regno Cc: mturquette@baylibre.com, sboyd@kernel.org, matthias.bgg@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, johnson.wang@mediatek.com, miles.chen@mediatek.com, fparent@baylibre.com, chun-jie.chen@mediatek.com, sam.shih@mediatek.com, y.oudjana@protonmail.com, nfraprado@collabora.com, rex-bc.chen@mediatek.com, ryder.lee@kernel.org, daniel@makrotopia.org, jose.exposito89@gmail.com, yangyingliang@huawei.com, pablo.sun@mediatek.com, msp@baylibre.com, weiyi.lu@mediatek.com, ikjn@chromium.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, kernel@collabora.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 23, 2022 at 5:43 PM AngeloGioacchino Del Regno wrote: > > Commit e4c23e19aa2a ("clk: mediatek: Register clock gate with device") > introduces a helper function for the sole purpose of propagating a > struct device pointer to the clk API when registering the mtk-gate > clocks to take advantage of Runtime PM when/where needed and where > a power domain is defined in devicetree. > > Function mtk_clk_register_gates() then becomes a wrapper around the > new mtk_clk_register_gates_with_dev() function that will simply pass > NULL as struct device: this is essential when registering drivers > with CLK_OF_DECLARE instead of as a platform device, as there will > be no struct device to pass... but we can as well simply have only > one function that always takes such pointer as a param and pass NULL > when unavoidable. > > This commit removes the mtk_clk_register_gates() wrapper and renames > mtk_clk_register_gates_with_dev() to the former and all of the calls > to either of the two functions were fixed in all drivers in order to > reflect this change. > > Since a lot of MediaTek clock drivers are actually registering as a > platform device, but were still registering the mtk-gate clocks > without passing any struct device to the clock framework, they've > been changed to pass a valid one now, as to make all those platforms > able to use runtime power management where available. > > Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai However, I wonder if we could move the |struct device *| paramter to be the first one? This matches other APIs better, notably the clk_register() family. Regards ChenYu 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 32C1FC4332F for ; Mon, 26 Dec 2022 07:06:15 +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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ohYuR8VSMbjjoYqQqJJJB2UwQ+K2Jpc27rJDAGGo9iQ=; b=h+wyGGfl1ExuM1 0f+PTDHevGiS6wBHqnHh0ZptKXHXz3bU4s+UvgR2KbEiMrAW4zWwJmy6lELCq3Phw1Kl06yamHAhe JqGbwSLafrgwA1/6AaUMmLJ0GNX+a79V5Mt/u4WOpst8cg24EpQDR3W1565KK9CcDZZZkeUlXXFh5 kKmll3yrNVYK7WZ7OBv+I0wO9EV5Yp8DB3YOy7MLM2m7E+XJX/ITTx3Nb+sFSf9Gdd/n3rX2/rUuM wr598bDIyCIjCeyVHYj2gTk1ZMeJvTiJia8BE7bVBTUxysbphCaqprs2cfRyfuJrof8cZ/RubjGf9 38+iZZlPzGXoFSlRX78A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p9hY3-002RUP-0J; Mon, 26 Dec 2022 07:05:23 +0000 Received: from mail-vs1-xe2f.google.com ([2607:f8b0:4864:20::e2f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p9hXz-002RSu-OX for linux-arm-kernel@lists.infradead.org; Mon, 26 Dec 2022 07:05:21 +0000 Received: by mail-vs1-xe2f.google.com with SMTP id 3so9649323vsq.7 for ; Sun, 25 Dec 2022 23:05:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=soa+SAFtKAZ0dT0XWd2urT+evcY34HAipQoZWgmMXbE=; b=AVkrZP9oZ8T5y66+Ca0o04Gd8v5/nPQ6wdjf01cJZw8AOtLBp2xbVGTc+6FIsZe+/4 asslmG7k7JHTzM7dCd4zA3ZFkilt8rsQ7sdIU9bsWaAp3BJ6gKoIWHvNEnoA831efiuz sygRl9HVWNwI99H8FztedcqzRHZVGNhPlepx4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=soa+SAFtKAZ0dT0XWd2urT+evcY34HAipQoZWgmMXbE=; b=jqQyLEE3h5zkotqGC+uEwkIenqtVBlJC/fXQDM9aVZSPbmsp80U6SSX7EFdLH11tI3 81UJS13owHLQ3aAW5wlfXENZ4pVnfJ6c+IBBhL0nd/B9yOTWeEG3w2EBzX8UbBMbKqUI kH4h5VHUN4vARHm9GTKgtOKUKNWk1xIMto5oRSdWomT2bLiX6VHG6rkoe5upqlFc9NtX EHsIWOkINQ+/iMDlzX7/QIug0ZeKAYh8TjWoLGY0bOCmVPLVrb0YlSppUzGDcgyBB0NW VcXAJNyJJKzk+smvqC4ErfR/gla9iAlJaHhbkMVrSjNX/yFBLDc6NrWuEBu9527/Nzvv xv6Q== X-Gm-Message-State: AFqh2kp6NyGUg/5R2VqEEiz8f5lExlRz4GZwznwpuM8veIVxvIvEgv+M Ec6GZVyqJevLt6gKdgH7Cth0o9LjhQWmReGnoN4bTPat0sc/G/tj X-Google-Smtp-Source: AMrXdXsgQsNveB+g3fxLQ8RqpmCH85x9K4V8BIWAdTWcIummB2ZNtDC+Ulay47RwMG6g7adIPRyBPkhBwZ2aDQ6FwOo= X-Received: by 2002:a05:6102:74b:b0:3ad:3d65:22b with SMTP id v11-20020a056102074b00b003ad3d65022bmr2396976vsg.65.1672038316696; Sun, 25 Dec 2022 23:05:16 -0800 (PST) MIME-Version: 1.0 References: <20221223094259.87373-1-angelogioacchino.delregno@collabora.com> <20221223094259.87373-4-angelogioacchino.delregno@collabora.com> In-Reply-To: <20221223094259.87373-4-angelogioacchino.delregno@collabora.com> From: Chen-Yu Tsai Date: Mon, 26 Dec 2022 15:05:05 +0800 Message-ID: Subject: Re: [PATCH v2 03/23] clk: mediatek: clk-gate: Propagate struct device with mtk_clk_register_gates() To: AngeloGioacchino Del Regno Cc: mturquette@baylibre.com, sboyd@kernel.org, matthias.bgg@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, johnson.wang@mediatek.com, miles.chen@mediatek.com, fparent@baylibre.com, chun-jie.chen@mediatek.com, sam.shih@mediatek.com, y.oudjana@protonmail.com, nfraprado@collabora.com, rex-bc.chen@mediatek.com, ryder.lee@kernel.org, daniel@makrotopia.org, jose.exposito89@gmail.com, yangyingliang@huawei.com, pablo.sun@mediatek.com, msp@baylibre.com, weiyi.lu@mediatek.com, ikjn@chromium.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, kernel@collabora.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221225_230519_880926_1E7B71F9 X-CRM114-Status: GOOD ( 17.70 ) 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 Fri, Dec 23, 2022 at 5:43 PM AngeloGioacchino Del Regno wrote: > > Commit e4c23e19aa2a ("clk: mediatek: Register clock gate with device") > introduces a helper function for the sole purpose of propagating a > struct device pointer to the clk API when registering the mtk-gate > clocks to take advantage of Runtime PM when/where needed and where > a power domain is defined in devicetree. > > Function mtk_clk_register_gates() then becomes a wrapper around the > new mtk_clk_register_gates_with_dev() function that will simply pass > NULL as struct device: this is essential when registering drivers > with CLK_OF_DECLARE instead of as a platform device, as there will > be no struct device to pass... but we can as well simply have only > one function that always takes such pointer as a param and pass NULL > when unavoidable. > > This commit removes the mtk_clk_register_gates() wrapper and renames > mtk_clk_register_gates_with_dev() to the former and all of the calls > to either of the two functions were fixed in all drivers in order to > reflect this change. > > Since a lot of MediaTek clock drivers are actually registering as a > platform device, but were still registering the mtk-gate clocks > without passing any struct device to the clock framework, they've > been changed to pass a valid one now, as to make all those platforms > able to use runtime power management where available. > > Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai However, I wonder if we could move the |struct device *| paramter to be the first one? This matches other APIs better, notably the clk_register() family. Regards ChenYu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel