Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp680348yba; Thu, 9 May 2019 04:28:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeCQpd7qRAmGu8xVrrRwF7GkadmNKX53nmMb+oY6kho3cLKZ5SsuDs7OSBqZioVZcb5zfB X-Received: by 2002:a62:ac0a:: with SMTP id v10mr4291922pfe.57.1557401280254; Thu, 09 May 2019 04:28:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557401280; cv=none; d=google.com; s=arc-20160816; b=zx4/kJUFSiBJKyAXaEpaoJly0JVmRHn5yBShVy3bRWV1UCZcqVUK348T4gIJ8VH9bu 27zZoWOpvMUrGQ3m7IRvKQ+iDz7DuCrMlgL8kVpYpFgimen//08tsWYgaYOCUqEnLHDW eBHBWaAHMMWJNSxxZ7erJ5sRyV34NBeKfagA6l7cO3a84IWY3fg5E8Psi5IAZQTnqwxH WS3upjL4k/mqjWGVvM8iSkkK749l+e/xLzfzxl0zsm3r+HUMW0cTq5Wdorgfa8MTeEEn ztaiyHOpwz8008NmzV+oixUjRfLtIrn9xsWL2GZJ2mfPjdufxb+XVmhNW4aOgFeVUfRT PUtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Qu8EFyx1RYwBMH9ABcsp970ZpeO13Jjnq3l+ZsRNLGc=; b=IMIkmRm4OCxZcIjf2Tsa6boKrp9/RyN68GKldu0+Xk54MitpqH4RhYnoKFvyw1mQj6 5RWfppNUIwjig5pT+VEivnu4qkhJcVNmWK4UGWnrw8aTU2Bf7zVYaf1T+gyYg+UvYCFD fAe9zAFjhm4vMUeU/LtlvBY5Sqv4di4KR9Zk4Ry9H+MWO2NilCz/lIqGgV7CHe5CXews lbckaVA4CCuhmurgYyKnfuHOMCbcHCf6iSdI4neHN+uLU1E4C/8jwOi76mnl7xaIcOhb 6MhaO/Vv9IdaVgV5m3LG3oeOaDtaBRmtS7YipVZ46dMQiZE2Nu7Hat3QxER46OtR24Va 4zEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="L/h96bMy"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a39si2560752pla.0.2019.05.09.04.27.44; Thu, 09 May 2019 04:28:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="L/h96bMy"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726438AbfEILZi (ORCPT + 99 others); Thu, 9 May 2019 07:25:38 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:38995 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726054AbfEILZh (ORCPT ); Thu, 9 May 2019 07:25:37 -0400 Received: by mail-wr1-f66.google.com with SMTP id w8so97890wrl.6 for ; Thu, 09 May 2019 04:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=Qu8EFyx1RYwBMH9ABcsp970ZpeO13Jjnq3l+ZsRNLGc=; b=L/h96bMyP4sbfcIes0jd00888NxzJqfZrZyAIQk+hnercmv4rlnZBs1Ozw0nXgpQbH tHIaIe7AF0o/yekpCa3uhSI2FB34IFkmRKnrx8qztyD9W0mmHcNYUirjZAwPD77Zyys+ bQigGcpAhNAaqn3J6gMNpmrfgL1U1eQeeD83Yhy9TxLsl2b0+NhTmqawG0DwqwOEse5O jZoIGkE1YbXPr4nkYHLgWJml1mJokBdlmqO100AkpaQW9gHvDEvSieYlsO0s9KHtcDwo +V4Px+FfauqUTn3ekAcP6Er12scd77+WYDvFae8j8CqLzeIr91KXkddsIrt4xIhjYGmc idrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Qu8EFyx1RYwBMH9ABcsp970ZpeO13Jjnq3l+ZsRNLGc=; b=kIvsWniziGVS1ZrUW9jKmSQ73Dc3zHdXRS4MXkuuqKoajVooPCCbqMQE6fRxCNWCo9 vlBl+6Q5KXKDCj8ISmUW+luA+6LL6e4+TCibJ+pCyeJ654IwQwds+bmC70ZIQsrcrRd7 u/UHp1isz7B/93GBjFjji9/0LbK9H/MkqbVUFZseXN+qV+7uNXYXMeMyqQWbnS5PCROT KiGdDLFIfXo/wy/3v5m0L/vhJlmIfoEt7h+afYAox8jn/XLMmAPucJb0X2In7dD1YMK7 94CwMI9Z+gjUAUH1hDrva4lqJWKGYPHXOYDFtYmLeDmeoQefg/h4XE0cad0+1OaNlsbI rTUw== X-Gm-Message-State: APjAAAUy7pcE27P8K43xc3KcpNTikyezP8YRpR+wzVBdz5dIuSlVL8OZ G2/WoMT+/1PS7+a3eJpqQ2puZg== X-Received: by 2002:adf:9cc8:: with SMTP id h8mr2586136wre.308.1557401135633; Thu, 09 May 2019 04:25:35 -0700 (PDT) Received: from ?IPv6:2a01:cb1d:379:8b00:1910:6694:7019:d3a? ([2a01:cb1d:379:8b00:1910:6694:7019:d3a]) by smtp.gmail.com with ESMTPSA id d6sm2079136wrp.9.2019.05.09.04.25.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 May 2019 04:25:34 -0700 (PDT) Subject: Re: [PATCH v3 4/6] pinctrl: meson: Rework enable/disable bias part To: Martin Blumenstingl Cc: linus.walleij@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, khilman@baylibre.com, linux-gpio@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20190507115726.23714-1-glaroque@baylibre.com> <20190507115726.23714-5-glaroque@baylibre.com> From: guillaume La Roque Message-ID: Date: Thu, 9 May 2019 13:25:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hi Martin, same as previous patch i will do a new serie with your comments. On 5/7/19 7:53 PM, Martin Blumenstingl wrote: > Hi Guillaume, > > On Tue, May 7, 2019 at 1:57 PM Guillaume La Roque wrote: >> rework bias enable/disable part to prepare drive-strength integration > if it was my patch I would add "no functional changes" at the end to > make it explicit that this only changes the structure of the code. > >> Signed-off-by: Guillaume La Roque > with the minor comments from below addressed: > Reviewed-by: Martin Blumenstingl > >> --- >> drivers/pinctrl/meson/pinctrl-meson.c | 79 ++++++++++++++++----------- >> 1 file changed, 48 insertions(+), 31 deletions(-) >> >> diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c >> index 96a4a72708e4..a216a7537564 100644 >> --- a/drivers/pinctrl/meson/pinctrl-meson.c >> +++ b/drivers/pinctrl/meson/pinctrl-meson.c >> @@ -174,13 +174,57 @@ int meson_pmx_get_groups(struct pinctrl_dev *pcdev, unsigned selector, >> return 0; >> } >> >> +static int meson_pinconf_disable_bias(struct meson_pinctrl *pc, >> + unsigned int pin) >> +{ >> + struct meson_bank *bank; >> + unsigned int reg, bit = 0; >> + int ret; >> + >> + ret = meson_get_bank(pc, pin, &bank); >> + if (ret) >> + return ret; > add an empty line here to keep it consistent with the rest of the code > > [...] >> static int meson_pinconf_set(struct pinctrl_dev *pcdev, unsigned int pin, >> unsigned long *configs, unsigned num_configs) >> { >> struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); >> struct meson_bank *bank; > bank is not read anymore (it's passed to meson_get_bank to set it, but > then it's not read, which is probably why my compiler doesn't > complain) > >> enum pin_config_param param; >> - unsigned int reg, bit; >> int i, ret; >> >> ret = meson_get_bank(pc, pin, &bank); >> @@ -192,44 +236,17 @@ static int meson_pinconf_set(struct pinctrl_dev *pcdev, unsigned int pin, >> >> switch (param) { >> case PIN_CONFIG_BIAS_DISABLE: >> - dev_dbg(pc->dev, "pin %u: disable bias\n", pin); >> - >> - meson_calc_reg_and_bit(bank, pin, REG_PULLEN, ®, >> - &bit); >> - ret = regmap_update_bits(pc->reg_pullen, reg, >> - BIT(bit), 0); >> + ret = meson_pinconf_disable_bias(pc, pin); >> if (ret) >> return ret; >> break; >> case PIN_CONFIG_BIAS_PULL_UP: >> - dev_dbg(pc->dev, "pin %u: enable pull-up\n", pin); >> - >> - meson_calc_reg_and_bit(bank, pin, REG_PULLEN, >> - ®, &bit); >> - ret = regmap_update_bits(pc->reg_pullen, reg, >> - BIT(bit), BIT(bit)); >> - if (ret) >> - return ret; >> - >> - meson_calc_reg_and_bit(bank, pin, REG_PULL, ®, &bit); >> - ret = regmap_update_bits(pc->reg_pull, reg, >> - BIT(bit), BIT(bit)); >> + ret = meson_pinconf_enable_bias(pc, pin, 1); > use "true" instead of "1"? > >> if (ret) >> return ret; >> break; >> case PIN_CONFIG_BIAS_PULL_DOWN: >> - dev_dbg(pc->dev, "pin %u: enable pull-down\n", pin); >> - >> - meson_calc_reg_and_bit(bank, pin, REG_PULLEN, >> - ®, &bit); >> - ret = regmap_update_bits(pc->reg_pullen, reg, >> - BIT(bit), BIT(bit)); >> - if (ret) >> - return ret; >> - >> - meson_calc_reg_and_bit(bank, pin, REG_PULL, ®, &bit); >> - ret = regmap_update_bits(pc->reg_pull, reg, >> - BIT(bit), 0); >> + ret = meson_pinconf_enable_bias(pc, pin, 0); > use "false" instead of "0"? > > one overall comment: thank you for working on this! > in my opinion it's a good preparation step to ensure that > meson_pinconf_set is easy to understand even if we add more > functionality here > > > Regards > Martin guillaume