Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1753616pxm; Thu, 24 Feb 2022 08:44:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxc+YKla3Z4Pr+6LxwPvnSWsU3vtWlZ1u3LPO6+c1jOSATSDbg+WstgC3RoG1vHsF4vW9JX X-Received: by 2002:a17:902:ef4c:b0:14f:7548:dae3 with SMTP id e12-20020a170902ef4c00b0014f7548dae3mr3398716plx.92.1645721097679; Thu, 24 Feb 2022 08:44:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645721097; cv=none; d=google.com; s=arc-20160816; b=AeU+iEertA5/gi7AUuO9B3FfrYMuzM8JFdtrh1zzcRaEc0EKakLPhTVj7ccPc2DiyZ wAPhAlUnuys6D2TmAoHuUWTY1DKIGUjmY4zA+AzRQ3J02CYQxRfysWlk6DB3E/XBPGYZ PPuxyjJy1E/mWumT3p5suW5fkpk43Z+NJJoRx0XXCa/zFxQlyz597+htqL8RoDLlX1zE qWxcpHqHg5RA139ex+k0bWVMzZnM0l6yuBsRfu6eDG92rm9D+2PxVsDxU14/KHjjGiIJ 8Bqs0GSkTm2Xk8aaKKzOZl9LewGmYXqzkHY8URrz5aDxroRSiX4ko7lbtxX5NZeuqfzL hqcQ== 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=Qzw+kR2qzAEtlrrCdkWu8sUT4TvXDm0xnydMaXN0U6I=; b=cG8xeOm6UaeFLQdRVlog5iAaXPo/rkySXFi9DpT6WVkxJH9H6aaCiy9yBzXUOd0GlM PQr3BzNo6FieeK9xpBZmeu7F/N1M4WX5EEtFatUN1JMAfZsK/Kasc7KCK0lfdJBS+Evb Vu/YiouJkmVXTbIKEf9odyJObLRkIhIvd9sN00BTVSPME40UlA3R17dpMHG8EJ3a/UV3 Rvv/VU29VSul/kCLMqf7B8RPEaMi8akvi66518jtRy3q0PKHQOMjix+tCCZSMIlE0i7z CWAvosjWWXZHPMmBvl5w04h6iO9WeN87kDD+v3S9GvOsVO5TVwD/WR1YH8MOlfNracUU 81bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=rgRn87md; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k12si3049252pgt.254.2022.02.24.08.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 08:44:57 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=rgRn87md; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 854C92036C9; Thu, 24 Feb 2022 08:24:15 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229784AbiBXQNG (ORCPT + 99 others); Thu, 24 Feb 2022 11:13:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbiBXQM6 (ORCPT ); Thu, 24 Feb 2022 11:12:58 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A04158EA6; Thu, 24 Feb 2022 08:12:21 -0800 (PST) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id EB69B223F0; Thu, 24 Feb 2022 17:10:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1645719039; 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=Qzw+kR2qzAEtlrrCdkWu8sUT4TvXDm0xnydMaXN0U6I=; b=rgRn87mdvKSuqxmhsGaWcf7Uf3NdGYh6yH3fe42Upqfdo2lZ7dVCykpvyiYS52bdkFSbJo sngrLJo8PI5OTdD4wn6JUvHSyJdMaqEekj1n7KeZVfEoEYffzAIKVFang0iEeisQTvZu3d k85bfMdb7FxfYBfCv3AjSXt3Zh2HZ5Y= From: Michael Walle To: Lars Povlsen , Steen Hegelund , Linus Walleij Cc: UNGLinuxDriver@microchip.com, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Colin Foster , Michael Walle Subject: [PATCH v1 4/5] pinctrl: microchip-sgpio: return error in spgio_output_set() Date: Thu, 24 Feb 2022 17:10:20 +0100 Message-Id: <20220224161021.2197263-5-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220224161021.2197263-1-michael@walle.cc> References: <20220224161021.2197263-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Make sgpio_output_set() return an error value. Don't just ignore the return value of any regmap access but propagate it to our callers. Even if the accesses never fail, this is a preparation patch to add single shot mode where we need to poll a bit and thus we might get -ETIMEDOUT. Signed-off-by: Michael Walle --- drivers/pinctrl/pinctrl-microchip-sgpio.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index f01ca94943da..3f3b8c482f3a 100644 --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c @@ -225,9 +225,9 @@ static inline void sgpio_configure_clock(struct sgpio_priv *priv, u32 clkfrq) sgpio_clrsetbits(priv, REG_SIO_CLOCK, 0, clr, set); } -static void sgpio_output_set(struct sgpio_priv *priv, - struct sgpio_port_addr *addr, - int value) +static int sgpio_output_set(struct sgpio_priv *priv, + struct sgpio_port_addr *addr, + int value) { unsigned int bit = SGPIO_SRC_BITS * addr->bit; u32 clr, set; @@ -246,10 +246,12 @@ static void sgpio_output_set(struct sgpio_priv *priv, set = FIELD_PREP(SGPIO_SPARX5_BIT_SOURCE, value << bit); break; default: - return; + return -EINVAL; } sgpio_clrsetbits(priv, REG_PORT_CONFIG, addr->port, clr, set); + + return 0; } static int sgpio_output_get(struct sgpio_priv *priv, @@ -335,7 +337,7 @@ static int sgpio_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, case PIN_CONFIG_OUTPUT: if (bank->is_input) return -EINVAL; - sgpio_output_set(priv, &addr, arg); + err = sgpio_output_set(priv, &addr, arg); break; default: @@ -475,9 +477,7 @@ static int microchip_sgpio_direction_output(struct gpio_chip *gc, sgpio_pin_to_addr(priv, gpio, &addr); - sgpio_output_set(priv, &addr, value); - - return 0; + return sgpio_output_set(priv, &addr, value); } static int microchip_sgpio_get_direction(struct gpio_chip *gc, unsigned int gpio) -- 2.30.2