Message ID | 20240104-phy-qcom-eusb2-repeater-fixes-v1-2-047b7b6b8333@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-16807-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5656892dyb; Thu, 4 Jan 2024 06:53:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/7oVA5VqRoQUW5uCayRJ1ZAUeXZQbm2Kyo6d7mmgPxs3eN503Gifuh0pRv0ej4DdUx/zT X-Received: by 2002:a05:6a20:12c3:b0:196:1b3a:139b with SMTP id v3-20020a056a2012c300b001961b3a139bmr696156pzg.0.1704379995750; Thu, 04 Jan 2024 06:53:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704379995; cv=none; d=google.com; s=arc-20160816; b=KVP6fFkyLpmQhjZ4bH6di65J3u7UBsjMO4TKltejO30tFRt/Ea8n0VFYRTSwU0FilE bNHiiS1HtmvgcMLo/21E4Di7z2VIAOR9aperfpTYv8pRxtI2BhROZUFYJz2f6z8RXT/0 C0zzr9MShWSgCnOxmrxjwMJ7uejWJE00b4SRHNiKUzILIWNU/2uVuS1IvL5UemqLB6H6 5GElGXVUn4Bby0Jvc3HLzM+LDJNAPGbSufzdOBoscHFVwXkmqgU1y27FfXczGaUM56yf y+CYBFbSRuDQxsqDzEazI/jx8r6yT3SNDaQSwcw43iRxPwP/IytkEaTWeJlG8xBybrdJ Q5gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=XMnAxGfIQiueQAO1wNW7BfacgEmomUHtgI56o8wKSTE=; fh=yh+D4SlPqbCucm6NVc/TddKPUVVdkKY8ckTJs2u/4aU=; b=Dx9J7YnrkDRnGwF3r8DbF20c37/sYWeYAlbYjMl9KgbngifwS7beC+X2hsa319SaJE q5ZpRvtonRq1fLRfeFsI/6xL7rCgOHbwrOUHLUOU2Wdw0FmgabbvzKNoNTPzetW0x6eV 2MOcF4D7rdYyqEpIbN2MjuYJU9lGWELULu1lb/NYTV+MNCAYhXIxw9ezR+fNyYygvLul KBQmrANq/m9N4Tl1yhFNXiAoyzB/MPMEtNvfWa18uT/4hLq31gUiZbmCHJY8CThEO4tv VOwb0BOlZmU4F1TPeEceHSXzfIQBFu8i/0DJMEf/6cC9AlUH6WGrKm0KBHN9vg21/BQN lPfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NiiynNiA; spf=pass (google.com: domain of linux-kernel+bounces-16807-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16807-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p21-20020a635b15000000b005cd84895879si24402145pgb.789.2024.01.04.06.53.15 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 06:53:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16807-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NiiynNiA; spf=pass (google.com: domain of linux-kernel+bounces-16807-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16807-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6A8DA286A6B for <ouuuleilei@gmail.com>; Thu, 4 Jan 2024 14:53:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71A7924217; Thu, 4 Jan 2024 14:52:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NiiynNiA" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 620BE2376D for <linux-kernel@vger.kernel.org>; Thu, 4 Jan 2024 14:52:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-556ab8b85e3so976015a12.1 for <linux-kernel@vger.kernel.org>; Thu, 04 Jan 2024 06:52:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704379949; x=1704984749; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XMnAxGfIQiueQAO1wNW7BfacgEmomUHtgI56o8wKSTE=; b=NiiynNiA3Eay6BKt3cpSbKLlds4Wk1/7Vsh9mBxzi8ux7VcshaF/nnTCx41XmFAApu OTalK9K/bYogtJlzGrbjEfSjOZW9ycMy3xlsjsXcUCYOe/CypY7PMWdRkpgZlzSpCNyL oBdU82H6TTZSMEY0zdsGODT2LyBrBKjZgK3OOYG3dP7wMTNehQI0uZ2uYmi9fKmCiJHb MbftYPf5SDZr9uQesQJ+ZpSK67+CNDfwLcFZqtL+D3f1A/ujKAisK4sXkdZF/EEW0APM Hsi1kRQNPtAsyL6iLFT/vFmmIMoaRniJXxBZpjL+Wgej040NLQxsdz/yk03nVFC3Jooc 4Q1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704379949; x=1704984749; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XMnAxGfIQiueQAO1wNW7BfacgEmomUHtgI56o8wKSTE=; b=M+GFFPTrGuwS7c+Aw6nQpziMkcGfQ3fyTw7rOKrzx/uCkbd8l26qAjfseINgbVCt6n 0zMcikhkR+kwXcjLrUVHT6yCCZG4Oz3eW9qZKZElu7vLgRxeYuGTo6chMHbCvOnDQasQ qBaFvLSElTVmEQNCe3lcOW/P7CJeEUwbiYcH0u0bErQrYpkVoZFt5awfDvJAHE1Xs/dq SATj1v3N5hl/0DcVol2iTK2Z5+ZmetZObT3viVzL/YJ8skPnT3ZrGc8Koz38J9Ainmr+ /owUoa8zSHTvtixBNBhZ+2G9HYif7gssR/FRi5TvirzmKAIt2+4TKpc+mUXWqCAVd3jI O+lw== X-Gm-Message-State: AOJu0YzTIh8ZUUEobtUXaoN1CQ7zku1hd8rNDozhKcpRYAzWe2r1JRaO H1FZA3OXl5o/1VI1Hlw7ikZJfDxdJPRiV4wzrcFkKnzQPAw= X-Received: by 2002:a50:9b54:0:b0:556:e101:535 with SMTP id a20-20020a509b54000000b00556e1010535mr827944edj.37.1704379949460; Thu, 04 Jan 2024 06:52:29 -0800 (PST) Received: from [127.0.1.1] ([79.115.23.25]) by smtp.gmail.com with ESMTPSA id k24-20020a056402049800b00555e52fed52sm7970592edv.91.2024.01.04.06.52.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 06:52:29 -0800 (PST) From: Abel Vesa <abel.vesa@linaro.org> Date: Thu, 04 Jan 2024 16:52:12 +0200 Subject: [PATCH 2/2] phy: qualcomm: eusb2-repeater: Drop the redundant zeroing Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240104-phy-qcom-eusb2-repeater-fixes-v1-2-047b7b6b8333@linaro.org> References: <20240104-phy-qcom-eusb2-repeater-fixes-v1-0-047b7b6b8333@linaro.org> In-Reply-To: <20240104-phy-qcom-eusb2-repeater-fixes-v1-0-047b7b6b8333@linaro.org> To: Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Vinod Koul <vkoul@kernel.org>, Kishon Vijay Abraham I <kishon@kernel.org> Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Abel Vesa <abel.vesa@linaro.org> X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1320; i=abel.vesa@linaro.org; h=from:subject:message-id; bh=7AliMaAdWROGg3fLvttKSstNZBNXuERKP+7k1vLYxm4=; b=owEBbQKS/ZANAwAKARtfRMkAlRVWAcsmYgBllsYpqEYuM2KFJzq7R2FAgGA1XjlIL61uSTuld ETLicqGGsiJAjMEAAEKAB0WIQRO8+4RTnqPKsqn0bgbX0TJAJUVVgUCZZbGKQAKCRAbX0TJAJUV VkEmEAChX0fzzAbkg03l5iDp/SItTko3VZiDt+fJiOAGDqb7RIzW/6ArWDo/rAuhn2wZB/27VKe Y9i+hnWURv+aQRwNm5QWPYTVo0v8HL+PndukPgbiFMW4muElu+5haOTMvRNz3hlZpVKPbGI8uq5 AdhIR9bDhMgZ0QSjVTHYUJ5WbdXk8Rnrz2eGfFh7Rski5mwZ/ohmdLZpfKo+Yo00ifhCZnydKQP yjnXj3pvKMecr5pv+XTcDm03VV0FUz5kTCS4nohhfvOxx9Uaw6UoTh4qYZIMmUNLg3TV8vgQxrK ykUXwjoToQ1v/53g1z55TuC49hZ5E//K8zhJUuzBnVeY0XrTnd0ANFna1+wdGxROhmuDAOynmC2 pqPZqohLa8xDZsjQdhSk26YGbCsSZnXEOOpsbg6JiuTQHdSM9D9Vms72w8Tw42HYD3UTp4/aDDC L3Sjar4ix9hnLqz6UJXit/z9ImfZ2JBaj0ukTGLbPRsJ83eT9F4nYm+I8CyuoQ5koZh8PbkvdRb hrIwocC3wdlw8IvuddLdX8DW6gnflCONLYAmpceXCtT6baaWRlTjm43hFmzDbpT4cy1Fm7uXWMI Md0oThk0u7OHeRUJCFE1dlRqzkZIDoliMWbPo2LGr8212BBNsHplafdVeMCUUxrNo9wP+I7rWHX tMfpJMiu+mZjgsw== X-Developer-Key: i=abel.vesa@linaro.org; a=openpgp; fpr=6AFF162D57F4223A8770EF5AF7BF214136F41FAE X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787171958339291700 X-GMAIL-MSGID: 1787171958339291700 |
Series |
phy: qualcomm: eusb2-repeater: Some fixes after the regmap rework
|
|
Commit Message
Abel Vesa
Jan. 4, 2024, 2:52 p.m. UTC
The local init_tlb is already zero initialized, so the entire zeroing loop
is useless in this case, since the initial values are copied over anyway,
before being written.
Fixes: 99a517a582fc ("phy: qualcomm: phy-qcom-eusb2-repeater: Zero out untouched tuning regs")
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
---
drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c | 10 ----------
1 file changed, 10 deletions(-)
Comments
On 4.01.2024 15:52, Abel Vesa wrote: > The local init_tlb is already zero initialized, so the entire zeroing loop > is useless in this case, since the initial values are copied over anyway, > before being written. > > Fixes: 99a517a582fc ("phy: qualcomm: phy-qcom-eusb2-repeater: Zero out untouched tuning regs") > Signed-off-by: Abel Vesa <abel.vesa@linaro.org> > --- That's another good spot.. partial struct initialization of pm8550b_init_tbl zeroes out the uninitialized fields. > drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c | 10 ---------- > 1 file changed, 10 deletions(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c > index 5f5862a68b73..3060c0749797 100644 > --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c > +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c > @@ -156,16 +156,6 @@ static int eusb2_repeater_init(struct phy *phy) > > regmap_field_update_bits(rptr->regs[F_EN_CTL1], EUSB2_RPTR_EN, EUSB2_RPTR_EN); > > - for (i = 0; i < F_NUM_TUNE_FIELDS; i++) { > - if (init_tbl[i]) { > - regmap_field_update_bits(rptr->regs[i], init_tbl[i], init_tbl[i]); > - } else { > - /* Write 0 if there's no value set */ > - u32 mask = GENMASK(regfields[i].msb, regfields[i].lsb); > - > - regmap_field_update_bits(rptr->regs[i], mask, 0); > - } > - } > memcpy(init_tbl, rptr->cfg->init_tbl, sizeof(init_tbl)); I think this patchset can be made even better, this memcpy is also useless and we can simply initialize init_tbl=rptr->cfg->init_tbl. Konrad
On 24-01-04 23:50:48, Konrad Dybcio wrote: > On 4.01.2024 15:52, Abel Vesa wrote: > > The local init_tlb is already zero initialized, so the entire zeroing loop > > is useless in this case, since the initial values are copied over anyway, > > before being written. > > > > Fixes: 99a517a582fc ("phy: qualcomm: phy-qcom-eusb2-repeater: Zero out untouched tuning regs") > > Signed-off-by: Abel Vesa <abel.vesa@linaro.org> > > --- > > That's another good spot.. partial struct initialization of > pm8550b_init_tbl zeroes out the uninitialized fields. > > > > drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c | 10 ---------- > > 1 file changed, 10 deletions(-) > > > > diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c > > index 5f5862a68b73..3060c0749797 100644 > > --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c > > +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c > > @@ -156,16 +156,6 @@ static int eusb2_repeater_init(struct phy *phy) > > > > regmap_field_update_bits(rptr->regs[F_EN_CTL1], EUSB2_RPTR_EN, EUSB2_RPTR_EN); > > > > - for (i = 0; i < F_NUM_TUNE_FIELDS; i++) { > > - if (init_tbl[i]) { > > - regmap_field_update_bits(rptr->regs[i], init_tbl[i], init_tbl[i]); > > - } else { > > - /* Write 0 if there's no value set */ > > - u32 mask = GENMASK(regfields[i].msb, regfields[i].lsb); > > - > > - regmap_field_update_bits(rptr->regs[i], mask, 0); > > - } > > - } > > memcpy(init_tbl, rptr->cfg->init_tbl, sizeof(init_tbl)); > > I think this patchset can be made even better, this memcpy is also > useless and we can simply initialize init_tbl=rptr->cfg->init_tbl. Actually no. The init_tbl in cfg is a pointer to const. Plus, if you do that, you will end up with the same situation like in the other patch, as there are some overrides based on DT values below this. But now that I've had another look, maybe doing the exact same thing as the other patch does (kmemdup) will probably look better anyway, specially if we do that on probe. > > Konrad
On 5.01.2024 10:16, Abel Vesa wrote: > On 24-01-04 23:50:48, Konrad Dybcio wrote: >> On 4.01.2024 15:52, Abel Vesa wrote: >>> The local init_tlb is already zero initialized, so the entire zeroing loop >>> is useless in this case, since the initial values are copied over anyway, >>> before being written. >>> >>> Fixes: 99a517a582fc ("phy: qualcomm: phy-qcom-eusb2-repeater: Zero out untouched tuning regs") >>> Signed-off-by: Abel Vesa <abel.vesa@linaro.org> >>> --- >> >> That's another good spot.. partial struct initialization of >> pm8550b_init_tbl zeroes out the uninitialized fields. >> >> >>> drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c | 10 ---------- >>> 1 file changed, 10 deletions(-) >>> >>> diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c >>> index 5f5862a68b73..3060c0749797 100644 >>> --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c >>> +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c >>> @@ -156,16 +156,6 @@ static int eusb2_repeater_init(struct phy *phy) >>> >>> regmap_field_update_bits(rptr->regs[F_EN_CTL1], EUSB2_RPTR_EN, EUSB2_RPTR_EN); >>> >>> - for (i = 0; i < F_NUM_TUNE_FIELDS; i++) { >>> - if (init_tbl[i]) { >>> - regmap_field_update_bits(rptr->regs[i], init_tbl[i], init_tbl[i]); >>> - } else { >>> - /* Write 0 if there's no value set */ >>> - u32 mask = GENMASK(regfields[i].msb, regfields[i].lsb); >>> - >>> - regmap_field_update_bits(rptr->regs[i], mask, 0); >>> - } >>> - } >>> memcpy(init_tbl, rptr->cfg->init_tbl, sizeof(init_tbl)); >> >> I think this patchset can be made even better, this memcpy is also >> useless and we can simply initialize init_tbl=rptr->cfg->init_tbl. > > Actually no. The init_tbl in cfg is a pointer to const. Plus, if you do > that, you will end up with the same situation like in the other patch, > as there are some overrides based on DT values below this. Hm, you're right. Maybe we should simple store *base and stop modifying these tables then. There's not a whole lot of regmap_rw calls, so making the first argument "rptr->base + rptr->regs[ASDF]" shouldn't add much fluff. Then we can make the cfg referernce const. Konrad > > But now that I've had another look, maybe doing the exact same thing as > the other patch does (kmemdup) will probably look better anyway, > specially if we do that on probe. > >> >> Konrad
On 24-01-05 11:09:33, Konrad Dybcio wrote: > On 5.01.2024 10:16, Abel Vesa wrote: > > On 24-01-04 23:50:48, Konrad Dybcio wrote: > >> On 4.01.2024 15:52, Abel Vesa wrote: > >>> The local init_tlb is already zero initialized, so the entire zeroing loop > >>> is useless in this case, since the initial values are copied over anyway, > >>> before being written. > >>> > >>> Fixes: 99a517a582fc ("phy: qualcomm: phy-qcom-eusb2-repeater: Zero out untouched tuning regs") > >>> Signed-off-by: Abel Vesa <abel.vesa@linaro.org> > >>> --- > >> > >> That's another good spot.. partial struct initialization of > >> pm8550b_init_tbl zeroes out the uninitialized fields. > >> > >> > >>> drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c | 10 ---------- > >>> 1 file changed, 10 deletions(-) > >>> > >>> diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c > >>> index 5f5862a68b73..3060c0749797 100644 > >>> --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c > >>> +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c > >>> @@ -156,16 +156,6 @@ static int eusb2_repeater_init(struct phy *phy) > >>> > >>> regmap_field_update_bits(rptr->regs[F_EN_CTL1], EUSB2_RPTR_EN, EUSB2_RPTR_EN); > >>> > >>> - for (i = 0; i < F_NUM_TUNE_FIELDS; i++) { > >>> - if (init_tbl[i]) { > >>> - regmap_field_update_bits(rptr->regs[i], init_tbl[i], init_tbl[i]); > >>> - } else { > >>> - /* Write 0 if there's no value set */ > >>> - u32 mask = GENMASK(regfields[i].msb, regfields[i].lsb); > >>> - > >>> - regmap_field_update_bits(rptr->regs[i], mask, 0); > >>> - } > >>> - } > >>> memcpy(init_tbl, rptr->cfg->init_tbl, sizeof(init_tbl)); > >> > >> I think this patchset can be made even better, this memcpy is also > >> useless and we can simply initialize init_tbl=rptr->cfg->init_tbl. > > > > Actually no. The init_tbl in cfg is a pointer to const. Plus, if you do > > that, you will end up with the same situation like in the other patch, > > as there are some overrides based on DT values below this. > > Hm, you're right. Maybe we should simple store *base and stop > modifying these tables then. There's not a whole lot of regmap_rw > calls, so making the first argument "rptr->base + rptr->regs[ASDF]" > shouldn't add much fluff. Then we can make the cfg referernce const. > Oh, sorry, did not see your reply in time before sending v2. Have a look at v2 and we can decide if we want something different then. https://lore.kernel.org/all/20240105-phy-qcom-eusb2-repeater-fixes-v2-0-775d98e7df05@linaro.org/ Thanks for reviewing. > Konrad > > > > > But now that I've had another look, maybe doing the exact same thing as > > the other patch does (kmemdup) will probably look better anyway, > > specially if we do that on probe. > > > >> > >> Konrad
Hi Abel,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 0fef202ac2f8e6d9ad21aead648278f1226b9053]
url: https://github.com/intel-lab-lkp/linux/commits/Abel-Vesa/phy-qualcomm-eusb2-repeater-Fix-the-regfields-for-multiple-instances/20240104-225513
base: 0fef202ac2f8e6d9ad21aead648278f1226b9053
patch link: https://lore.kernel.org/r/20240104-phy-qcom-eusb2-repeater-fixes-v1-2-047b7b6b8333%40linaro.org
patch subject: [PATCH 2/2] phy: qualcomm: eusb2-repeater: Drop the redundant zeroing
config: i386-buildonly-randconfig-004-20240106 (https://download.01.org/0day-ci/archive/20240107/202401070143.pnnuXAwC-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240107/202401070143.pnnuXAwC-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401070143.pnnuXAwC-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c: In function 'eusb2_repeater_init':
>> drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c:145:20: warning: unused variable 'regfields' [-Wunused-variable]
struct reg_field *regfields = rptr->regfields;
^~~~~~~~~
vim +/regfields +145 drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
56d77c9a10d97d Abel Vesa 2023-02-08 141
56d77c9a10d97d Abel Vesa 2023-02-08 142 static int eusb2_repeater_init(struct phy *phy)
56d77c9a10d97d Abel Vesa 2023-02-08 143 {
56d77c9a10d97d Abel Vesa 2023-02-08 144 struct eusb2_repeater *rptr = phy_get_drvdata(phy);
ac0aae0074102c Abel Vesa 2024-01-04 @145 struct reg_field *regfields = rptr->regfields;
56156a76e765d3 Konrad Dybcio 2023-09-13 146 struct device_node *np = rptr->dev->of_node;
56156a76e765d3 Konrad Dybcio 2023-09-13 147 u32 init_tbl[F_NUM_TUNE_FIELDS] = { 0 };
56156a76e765d3 Konrad Dybcio 2023-09-13 148 u8 override;
56d77c9a10d97d Abel Vesa 2023-02-08 149 u32 val;
56d77c9a10d97d Abel Vesa 2023-02-08 150 int ret;
56d77c9a10d97d Abel Vesa 2023-02-08 151 int i;
56d77c9a10d97d Abel Vesa 2023-02-08 152
56d77c9a10d97d Abel Vesa 2023-02-08 153 ret = regulator_bulk_enable(rptr->cfg->num_vregs, rptr->vregs);
56d77c9a10d97d Abel Vesa 2023-02-08 154 if (ret)
56d77c9a10d97d Abel Vesa 2023-02-08 155 return ret;
56d77c9a10d97d Abel Vesa 2023-02-08 156
4ba2e52718c0ce Konrad Dybcio 2023-09-13 157 regmap_field_update_bits(rptr->regs[F_EN_CTL1], EUSB2_RPTR_EN, EUSB2_RPTR_EN);
56d77c9a10d97d Abel Vesa 2023-02-08 158
56156a76e765d3 Konrad Dybcio 2023-09-13 159 memcpy(init_tbl, rptr->cfg->init_tbl, sizeof(init_tbl));
56156a76e765d3 Konrad Dybcio 2023-09-13 160
56156a76e765d3 Konrad Dybcio 2023-09-13 161 if (!of_property_read_u8(np, "qcom,tune-usb2-amplitude", &override))
56156a76e765d3 Konrad Dybcio 2023-09-13 162 init_tbl[F_TUNE_IUSB2] = override;
56156a76e765d3 Konrad Dybcio 2023-09-13 163
56156a76e765d3 Konrad Dybcio 2023-09-13 164 if (!of_property_read_u8(np, "qcom,tune-usb2-disc-thres", &override))
56156a76e765d3 Konrad Dybcio 2023-09-13 165 init_tbl[F_TUNE_HSDISC] = override;
56156a76e765d3 Konrad Dybcio 2023-09-13 166
56156a76e765d3 Konrad Dybcio 2023-09-13 167 if (!of_property_read_u8(np, "qcom,tune-usb2-preem", &override))
56156a76e765d3 Konrad Dybcio 2023-09-13 168 init_tbl[F_TUNE_USB2_PREEM] = override;
56156a76e765d3 Konrad Dybcio 2023-09-13 169
56156a76e765d3 Konrad Dybcio 2023-09-13 170 for (i = 0; i < F_NUM_TUNE_FIELDS; i++)
56156a76e765d3 Konrad Dybcio 2023-09-13 171 regmap_field_update_bits(rptr->regs[i], init_tbl[i], init_tbl[i]);
56d77c9a10d97d Abel Vesa 2023-02-08 172
4ba2e52718c0ce Konrad Dybcio 2023-09-13 173 ret = regmap_field_read_poll_timeout(rptr->regs[F_RPTR_STATUS],
4ba2e52718c0ce Konrad Dybcio 2023-09-13 174 val, val & RPTR_OK, 10, 5);
56d77c9a10d97d Abel Vesa 2023-02-08 175 if (ret)
56d77c9a10d97d Abel Vesa 2023-02-08 176 dev_err(rptr->dev, "initialization timed-out\n");
56d77c9a10d97d Abel Vesa 2023-02-08 177
56d77c9a10d97d Abel Vesa 2023-02-08 178 return ret;
56d77c9a10d97d Abel Vesa 2023-02-08 179 }
56d77c9a10d97d Abel Vesa 2023-02-08 180
diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c index 5f5862a68b73..3060c0749797 100644 --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c @@ -156,16 +156,6 @@ static int eusb2_repeater_init(struct phy *phy) regmap_field_update_bits(rptr->regs[F_EN_CTL1], EUSB2_RPTR_EN, EUSB2_RPTR_EN); - for (i = 0; i < F_NUM_TUNE_FIELDS; i++) { - if (init_tbl[i]) { - regmap_field_update_bits(rptr->regs[i], init_tbl[i], init_tbl[i]); - } else { - /* Write 0 if there's no value set */ - u32 mask = GENMASK(regfields[i].msb, regfields[i].lsb); - - regmap_field_update_bits(rptr->regs[i], mask, 0); - } - } memcpy(init_tbl, rptr->cfg->init_tbl, sizeof(init_tbl)); if (!of_property_read_u8(np, "qcom,tune-usb2-amplitude", &override))