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 A3FE8C5478C for ; Sat, 2 Mar 2024 17:40:27 +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=dQd9deuUGVtRcLMhw/jO/edu9jJi3cbmbEq5ev5kzmg=; b=eD1+VYwyt0bH7G 0SoZA0B1Og4No0K2L06H5njQuWOmxJcU7QBHe4aGC5qOP/aXUCUKrh2ebmSK4ykdXBuNun8x47Gsn GcMr+eBiHwFrIFErhdKYuoyPfgHDXUuVEnnzycVHdWCrnDbIdKIjE74jLFQ4UHWbdjPTs6djBmh7F /q1KznCAfP6tuDf4hqxxNUF2XahrjU7K+dCLkM0ZENn+RR5RUvjZkzaZrN6wUyuxWaO/LJydDMRBM 6izLgZtzQ5j3GWu13SXwC4u79zm8IYnHgZg0poelbHgnHOkhfcQDTfrUOY972c+vsgLOTii7KQhVx LdIvVFK3q7Vu7t/+H0lQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rgTLM-000000045K4-24gR; Sat, 02 Mar 2024 17:40:16 +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 1rgTLI-000000045Iw-2jR9 for linux-arm-kernel@lists.infradead.org; Sat, 02 Mar 2024 17:40:14 +0000 Received: from localhost (88-113-26-217.elisa-laajakaista.fi [88.113.26.217]) by fgw23.mail.saunalahti.fi (Halon) with ESMTP id e816a090-d8bb-11ee-b972-005056bdfda7; Sat, 02 Mar 2024 19:40:06 +0200 (EET) From: Andy Shevchenko Date: Sat, 2 Mar 2024 19:40:05 +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 1/2] pinctrl: bcm2835: Implement bcm2835_pinconf_get Message-ID: References: <20240302095430.4871-1-wahrenst@gmx.net> <20240302095430.4871-2-wahrenst@gmx.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240302095430.4871-2-wahrenst@gmx.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240302_094012_889836_F2C68F52 X-CRM114-Status: GOOD ( 13.48 ) 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:29AM +0100, Stefan Wahren kirjoitti: > Even the driver already has implemented pin_dbg_show, it could > be helpful to implement pin_conf_get for a more generic behavior. > Contrary to the BCM2711, the BCM2835 SOC doesn't allow to read > the bias config, so the implementation is limited to the basics. > + switch (param) { > + case PIN_CONFIG_INPUT_ENABLE: > + if (fsel != BCM2835_FSEL_GPIO_IN) > + return -EINVAL; > + > + *config = pinconf_to_config_packed(param, 1); > + return 0; Either use break here (and in similar situations)... > + case PIN_CONFIG_OUTPUT_ENABLE: > + if (fsel != BCM2835_FSEL_GPIO_OUT) > + return -EINVAL; > + > + *config = pinconf_to_config_packed(param, 1); > + return 0; > + > + case PIN_CONFIG_OUTPUT: > + if (fsel != BCM2835_FSEL_GPIO_OUT) > + return -EINVAL; > + > + val = bcm2835_gpio_get_bit(pc, GPLEV0, pin); > + *config = pinconf_to_config_packed(param, val); > + return 0; > + > + default: > + break; ...and return from here directly. > + } > + > return -ENOTSUPP; I.o.w. it's better to have a single point of returning a success code. > } -- 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