Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp44615pxu; Tue, 1 Dec 2020 05:51:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJys59sze2jHyuMN25TVIB1zJgj6pLxCt5V4t2yltC9+5so5mY5CUKhb44FgEChGABnvV+TD X-Received: by 2002:aa7:c058:: with SMTP id k24mr3154516edo.263.1606830710742; Tue, 01 Dec 2020 05:51:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606830710; cv=none; d=google.com; s=arc-20160816; b=ISKwQyr9YLM5wXAiGUXhb3w4J7r5MdT8+aHVvG6f8EVU2b/tszgrynjw3U/l6SKfZ/ wixWicqozzzYRLnkwJ+ZmBPOlb9VIz0EjZvAt1PtfEh8IqhJinWUF9ii4pCRjt7r6CSV 0ZRGU3d0xL6UIoplX5hxGsva8tRFkB1YpAZe22ZM9Xgba2B9+fHag8Kigld5CmwnqxJa q+tesZUAjzogCqDMSarJkmD0QyQ+uaUAN8gQLKshNN4zUvWKVJe7ZmBJ1r6AK0l5b3Zb P9yMgrqMlr0obECY2aJrDiYvH3sEK+onBFfd4r9Zqez8SjmjUg8maS7ntI4Mu05MTiRd 9wfg== 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=plSlSB8BWAYE/ztLDhWMxwjFWQWCkUimRFhmgFEUAfQ=; b=KXND00yHGSvg0JFVZP4mqbkm0xXnyPNgTKW8AQgiAdND4RwygJ4aaUxdc+y9+B7QtJ lkiJ4eIRGnF8YPbtuRKvNgGVqq6lExUxmdgCQNponVGCw5zwF2Y6mXJkEjXy0rKTu+YF 1qk9NfrB+clj18xz4uekMHa9x/x79bqgALSfsX7nhQ/SfL8L3mRNVy8RXKDUmmblykrh ED9yPikT1Gde5MXawq4+mIFO1FGhhBrmW8X9L7V71UxD3eP6JgM7BRFl09U+tc8re3RY ATvtQlA44qUZv9yTDzA+4tyjdLYLo99mKxG+vkLwUpISICIncrJqvX8rOtTY5bujDb6z UQHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E3NyYGrd; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f20si910916ejx.289.2020.12.01.05.51.27; Tue, 01 Dec 2020 05:51:50 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=E3NyYGrd; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391217AbgLANtR (ORCPT + 99 others); Tue, 1 Dec 2020 08:49:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388093AbgLANtR (ORCPT ); Tue, 1 Dec 2020 08:49:17 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10A2CC0613CF; Tue, 1 Dec 2020 05:48:31 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id l11so1186787plt.1; Tue, 01 Dec 2020 05:48:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=plSlSB8BWAYE/ztLDhWMxwjFWQWCkUimRFhmgFEUAfQ=; b=E3NyYGrdb0vHrL3gi/aN2z92fLeGyfn7i4T//KGcw+q76IES9ImWUlStjN4531WIqL nk2e5Qr4i+8oxK9XkyrCmgZngdMglLw5IusO20TVFr3QtDEgKM0IjFBfCn1hPWt1SxiF zlF2CtnlStwfHRKVjhmjT2Zo2F4Di2imgfApYSLPtpMb24nVjWv4mJ1rBORMFlqg0FrY Y4ZMuOGWTbGBOFVJyuhgIJNNTRKnDzfzC2x1vLUx2e/vIopLaVasNqX/SXFPEuRghmjH n3TBXbeQN7hBfDLXXTasaUvM731htT2YtWRIok/c6FPrYvYC0TDJkRAtdiH8PAUQvcda YPkw== 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=plSlSB8BWAYE/ztLDhWMxwjFWQWCkUimRFhmgFEUAfQ=; b=m2UeyDZglD3fRjZGzdM2e3y6SDRxipRHJSwQAc7Xb3eR8oALETW8C1jMwHsip78gto 5NpBRtc/vA1ftZyl70URZf0WAsKjA6lp6jG7UxpUgZl2hu3+uQGPaAiXVBBBwGQj4Rfe DcrJ+OLlrfjx9rxlYTfaSSTAwS2W+HvDIqYFlSOOiWDgTMjfGI7qbwbPXCMz4e/f9dPX 7NU10Krc3H0ccuHiQKdBQgYEx0L6NCnPqt0jjRabF5TQbp3P250dk+pLwmzI7nlZJrvx xGUFqaFf5/4lOPhqj+myH9p+KntoHoATCj92Hsq9yr7LMUaqMpI1rFvlnTb2P3T0PRrA ke+A== X-Gm-Message-State: AOAM530p2Qrgdi7MNYKwCcTfcbuLyR7Tczp+2QLOsWliqDTe+6H5VqCf bEYJv1xhKPoQYC5FWiaIAd1ucjtaTRZ5mlBuPpI= X-Received: by 2002:a17:90a:34cb:: with SMTP id m11mr2729806pjf.181.1606830510564; Tue, 01 Dec 2020 05:48:30 -0800 (PST) MIME-Version: 1.0 References: <20201130153742.9163-1-johan@kernel.org> <20201130153742.9163-3-johan@kernel.org> In-Reply-To: From: Andy Shevchenko Date: Tue, 1 Dec 2020 15:49:19 +0200 Message-ID: Subject: Re: [PATCH 2/5] serial: core: add sysfs attribute to suppress ready signalling on open To: Johan Hovold Cc: Greg Kroah-Hartman , Jiri Slaby , "Mychaela N . Falconia" , "open list:SERIAL DRIVERS" , USB , 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, Dec 1, 2020 at 3:21 PM Johan Hovold wrote: > On Tue, Dec 01, 2020 at 01:19:30PM +0200, Andy Shevchenko wrote: > > On Tue, Dec 1, 2020 at 1:04 PM Johan Hovold wrote: ... > > > 0x01 is 1 and is generally treated as boolean true as you know. > > > > Depends how you interpret this. kstrtobool() uses one character (and > > in some cases two) of the input. Everything else is garbage. > > Should we interpret garbage? > > No, ideally we should reject the input. We can do it by the way in kstrtobool() and see if anybody complains (I believe the world is saner than relying on 0x01 for false and 123 for true. ... > > > So why should a sysfs-interface accept it as valid input and treat it as > > > false? That's just bad design. > > > > I can agree with this. > > Looks like part of the problem are commits like 4cc7ecb7f2a6 ("param: > convert some "on"/"off" users to strtobool") which destroyed perfectly > well-defined interfaces. Oh, but the strtobool() in ABI was before that, for instance % git grep -n -p -w strtobool v3.14 shows a few dozens of users and some of them looks like ABI. ... > > Somehow cifs uses kstrtobool() in conjunction with the wider ranges. Nobody > > complained so far. But maybe they had it from day 1. > > Wow, that's pretty nasty. I have checked, the wider range fits one character. So, basically they had this kind of interface from day 1. ... > > So, we have two issues here: kstrtobool() doesn't report an error of > > input when it has garbage, the user may rely on garbage to be > > discarded. > > Right, parsing is too allowing and there are too many ways to say > true/false. > > The power-management attributes use 0 and 1 for boolean like I do here, > and I'd prefer to stick to that until we have deprecated the current > kstrtobool. Okay! -- With Best Regards, Andy Shevchenko