Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2403898iof; Wed, 8 Jun 2022 04:22:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYDVPwipyppFXB5lWZ6koodjvZJXbJpl2i09QBkYgJvETQ6GjVKtM8ifWCMeH6fYz/yR+E X-Received: by 2002:a05:6a00:14cb:b0:51c:3f31:b60e with SMTP id w11-20020a056a0014cb00b0051c3f31b60emr7562946pfu.27.1654687333872; Wed, 08 Jun 2022 04:22:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654687333; cv=none; d=google.com; s=arc-20160816; b=MZNXRUvCwwlRwrigHqXLPrrlnVsZ3TMRHCJ+EraYVK9MCbr3lOVxITKUkcSZBLOeGV jP9n9QayXYwsRrbMsaoJsL1r8NexIbIYooMzRGkaDotMm7KVOegdxPQhk/F3XZQLVIt5 kqnTJvpvvkOrEhM4XejRxI3zkp2ZAXKRCzrhfaJ9nkyYKt9QE+S8v1SxhA691LfaLFUd 0ngUBvL9L1eNv6mhlanCgfes+1oOKsCDOKLH52rVxTcFeLSG0uTuB/iDcOMcLvWNFmnD pCfpVjKezwMrcfxZ5JM//mJa2OzmwAm8+rvt2L0+HgNBwOdazBVF9tDEg1UXNVhi+fUK Az+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=QzmXENU7s14JgyqydKEh7VchsTErwIFffsmGrZ6wfH4=; b=CEC9GBp6IqzeG4XTV/mjADqn5bP+32tYRv0IuMD6L0BFWwMyXxt3GfEJlnjICxymZO 3ulWVJYlj8TG3+7wfhva9VIkRrH4SQ4Sa3ZWggvnJvh94mfZU/Ne2bebcue6Ygnc93AL Mz2DJg1SlSNauvybfAm8K5TaHTofh5Ba5xi8vgvy+IrNdnzaT2n6ggkbtOo1RHO0dklN PCATbuY/MLGM+0IvLcMcsfxXSpA2zRUwCb8cpjQFddJIQInIsV0hdrem4Tux0L+/r5bY Ud5Wyx9lIpuFStKVzVsfQWUEvG6JEf9nnOyto3EupWowXTXbOy0mRqp+Xe5QSKxTB1ym gmjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@postmarketos.org header.s=donut header.b=Fq+3VF03; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i64-20020a638743000000b003fdcbced657si5160408pge.860.2022.06.08.04.22.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 04:22:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@postmarketos.org header.s=donut header.b=Fq+3VF03; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6A01F13D2D; Wed, 8 Jun 2022 03:44:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237172AbiFHKoZ (ORCPT + 99 others); Wed, 8 Jun 2022 06:44:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236870AbiFHKoY (ORCPT ); Wed, 8 Jun 2022 06:44:24 -0400 X-Greylist: delayed 599 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 08 Jun 2022 03:44:22 PDT Received: from proxmox1.postmarketos.org (proxmox1.postmarketos.org [IPv6:2a01:4f8:a0:821d::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 315A812D172; Wed, 8 Jun 2022 03:44:22 -0700 (PDT) Received: from [192.168.0.33] (cpc78119-cwma10-2-0-cust590.7-3.cable.virginm.net [81.96.50.79]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by proxmox1.postmarketos.org (Postfix) with ESMTPSA id B972514009C; Wed, 8 Jun 2022 10:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=postmarketos.org; s=donut; t=1654683902; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QzmXENU7s14JgyqydKEh7VchsTErwIFffsmGrZ6wfH4=; b=Fq+3VF03/b5siWKm7/IKQFQyJc2S1qH0JEok+wV9QQIVPgAKmWf1a1lw7PIn/6cdDtVZqm FdPYSRzyW938m4/98+1qf9YIIrN3cvdRjbhU1jtWYctNKXpdtfMJn5SGJO/E9aoSFDqdMq AqqbyY3AiT8UU8FpO+7Np3oI/M/EuWo= Message-ID: Date: Wed, 8 Jun 2022 11:25:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH 5.18 579/879] pinctrl/rockchip: support deferring other gpio params Content-Language: en-US To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Linus Walleij , Sasha Levin References: <20220607165002.659942637@linuxfoundation.org> <20220607165019.660801561@linuxfoundation.org> From: Caleb Connolly In-Reply-To: <20220607165019.660801561@linuxfoundation.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Hi Greg, This commit contains a bug which was fixed in commit 42d90a1e5caf ("pinctrl/rockchip: support setting input-enable param") It uses bitwise OR to check non-bitwise values (see below). On 07/06/2022 18:01, Greg Kroah-Hartman wrote: > From: Caleb Connolly > > [ Upstream commit 8ce5ef64546850294b021497046588a7abcebe96 ] > > Add support for deferring other params like PIN_CONFIG_INPUT_ENABLE. > This will be used to add support for PIN_CONFIG_INPUT_ENABLE to the > driver. > > Fixes: e7165b1dff06 ("pinctrl/rockchip: add a queue for deferred pin output settings on probe") > Fixes: 59dd178e1d7c ("gpio/rockchip: fetch deferred output settings on probe") > Signed-off-by: Caleb Connolly > Link: https://lore.kernel.org/r/20220328005005.72492-2-kc@postmarketos.org > Signed-off-by: Linus Walleij > Signed-off-by: Sasha Levin > --- > drivers/gpio/gpio-rockchip.c | 24 ++++++++----- > drivers/pinctrl/pinctrl-rockchip.c | 54 ++++++++++++++++-------------- > drivers/pinctrl/pinctrl-rockchip.h | 7 ++-- > 3 files changed, 50 insertions(+), 35 deletions(-) [snip] > @@ -2143,6 +2144,25 @@ static int rockchip_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, > param = pinconf_to_config_param(configs[i]); > arg = pinconf_to_config_argument(configs[i]); > > + if (param == (PIN_CONFIG_OUTPUT | PIN_CONFIG_INPUT_ENABLE)) { Should be if (param == PIN_CONFIG_OUTPUT || param == PIN_CONFIG_INPUT_ENABLE) { > + /* > + * Check for gpio driver not being probed yet. > + * The lock makes sure that either gpio-probe has completed > + * or the gpio driver hasn't probed yet. > + */ > + mutex_lock(&bank->deferred_lock); > + if (!gpio || !gpio->direction_output) { > + rc = rockchip_pinconf_defer_pin(bank, pin - bank->pin_base, param, > + arg); > + mutex_unlock(&bank->deferred_lock); > + if (rc) > + return rc; > + > + break; > + } > + mutex_unlock(&bank->deferred_lock); > + } > + > switch (param) { > case PIN_CONFIG_BIAS_DISABLE: > rc = rockchip_set_pull(bank, pin - bank->pin_base, > @@ -2171,22 +2191,6 @@ static int rockchip_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, > if (rc != RK_FUNC_GPIO) > return -EINVAL; > > - /* > - * Check for gpio driver not being probed yet. > - * The lock makes sure that either gpio-probe has completed > - * or the gpio driver hasn't probed yet. > - */ > - mutex_lock(&bank->deferred_lock); > - if (!gpio || !gpio->direction_output) { > - rc = rockchip_pinconf_defer_output(bank, pin - bank->pin_base, arg); > - mutex_unlock(&bank->deferred_lock); > - if (rc) > - return rc; > - > - break; > - } > - mutex_unlock(&bank->deferred_lock); > - > rc = gpio->direction_output(gpio, pin - bank->pin_base, > arg); > if (rc) > @@ -2500,7 +2504,7 @@ static int rockchip_pinctrl_register(struct platform_device *pdev, > pdesc++; > } > > - INIT_LIST_HEAD(&pin_bank->deferred_output); > + INIT_LIST_HEAD(&pin_bank->deferred_pins); > mutex_init(&pin_bank->deferred_lock); > } > > @@ -2763,7 +2767,7 @@ static int rockchip_pinctrl_remove(struct platform_device *pdev) > { > struct rockchip_pinctrl *info = platform_get_drvdata(pdev); > struct rockchip_pin_bank *bank; > - struct rockchip_pin_output_deferred *cfg; > + struct rockchip_pin_deferred *cfg; > int i; > > of_platform_depopulate(&pdev->dev); > @@ -2772,9 +2776,9 @@ static int rockchip_pinctrl_remove(struct platform_device *pdev) > bank = &info->ctrl->pin_banks[i]; > > mutex_lock(&bank->deferred_lock); > - while (!list_empty(&bank->deferred_output)) { > - cfg = list_first_entry(&bank->deferred_output, > - struct rockchip_pin_output_deferred, head); > + while (!list_empty(&bank->deferred_pins)) { > + cfg = list_first_entry(&bank->deferred_pins, > + struct rockchip_pin_deferred, head); > list_del(&cfg->head); > kfree(cfg); > } > diff --git a/drivers/pinctrl/pinctrl-rockchip.h b/drivers/pinctrl/pinctrl-rockchip.h > index 91f10279d084..98a01a616da6 100644 > --- a/drivers/pinctrl/pinctrl-rockchip.h > +++ b/drivers/pinctrl/pinctrl-rockchip.h > @@ -171,7 +171,7 @@ struct rockchip_pin_bank { > u32 toggle_edge_mode; > u32 recalced_mask; > u32 route_mask; > - struct list_head deferred_output; > + struct list_head deferred_pins; > struct mutex deferred_lock; > }; > > @@ -247,9 +247,12 @@ struct rockchip_pin_config { > unsigned int nconfigs; > }; > > -struct rockchip_pin_output_deferred { > +enum pin_config_param; > + > +struct rockchip_pin_deferred { > struct list_head head; > unsigned int pin; > + enum pin_config_param param; > u32 arg; > }; >