From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A04D3C5478C for ; Sat, 2 Mar 2024 17:42:40 +0000 (UTC) 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ASI2EaNP4gmzUcFf3KHaX6th1sM0yIl3hFpaBiJLIas=; b=i+/IcBmq1uI7VU UiVXV27XsuHLD2Rc4z4/4654eGte0Y5/aW+zGGsTQOkk8ODWUuGt0oAFwob/+FkBsT9iS4W1tjt0E norAIdpiLMKzh8kUhKCo14jT9fZTU35jeUt25+A78OhfZELg/HfbHJmqXKTH6EljtVQzEMl7Y8w/I yMJu8ZcrQgdGVTK3Ui0sZUwe85B1dfYrwetXQEN5uJZOFhPbxCl8N/+uvqKtv8a6j/qBJkqo4ZjHm dOXV5vvAJCexQT8BgkfIE7srDr2ryszk1Zv+NrFiBFbyCSbmlSSjw4w47Xg1jNMkClgeiz1Hbume0 j4erbj/WBqf+wkuPH0nw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rgTNW-000000045c7-3itW; Sat, 02 Mar 2024 17:42:30 +0000 Received: from fgw23-7.mail.saunalahti.fi ([62.142.5.84]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rgTNU-000000045bF-1mIU for linux-arm-kernel@lists.infradead.org; Sat, 02 Mar 2024 17:42:29 +0000 Received: from localhost (88-113-26-217.elisa-laajakaista.fi [88.113.26.217]) by fgw23.mail.saunalahti.fi (Halon) with ESMTP id 3bd3e3e1-d8bc-11ee-b972-005056bdfda7; Sat, 02 Mar 2024 19:42:26 +0200 (EET) From: Andy Shevchenko Date: Sat, 2 Mar 2024 19:42:26 +0200 To: Stefan Wahren Cc: Linus Walleij , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org Subject: Re: [PATCH V2 2/2] pinctrl: bcm2835: Implement bcm2711_pinconf_get Message-ID: References: <20240302095430.4871-1-wahrenst@gmx.net> <20240302095430.4871-3-wahrenst@gmx.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240302095430.4871-3-wahrenst@gmx.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240302_094228_648378_87C27CCF X-CRM114-Status: GOOD ( 12.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Sat, Mar 02, 2024 at 10:54:30AM +0100, Stefan Wahren kirjoitti: > The BCM2711 allows to read the bias config. So implement pin_conf_get > accordingly. The pull resistor values has been taken from the > BCM2711/7211 datasheet. > > This implementation assumes that BCM7211 behaves the same way. ... > + switch (param) { > + case PIN_CONFIG_BIAS_DISABLE: > + if (((val >> shift) & PUD_2711_MASK) == BCM2711_PULL_NONE) > + return 0; > + else > + return -EINVAL; Redundant 'else' in all cases. Also as in previous patch, use single return point of success. if (((val >> shift) & PUD_2711_MASK) != BCM2711_PULL_NONE) return -EINVAL; break; > + case PIN_CONFIG_BIAS_PULL_UP: > + if (((val >> shift) & PUD_2711_MASK) == BCM2711_PULL_UP) { > + *config = pinconf_to_config_packed(param, 50000); > + return 0; > + } else { > + return -EINVAL; > + } > + > + case PIN_CONFIG_BIAS_PULL_DOWN: > + if (((val >> shift) & PUD_2711_MASK) == BCM2711_PULL_DOWN) { > + *config = pinconf_to_config_packed(param, 50000); > + return 0; > + } else { > + return -EINVAL; > + } > + > + default: > + break; Return directly from here. return bcm2835_pinconf_get(pctldev, pin, config); > + } > + > + return bcm2835_pinconf_get(pctldev, pin, config); return 0; > +} -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel