From patchwork Sat May 21 15:14:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 575120 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 70941C4332F for ; Sat, 21 May 2022 15:14:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244849AbiEUPOt (ORCPT ); Sat, 21 May 2022 11:14:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245227AbiEUPOr (ORCPT ); Sat, 21 May 2022 11:14:47 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D5E756210 for ; Sat, 21 May 2022 08:14:46 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id br17so6481983lfb.2 for ; Sat, 21 May 2022 08:14:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qCBZ0j+ES0QNdxwqckFAUR3wGLW9E7d1PkVjGCIYt/4=; b=hzG9FNEkMe+dTUP2kJxaSwv6J4SipHrlqe1p0Pz8ZXmAGWn+hH0N4v4EEAzbn0J2Uu cBu9FsyMTQJPIqQYu/pXkch6p/l6hIp9ij9r+IMUaafA73aQ+BjKKq4HQ27HpJ0umSqL oGzyKzOe29KGTLQj8AA6kYJGTapyJKZXJVmb7SNsz++Ra6D697zsfQKMvWL8QG5uR40W Wpyzn2+ZKCfrooPMXbq5WSz/dKbxwiAlpicz7owCMZssQ0FT5DgcXg0tv7zcEjtyKh3T rROuFmfE+mcqNnCmu5fr5hVin2MqHuz1VsSQsqvOZqb4Tmc6fb1r2AejH6prrExiu0bx XZVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qCBZ0j+ES0QNdxwqckFAUR3wGLW9E7d1PkVjGCIYt/4=; b=0nd4TBQTuA1mOzi7pjQ7jRi8PxHRIjhzgckJV6hW7Dvu3DTTiLhXC23FR3FvDhBWLC 5DiTdZ7hr84mj8tOAVBjmNdx5z5chUBDgpgYNEHBUDtzuFFIs8g7LFt9+t9ZV5IbEUGx ru5uoNsBigA2J/Pf3cpKPSW6fqUbtr7vNAa+bqmx/3/HRlz7BQAMkV47hpGJeXGNOCSL f3RmBnC3RckbWv5lYq/gAVusKeKPiaNwZy1Y47wAp429xuzTth3yqojbFAvD7K8COZHy quvOEw0tzNhERLtsi31dQuQy0MuMKm25RvGRDylsOLsmkKk1ISmVQjUCNJmEqu3swSAe we9A== X-Gm-Message-State: AOAM533yygyCa2gTmSz0aLab+kFuHz++F0+6xPiNdE7653aqMRPyKaZw hq3/p1JLrCO7DzLKMkkgXvjo4b4d5DnlFw== X-Google-Smtp-Source: ABdhPJx/0yIIyAnQHBUfRGiVS5yqAF9VpDKkIoDrjdRFBF0oNiDlId4enthaB42ekdhjApUQ+KHZww== X-Received: by 2002:a19:f818:0:b0:472:3d96:bd2d with SMTP id a24-20020a19f818000000b004723d96bd2dmr10647863lff.329.1653146084762; Sat, 21 May 2022 08:14:44 -0700 (PDT) Received: from eriador.lumag.spb.ru ([94.25.229.156]) by smtp.gmail.com with ESMTPSA id v22-20020a2e7a16000000b0024f3d1daedfsm716849ljc.103.2022.05.21.08.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 08:14:44 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Stephen Boyd , Michael Turquette , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v6 3/4] clk: qcom: gcc-msm8960: create tsens device if there are no child nodes Date: Sat, 21 May 2022 18:14:36 +0300 Message-Id: <20220521151437.1489111-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220521151437.1489111-1-dmitry.baryshkov@linaro.org> References: <20220521151437.1489111-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Currently gcc-msm8960 driver manually creates tsens platform device manually. It would be better to follow IPQ8064 approach, where tsens device is defined as gcc's child device in the device tree. If nothing else, it removes gcc's dependency on QFPROM, thus allowing clock controller to be probed earlier. Don't create it in case there are available child nodes (tsens) inside the gcc's device tree node. Signed-off-by: Dmitry Baryshkov --- drivers/clk/qcom/gcc-msm8960.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/gcc-msm8960.c b/drivers/clk/qcom/gcc-msm8960.c index 051745ef99c8..a6e13b91e4c8 100644 --- a/drivers/clk/qcom/gcc-msm8960.c +++ b/drivers/clk/qcom/gcc-msm8960.c @@ -3641,6 +3641,9 @@ static int gcc_msm8960_probe(struct platform_device *pdev) hfpll_l2.d = &hfpll_l2_8064_data; } + if (of_get_available_child_count(pdev->dev.of_node) != 0) + return devm_of_platform_populate(&pdev->dev); + tsens = platform_device_register_data(&pdev->dev, "qcom-tsens", -1, NULL, 0); if (IS_ERR(tsens)) @@ -3655,7 +3658,8 @@ static int gcc_msm8960_remove(struct platform_device *pdev) { struct platform_device *tsens = platform_get_drvdata(pdev); - platform_device_unregister(tsens); + if (tsens) + platform_device_unregister(tsens); return 0; }