Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp802640rwb; Wed, 28 Sep 2022 09:15:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5buhpfPIwgXNa3GDmxOgOXJHcG0jn/feTmqMDVDurbZFClndhdF8QOXu6NeGmapZdCVPQg X-Received: by 2002:a17:906:9bf5:b0:77e:1ed1:b1b with SMTP id de53-20020a1709069bf500b0077e1ed10b1bmr28683752ejc.540.1664381731065; Wed, 28 Sep 2022 09:15:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664381731; cv=none; d=google.com; s=arc-20160816; b=eattlNJZmb/rgyvE76y7x7CkrwVRLegMQ8uxGAFVioXyoS+3CD+cp1mhS5Zk/Xwo1B dPaWfdA4Uc5Lnwc3D++QVm09ovyG2+/Sr3zzI7g/jfXgcJfQTGIG6gOxRkTpStB8ic6d 1rC4piZD3PuvtLqB/7RPRU2ahoTeE7LDdOMl1Y3a7UmDCJ0h0csE9NazqFxLVkFhkHNK nsDKyMYAqXySv07JJzYO3832Djn5+tOP/Zxr8YWeWfRl79BjvucSqefKqbkac5v42So4 zx38zTzc8i4b/IjihJD4YiuuvkBUorN+mETs0StSOkTdNCr4FsUrmHqSg/P/RzS0pEm3 hKVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=T4xS6dOHr4z0YsifDp9KCrL2DjcqUvRiDEeBLlpwdcA=; b=eEvV3+IAKZvnBxa3vEZ0x2L7uOtPWgXjD5XXpV9uOYe2e952ARX9RyY5WriJm2lwbA QvzBh14ZEwnzas05UaU1YZQ6tYHDnFAOW8bqh/0IEragMfOilHD+JukjJJhXT4IEjbdU qk6cqBOeEL23zShxuZNcH86dhTwSDQtShFEKUqX8H0tK3DhL0NwIagrGM+j4LVA2eMoq 9FcRtFaeGNVDe0/91OCDCjgZ0n0NWzLO+HvKkOfRdJwMXijW9g682JXJ7Kvmqn6qSxIC U8Y99o+RLG0ZSAM3LeNVB8auwo6ZjmLrmmCZHA3Fr/Ykx3VaBp3lRt8PWdtDkt8qTwOK Eaig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CDTZayab; 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 nb10-20020a1709071c8a00b007830db346bfsi5939828ejc.62.2022.09.28.09.15.04; Wed, 28 Sep 2022 09:15:31 -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=CDTZayab; 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 S234259AbiI1P4P (ORCPT + 99 others); Wed, 28 Sep 2022 11:56:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234345AbiI1Pzl (ORCPT ); Wed, 28 Sep 2022 11:55:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E3938E455 for ; Wed, 28 Sep 2022 08:55:38 -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 096A461F12 for ; Wed, 28 Sep 2022 15:55:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80E0BC43470; Wed, 28 Sep 2022 15:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664380537; bh=YZMOjgTNeBBMbRzzxRhwTWgxRv9J8huLdzYrUxYy2S4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CDTZayabU/ZeTorlu4hi7Ad/PKqFked91GfMFoXSllA3SeMtQaU+YzGhjmRVAGfSp xSno8AB6nUj95qOxUEEyFCvOGXSmkp9ephJUkm7/MH1Nqr9DjX22PRaT/Bbx+HcUmO hRwQjJpRAl+/ghXII+VmJFuqmHeJ+Ot6ARqj9AAt5Qq/CZnUZudi2NIgm+9krrc9sj uAKfSHUCL0aY1fl75gOTzeYNW/zn+GtC+HrlfD719WNPXnKHGLpqmO2ADQDKW91pTi 38xCscCcrUoW2agjtQMPNJH/Y0GfikiztG/Ymqr6vmdo6/ER2/necguZMEWhFDLhLX ePuAzGMgqdbKg== From: matthias.bgg@kernel.org To: roger.lu@mediatek.com, jia-wei.chang@mediatek.com Cc: nfraprado@collabora.com, khilman@baylibre.com, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, angelogioacchino.delregno@collabora.com, Matthias Brugger Subject: [PATCH 4/8] soc: mediatek: mtk-svs: delete superfluous platform data entries Date: Wed, 28 Sep 2022 17:55:15 +0200 Message-Id: <20220928155519.31977-5-matthias.bgg@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928155519.31977-1-matthias.bgg@kernel.org> References: <20220928155519.31977-1-matthias.bgg@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 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 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 From: Matthias Brugger The platform name and efuse parsing function pointer are only used while probing the device. Use them from the svs_platform_data struct instead. Signed-off-by: Matthias Brugger --- drivers/soc/mediatek/mtk-svs.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c index 8342627f8dea..482cc8d7e7cf 100644 --- a/drivers/soc/mediatek/mtk-svs.c +++ b/drivers/soc/mediatek/mtk-svs.c @@ -311,14 +311,12 @@ static const u32 svs_regs_v2[] = { /** * struct svs_platform - svs platform control - * @name: svs platform name * @base: svs platform register base * @dev: svs platform device * @main_clk: main clock for svs bank * @pbank: svs bank pointer needing to be protected by spin_lock section * @banks: svs banks that svs platform supports * @rst: svs platform reset control - * @efuse_parsing: svs platform efuse parsing function pointer * @efuse_max: total number of svs efuse * @tefuse_max: total number of thermal efuse * @regs: svs platform registers map @@ -327,14 +325,12 @@ static const u32 svs_regs_v2[] = { * @tefuse: thermal efuse data received from NVMEM framework */ struct svs_platform { - char *name; void __iomem *base; struct device *dev; struct clk *main_clk; struct svs_bank *pbank; struct svs_bank *banks; struct reset_control *rst; - bool (*efuse_parsing)(struct svs_platform *svsp); size_t efuse_max; size_t tefuse_max; const u32 *regs; @@ -2009,7 +2005,7 @@ static bool svs_is_efuse_data_correct(struct svs_platform *svsp) svsp->efuse_max /= sizeof(u32); nvmem_cell_put(cell); - return svsp->efuse_parsing(svsp); + return true; } static struct device *svs_get_subsys_device(struct svs_platform *svsp, @@ -2338,9 +2334,7 @@ static int svs_probe(struct platform_device *pdev) return -ENOMEM; svsp->dev = &pdev->dev; - svsp->name = svsp_data->name; svsp->banks = svsp_data->banks; - svsp->efuse_parsing = svsp_data->efuse_parsing; svsp->regs = svsp_data->regs; svsp->bank_max = svsp_data->bank_max; @@ -2351,6 +2345,12 @@ static int svs_probe(struct platform_device *pdev) if (!svs_is_efuse_data_correct(svsp)) { dev_notice(svsp->dev, "efuse data isn't correct\n"); ret = -EPERM; + goto svs_probe_free_efuse; + } + + if (!svsp_data->efuse_parsing(svsp)) { + dev_notice(svsp->dev, "efuse data parsing failed\n"); + ret = -EPERM; goto svs_probe_free_resource; } @@ -2367,7 +2367,7 @@ static int svs_probe(struct platform_device *pdev) } ret = devm_request_threaded_irq(svsp->dev, svsp_irq, NULL, svs_isr, - IRQF_ONESHOT, svsp->name, svsp); + IRQF_ONESHOT, svsp_data->name, svsp); if (ret) { dev_err(svsp->dev, "register irq(%d) failed: %d\n", svsp_irq, ret); @@ -2416,11 +2416,13 @@ static int svs_probe(struct platform_device *pdev) clk_disable_unprepare(svsp->main_clk); svs_probe_free_resource: - if (!IS_ERR_OR_NULL(svsp->efuse)) - kfree(svsp->efuse); if (!IS_ERR_OR_NULL(svsp->tefuse)) kfree(svsp->tefuse); +svs_probe_free_efuse: + if (!IS_ERR_OR_NULL(svsp->efuse)) + kfree(svsp->efuse); + return ret; } -- 2.37.3