From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fgw23-7.mail.saunalahti.fi (fgw23-7.mail.saunalahti.fi [62.142.5.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDB5722EF2 for ; Sat, 2 Mar 2024 17:40:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.84 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709401210; cv=none; b=jWsZIbuPvQ8P0jcGSteRvaW7lv1r8DpmP+85lb/ppHkQufDX9BYPoDpyQXHI0QlTwTQ91AKgtWxyQuhECvTG05oBcdNMqZD2MAbWqIm7q+MwAq8TIL9BjNq1aSiftMg08tPTsCqRXrSpp2fdUBw/13cWI+zJ2+CDn5tAj4vaNDM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709401210; c=relaxed/simple; bh=codqXmkhcRRuwQv3WVG0HXzNki6+JNXPLptbqTNezBw=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=W1vzb+Za4bnBTzVq96a5XBLiylkBu07//6tApvFj9ieaMR+XUsqeVTaOZ0eEIbymXZUjwBZZ5SJZ9tMbxsn0EXCe45lL24Yxd1z5cXrVlH3xCY8qdj0Lb+fsHdBn04CZOTWA9kI+Z3T3dt1F3V0NTSxPlwuWAzY81pK4y+V1nWE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com 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> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240302095430.4871-2-wahrenst@gmx.net> 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