Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp214943pxf; Wed, 31 Mar 2021 01:12:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN+oweca1EW9bfGnxdFG69PvVjsPSM59MOJQ8EsaCbQts3+6d+TZ+tXsyi7PIlTwptIttY X-Received: by 2002:a17:906:8a6e:: with SMTP id hy14mr2285227ejc.356.1617178364510; Wed, 31 Mar 2021 01:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617178364; cv=none; d=google.com; s=arc-20160816; b=hi6DFroDQ34XaKtTBkx8PtX2ODRCspNrkz0Hp7Xo2lq4seTfe++MClY9kiVchchvKH LoiK7Q1C1CV08ngfeKW3czMxlb4tn29pKW67YNTPQ/dV6opxHPNLRq6jeuXXN/Nkc6XZ vJBQcTgndFq69K8/+H97P3J399QFjfKagQ20QGEeRMWFK63zVvTLzwqMlxKtFnIy8zxn t2BotNvt13h2WO2jXlesh0pW1FMCCmUVmcPoy4V1Lo1Q1AsiPtBh4DwSwuxIWO07o3x8 sflxlg/dbRYgJGfMFSR9Ex0waWqced9MqNhH8/FBT7njJnDNEQ6lNIY2rBCPUnWWI5Dv vYUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=HFszK+twYRzz/xUh0jsb8XrFJx5lwzHPpVumbD92Nb0=; b=MN/mAOOJ1fcIGqth3k9CNcmINjbX+qjmT0TNvruzBG3SK3VWR7juyufCfGbT6S3vs/ Xm3UISv3Q5nKeEcUuXQI2QZP5ET2pFXr0knYpwn2pKL9qCXAnQqa/wlhfrrKPSxpOdI5 HCCRjZEfjKe4B4WIno/RSIFXQNqQELTcftB9XwQMz/1hTBfdzA7xrR3o7Hx3Pe1Oe8gn I5vwJ225VD4UYW9kNqN2Ij8rWzz4kQKKufF9Z/KRemvW8OWcDL+KG10IwmVA9B2y0JmY RS9evWuQZ31A/Ed2LIQWrtkchdYkQBWPPJdIxdNV0LwbOLGq4i2RHetEjL6/g06m5ZJh ZRXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=LQ9o7qNp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ke20si993738ejc.305.2021.03.31.01.12.20; Wed, 31 Mar 2021 01:12:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=LQ9o7qNp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234063AbhCaILE (ORCPT + 99 others); Wed, 31 Mar 2021 04:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234313AbhCaILC (ORCPT ); Wed, 31 Mar 2021 04:11:02 -0400 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D48C8C061574 for ; Wed, 31 Mar 2021 01:11:01 -0700 (PDT) Received: by mail-yb1-xb33.google.com with SMTP id k3so9923422ybh.4 for ; Wed, 31 Mar 2021 01:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HFszK+twYRzz/xUh0jsb8XrFJx5lwzHPpVumbD92Nb0=; b=LQ9o7qNpdXx/YGba7dXYNSd9oz0QvMwgCnJgR5jzAXl4jMXxsIDNGXDAAiNTtDL+u1 FWpLnp1Vu0ODsYpi/pDcItVyhSQdyfkn+WLDEcgiYjEK28w7+QuKcIrgE0yKKpgrwx+5 5GwPePD+FJ1bJunpFUkrbsB+FBkWNqWBYdZQEklXmIbiFEW9Z0Bdvx4UQ3KKf9xuVjwn wJnRa9sCcHEFjO5VoQJ54DK+LctZydCrSimSJBeKRbH4OK+cAW1syx07qM0pW/bOu3hV 6Vpu99btrYZd81k6Qv+PRQet7+1+IS8k0ScfPpHK4Hk7TnsbUR62OBJzUWk9I4ImV2Qq V4Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HFszK+twYRzz/xUh0jsb8XrFJx5lwzHPpVumbD92Nb0=; b=kN1NUftDbbhJZ7WNdGQrv3oq3/lGWM++8+45DOfQ3wlK/R3eqmaBkHUUQXVTwTwW6j cVYplNsSktMDIqhu0OfZmSJ1GMe23/06WsQV748nlSCLJfPy4KsNyIZfO8o5szzDK/c2 9BHKG3O5MeGGFt69OVPa1xKQqOCjWB3RaSFCkllwqEaZVxxDArfvkSYETQ3+zM4liU84 6HVO/A6nIaK9Py4RmMqqSmITh8bTCRlXvaqEMU3N1KxSiTbTukCPRsiaQ5tldvP2L3mz OO60bOLPRNkq7vWfSGr0IGBQXroBZRllKZJbOUJbUzTXn8rX6HCEW4NN9lJw6p3ChuKn 5SBw== X-Gm-Message-State: AOAM533uMJiHUZZCoU1oTRRu/xCS8Ujb4KIUukoIdqJJQGHFsfTOeVC1 MZ96Ei+QZZbI3g0XynHgpf0lWW67ZXJTT0QQIiWV0Q== X-Received: by 2002:a25:ae87:: with SMTP id b7mr2710339ybj.25.1617178261218; Wed, 31 Mar 2021 01:11:01 -0700 (PDT) MIME-Version: 1.0 References: <92243c7b428d2025c1a9f3beb8db46995c9376d0.camel@fi.rohmeurope.com> In-Reply-To: <92243c7b428d2025c1a9f3beb8db46995c9376d0.camel@fi.rohmeurope.com> From: Bartosz Golaszewski Date: Wed, 31 Mar 2021 10:10:50 +0200 Message-ID: Subject: Re: [PATCH 2/2] gpiolib: Allow drivers to return EOPNOTSUPP from config To: Matti Vaittinen Cc: Andy Shevchenko , Joe Perches , Linus Walleij , Stephen Boyd , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 30, 2021 at 6:32 AM Matti Vaittinen wrote: > > Morning Folks, > > On Mon, 2021-03-29 at 16:30 +0300, Andy Shevchenko wrote: > > On Mon, Mar 29, 2021 at 03:20:07PM +0300, Matti Vaittinen wrote: > > > On Mon, 2021-03-29 at 14:59 +0300, Andy Shevchenko wrote: > > > > On Mon, Mar 29, 2021 at 2:43 PM Matti Vaittinen > > > > wrote: > > > > > The checkpacth instructs to switch from ENOSUPP to EOPNOTSUPP. > > > > > > WARNING: ENOTSUPP is not a SUSV4 error code, prefer > > > > > > EOPNOTSUPP > > > > > > > > > > Make the gpiolib allow drivers to return both so driver > > > > > developers > > > > > can avoid one of the checkpatch complaints. > > > > > > > > Internally we are fine to use the ENOTSUPP. > > > > Checkpatch false positives there. > > > > > > I agree. OTOH, the checkpatch check makes sense to user-visible > > > stuff. > > > Yet, the checkpatch has hard time guessing what is user-visible - > > > so it > > > probably is easiest to nag about all ENOTSUPP uses as it does now. > > > > > > > I doubt we need this change. Rather checkpatch should rephrase > > > > this > > > > to > > > > point out that this is only applicable to _user-visible_ error > > > > path. > > > > Cc'ed Joe. > > > > > > Yes, thanks for pulling Joe in. > > > > > > Anyways, no matter what the warning says, all false positives are > > > annoying. I don't see why we should stay with ENOTSUPP in gpiolib? > > > (other than the burden of changing it). > > > > For sake of the changing we are not changing the code. > No. But for the sake of making it better / more consistent :) > > Anyway - after giving this second thought (thanks Andy for provoking me > to thinking this further) - I do agree with Andy that this particular > change is bad. More I think of this, less I like the idea of having two > separate return values to indicate the same thing. So we should support > only one which makes my patch terrible. > > For the sake of consistency it would be cleaner to use same, single > value, for same error both inside the gpiolib and at user-interface. > That would be EOPNOTSUPP. As I said, having two separate error codes to > indicate same thing is confusing. Now the confusion is at the boundary > of gpiolib and user-land. Please educate me - is there difference in > the meaning of ENOTSUPP and EOPNOTSUPP or are they really indicating > the same thing? If yes, then yes - correct fix would be to use only one > and ditch the other. Whether the amount of work is such it is > practically worth is another topic - but that would be the right thing > to do (tm). > In user-space there's no ENOTSUPP but there's ENOTSUP which is defined in most sane toolchains as: #define ENOTSUP EOPNOTSUPP While ENOTSUPP is not the same number as EOPNOTSUPP. So to answer the question: they mean the same thing in the kernel but not to user-space. We must never return ENOTSUPP to user-space because it doesn't know it. Bartosz > > > > > But I have no strong opinion on this. All options I see have > > > downsides. > > > > > > Accepting both ENOTSUPP and EOPNOTSUPP is the easy way to avoid > > > allowing checkpatch warnings - but I admit it isn't stylish. > > > > I think the error code which is Linux kernel internal is for a > > reason. > > If so, then the current checkpatch warning is even more questionable. > > > > > > Converting all ENOTSUPP cases inside gpiolib to EOPNOTSUPP is > > > teodious > > > although end result might be nicer. > > > > Why? You still missed the justification except satisfying some tool > > that gives > > you false positives. We don't do that. It's the tool that has to be > > fixed / > > amended. > > > > > Leaving it as is gives annoying false-positives to driver > > > developers. > > > > > > My personal preference was this patch - others can have other view > > > like > > > Andy does. I'll leave this to community/maintainers to evaluate :) > > > > This patch misses documentation fixes, for example. > > Valid point. > > > Also, do you suggest that we have to do the same in entire pin > > control > > subsystem? > > After reading/writing this, I am unsure. This is why the discussion is > good :) I don't see why we should have two separate error codes for > same thing - but as you put it: > > > I think the error code which is Linux kernel internal is for a > > reason. > > not all of us thinks the same. So maybe I just don't get it? :) > > Best Regards > Matti Vaittinen > >