Received: by 2002:ab2:5182:0:b0:1f4:61d5:3ad4 with SMTP id x2csp48557lqi; Fri, 5 Apr 2024 09:23:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8qEAbhaunAsB5ks/UuG5KH7eC7fbLViiNP05hkUPV7aX+W/aIi1DjhPlzZoVe0tJQpkAS/NqHM7u/SrW88bhEinPQk8QLc3Fm3y0STw== X-Google-Smtp-Source: AGHT+IEAAwWAMRCS+UbollSfu6ajWZqpEEkDOwOp3a2uN7adFm5N2/44UT4wI0s+7HT3kJDjoBXw X-Received: by 2002:a17:907:6d20:b0:a4e:48d6:b9d7 with SMTP id sa32-20020a1709076d2000b00a4e48d6b9d7mr2042053ejc.56.1712334227008; Fri, 05 Apr 2024 09:23:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712334226; cv=pass; d=google.com; s=arc-20160816; b=R1uCrFogKJaUXMiZfR5hwUfUTKH/4QVL/qpF21B8yydPNZ24D0fzlqN0rhPmNf3XIx mA3jYzVv25ze925Vb8dI6GLD1ArOXA+rNB1zT5gbqyiYchTpgGHy6hD1PPY1XNUwu/68 WgLLNpaKSHwyWVLg2FdmUnvrD7LKZDusvEvXAHd5eSUj9uX42rV2EO4HHmgOEfd7UBoV et7uBhxs7HQaETNAvjZibyevBMMprW5DEEJBkDDR7bWg1luS/ksVgvXaVuG9Hk4oZ08O g+6jNEhXYAvyqZ7wTxdUYI6pQsspdBPds2zWGVNQ3t1VTNbRYGStO2uu/ut4kTvu4+6l t8iw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date; bh=L4cU3b7ZpEQG77+s2vaCXM53x4atl+2Io2ZHNjoVU4I=; fh=qsErbrwTghNMDIKEDJseNNDE2XuarW3xj7iuCO8Y/DI=; b=jp70bDfE4hRGwErq7ZI1FSYuKpqvIQKzpKSdDT0bTLu/KOulYp9IcvuAwM/Yp2GMsW FlR6Ol8feaxaF39YuqwmFizr1l1wcAcbbJHkXlpvkJ/Hs0b+EtEHL5AWFLe9EFhNALUE iCBwWmlsbaYQTY6GSguM4aR1zmSFmdKcH3rNCvWbVyV02uiSKG2+bNYYvgATdJ6ZNobL +Ii+5W3o0iwyuDJM9SziFxfN3IWhNCpnFTNGwPQFtRa4DH93/rzl7Ltdaw6eL1wLX31i Vf08vINiFtz44F4ErklWIuyUiLP0f34bkuKgNeLP6gTbZXvqV4sX4Zyl0MAYY3Oxstyh FZ4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-133333-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133333-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ne8-20020a1709077b8800b00a4e28cd9caasi886579ejc.19.2024.04.05.09.23.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 09:23:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-133333-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-133333-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133333-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 883D41F2456E for ; Fri, 5 Apr 2024 16:23:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2347D171090; Fri, 5 Apr 2024 16:23:39 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 425C816F82C; Fri, 5 Apr 2024 16:23:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712334218; cv=none; b=oBLkx+SoYtKL+rddO42oIbWbGBTOebvLuC58F07IodstxsApjNBs8C/MbFZpuL8dcdzeBkRVaHdRo70m3jvUyEDwxi1mePyf32STJCEF068QGrXs34Ig+2WzO/PWAMPQuBHHgGzQRVuj0tO+ziKmLPN5mTiaD0tBXGMUe9JUtl8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712334218; c=relaxed/simple; bh=UPv37TzvUi6i5rEA4aCj5ObZmslNLTryMSZkqevsCrg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=udy+IllJkWQPt9vENKPBBH+ZNqu3ld0gkaox3rHMrozoNnvJv0oJcGA6Cy6vlKF3u2PCcKVoOis1CM6cUr2yxwpro2cvQb/MpmTMP/mW1Bkockv1mH+xPtGr9y4reswZ0bHNSfrsaHEWNLR7CsmCE4by9Vprc7HODLuIm6aZ+Eo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 097E4FEC; Fri, 5 Apr 2024 09:24:06 -0700 (PDT) Received: from pluto (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 209373F64C; Fri, 5 Apr 2024 09:23:34 -0700 (PDT) Date: Fri, 5 Apr 2024 17:23:31 +0100 From: Cristian Marussi To: Andy Shevchenko Cc: Sudeep Holla , Peng Fan , Linus Walleij , "Peng Fan (OSS)" , "brgl@bgdev.pl" , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] pinctrl: pinconf-generic: check error value EOPNOTSUPP Message-ID: References: <20240401141031.3106216-1-peng.fan@oss.nxp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, Apr 05, 2024 at 07:16:56PM +0300, Andy Shevchenko wrote: > On Fri, Apr 05, 2024 at 05:06:08PM +0100, Cristian Marussi wrote: > > On Fri, Apr 05, 2024 at 04:47:19PM +0100, Sudeep Holla wrote: > > > On Fri, Apr 05, 2024 at 06:38:04PM +0300, Andy Shevchenko wrote: > > > > On Fri, Apr 05, 2024 at 02:13:28AM +0000, Peng Fan wrote: > > > > > > On Thu, Apr 04, 2024 at 01:44:50PM +0200, Linus Walleij wrote: > > > > > > > On Mon, Apr 1, 2024 at 4:02 PM Peng Fan (OSS) > > > > > > wrote: > > ... > > > > > > > > > ret = pin_config_get_for_pin(pctldev, pin, &config); > > > > > > > > /* These are legal errors */ > > > > > > > > - if (ret == -EINVAL || ret == -ENOTSUPP) > > > > > > > > + if (ret == -EINVAL || ret == -ENOTSUPP || ret == > > > > > > > > + -EOPNOTSUPP) > > > > > > > > > > > > > > TBH it's a bit odd to call an in-kernel API such as > > > > > > > pin_config_get_for_pin() and get -EOPNOTSUPP back. But it's not like I care > > > > > > a lot, so patch applied. > > > > > > > > > > > > Hmm... I would like actually to get this being consistent. The documentation > > > > > > explicitly says that in-kernel APIs uses Linux error code and not POSIX one. > > > > > > > > > > Would you please share me the documentation? > > > > > > > > Sure. > > > > https://elixir.bootlin.com/linux/latest/source/include/linux/pinctrl/pinconf.h#L24 > > > > https://elixir.bootlin.com/linux/latest/source/drivers/gpio/gpiolib.c#L2825 > > > > https://elixir.bootlin.com/linux/latest/source/drivers/gpio/gpiolib.c#L2845 > > > > > > > > I admit that this is not the best documented, feel free to produce a proper > > > > documentation. > > > > > > Ah OK, my bad. I assumed you were referring to the entire kernel tree and > > > not just GPIO/pinux. Sorry for that. > > > > ... from this thread, my understanding too was that this forbidden usage of > > POSIX errors for in-kernel API was general to any subsystem...so the ask > > for docs about this... > > > > > > > > This check opens a Pandora box. > > > > > > > > > > > > FWIW, it just like dozen or so drivers that needs to be fixed, I prefer to have > > > > > > them being moved to ENOTSUPP, rather this patch. > > > > > > > > > > I see many patches convert to use EOPNOTSUPP by checking git log. > > > > > > > > How is that related? You mean for GPIO/pin control drivers? > > > > > > > > > And checkpatch.pl reports warning for using ENOTSUPP. > > > > > > > > checkpatch has false-positives, this is just one of them. > > > > > > Fair enough. > > > > > > > > BTW: is there any issue if using EOPNOTSUPP here? > > > > > > > > Yes. we don't want to be inconsistent. Using both in one subsystem is asking > > > > for troubles. If you want EOPNOTSUPP, please convert *all* users and drop > > > > ENOTSUPP completely (series out of ~100+ patches I believe :-), which probably > > > > will be not welcome). > > > > > > Well, I don't agree with that 100% now since this is GPIO/pinmux sub-system > > > practice only. What if we change the source/root error cause(SCMI) in this > > > case and keep GPIO/pinmux happy today but tomorrow when this needs to be > > > used in some other subsystem which uses EOPNOTSUPP by default/consistently. > > > Now how do we address that then, hence I mentioned I am not 100% in agreement > > > now while I was before knowing that this is GPIO/pinmux strategy. > > > > > > I don't know how to proceed now ????. > > > > from checkpatch.pl: > > > > # ENOTSUPP is not a standard error code and should be avoided in new patches. > > # Folks usually mean EOPNOTSUPP (also called ENOTSUP), when they type ENOTSUPP. > > # Similarly to ENOSYS warning a small number of false positives is expected. > > > > ...so it seems to me that the this is NOT a false positive BUT Pinctrl/GPIO > > subsystem is an exception in these regards, since this is what is explcitly > > state in checkpatch comments AND there is no generalized doc on this.... > > Checkpatch is false positive _in this case_. > And in practice it's not the first and not the last false positive by checkpatch. > Again, checkpatch is a recommendation, not a letter of law. Documentation is. > > > ....but twe can happily oblige to Pinctrl expectations by remapping to ENOTSUPP > > in the pinctrl protocol layer or driver...just I won't certainly do that at the > > SCMI core layer at all at this point...as Sudeep said ...especially because there > > is NO generalized docs for the above ban of POSIX errors for in-Linux kernel API... > > There is no ban, we use POSIX error codes heavily in kernel. > > If you think GPIO/pin control has a flaw, send patches. I'm not a maintainer there, > perhaps conversion of all GPIO and pin control drivers to POSIX error code will be > warmly welcome, who knows. > > But before that, we want to have ENOTSUPP from callbacks that are used in > GPIO/pin control drivers for the sake of consistency. > Yes, my point was simply to say to fix the retcode of SCMI pinctrl to comply with Pinctrl expectations, and definitely NOT to fix and move to ENOTSUPP all the SCMI originated errors across all protocols, since it is NOT what is expected in general by other susbsystems. Thanks, Cristian