From patchwork Wed Jan 31 13:09:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1893493 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=hvMMpitJ; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=Jv0tOncy; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=LpG6rEuw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TQ2ST3TXlz23g7 for ; Thu, 1 Feb 2024 00:09:45 +1100 (AEDT) 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZGy4XijmoiaoIRGpKkZ2qf5xpLgWiLXpWfED+RNw/nU=; b=hvMMpitJUPih43 pAsiVklWQhjZvV//B7C7/AG56krxQWPdmUJL14XO8ldcPsnDjYOTFok7+x+JWujjWqHEn2CDEDVF7 UmgT3YLOFKVYHLyritKM0gA+RI6l58Cwxh1/JDXNIUXG40qFO80RUO/JVaXLM1lni9JIewznp4DGL mdFy7TcRdjS57RpakmQx5EVoKvmpB4rLb+8nNy5Tb2jPOuKuV1HldJBxM1q7thEOHLdOcB67hykcU 6Qxw4DinSsnFrzN0v4w6l5Ya/NQFz3/uXYw8mESQeJOc1iQqxpoZX6PnCVQTPCoIXpH3AagB1mOpr nWiOyx3+j7aWsftwSwMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVALS-00000003XbG-35m3; Wed, 31 Jan 2024 13:09:38 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVALE-00000003XS9-1brD for opensbi@lists.infradead.org; Wed, 31 Jan 2024 13:09:35 +0000 From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706706561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3daOGjOJHNMS3EieDvlvEd4HgViuIptdN7Oi+1mtSZo=; b=Jv0tOncyWobW89bHmrdUaA3GK1q7Rs51xBrIItFxFQHUtxnNuGKEYu0hK3/Q71giunTbj2 293MBtwZAaFzlV5jFhhB5AfcM6evle9GwZBMRrV091NoqJI/Qh7d4Z2QDJVi+BcXfE8Y4Q SHCnDDwQB0OJqxKwQ+ZQ8US5qLyCWeEvr9dw3nzLT/iKmbI41gICYqu4gds5CtX3AwWZ4U 8djibZ5nBEJwcCUiljoF6bnt2NOeMYpvgpbQe4SWcP6CSgHdPYznwV+O+SnYdlWxL3YUJ+ NUgZn8LVMYGMLBbxtVmte/18GI2JdD1kcK39ClzjioODrYGGsLumQR3NBUPxPA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706706561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3daOGjOJHNMS3EieDvlvEd4HgViuIptdN7Oi+1mtSZo=; b=LpG6rEuwGc/jb+ZMio0gA5EQGGuwvwfoCQisU23HMJCdLo9/YCUCg6MMUEfg8xezEBhG+4 z5O1tAhfb0AYnqCg== To: opensbi@lists.infradead.org Cc: Nam Cao Subject: [PATCH 1/5] platform: starfive: remove redundant compatibility check in pmic_ops Date: Wed, 31 Jan 2024 14:09:03 +0100 Message-Id: <9e1ba85be2617f7f8d18c08bba7fcdd8e746b6e5.1706705649.git.namcao@linutronix.de> In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240131_050924_650941_FCFA92F2 X-CRM114-Status: UNSURE ( 9.03 ) X-CRM114-Notice: Please train this message. X-Spam-Note: SpamAssassin invocation failed X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org pmic_ops() is only called if a compatible device is found in device tree. It is redundant for this function to check the compability again. Remove this check. Signed-off-by: Nam Cao --- platform/generic/starfive/jh7110.c | 36 ++++++++++++++---------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/platform/generic/starfive/jh7110.c b/platform/generic/starfive/jh7110.c index dcd6306..72969e4 100644 --- a/platform/generic/starfive/jh7110.c +++ b/platform/generic/starfive/jh7110.c @@ -134,28 +134,26 @@ static void pmic_ops(struct pmic *pmic, int type) if (ret) return; - if (!sbi_strcmp("stf,axp15060-regulator", pmic->compatible)) { - ret = i2c_adapter_reg_read(pmic->adapter, pmic->dev_addr, - AXP15060_POWER_REG, &val); - - if (ret) { - sbi_printf("%s: cannot read pmic power register\n", - __func__); - return; - } + ret = i2c_adapter_reg_read(pmic->adapter, pmic->dev_addr, + AXP15060_POWER_REG, &val); + + if (ret) { + sbi_printf("%s: cannot read pmic power register\n", + __func__); + return; + } + val |= AXP15060_POWER_OFF_BIT; + if (type == SBI_SRST_RESET_TYPE_SHUTDOWN) val |= AXP15060_POWER_OFF_BIT; - if (type == SBI_SRST_RESET_TYPE_SHUTDOWN) - val |= AXP15060_POWER_OFF_BIT; - else - val |= AXP15060_RESET_BIT; + else + val |= AXP15060_RESET_BIT; - ret = i2c_adapter_reg_write(pmic->adapter, pmic->dev_addr, - AXP15060_POWER_REG, val); - if (ret) - sbi_printf("%s: cannot write pmic power register\n", - __func__); - } + ret = i2c_adapter_reg_write(pmic->adapter, pmic->dev_addr, + AXP15060_POWER_REG, val); + if (ret) + sbi_printf("%s: cannot write pmic power register\n", + __func__); } static void pmic_i2c_clk_enable(void)