Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp27454pxu; Tue, 1 Dec 2020 05:27:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuOdgqKlMBI1x8nDqOvnagv04dI2HrsyysExCoI+SI3R4CBU5K5x3qw4j3mST/Rs9EcwuB X-Received: by 2002:a17:906:caa:: with SMTP id k10mr2971464ejh.204.1606829229722; Tue, 01 Dec 2020 05:27:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606829229; cv=none; d=google.com; s=arc-20160816; b=NgOCzoHndDKzzRd9oHsBZ6I2ahQ9CXqxHtBwB888Z15AXKIYiLrO5mRSXgx8x5NbXZ SddLoAGbWy9hWDJ+g+Jf2y8uFtcTXKBqHhkUqRJ0RmLx4Csl2Zl+U/LNjzlXjbKxEGGr pJDZpDlXQU3eR55Ar6R1xIep1387DFUEqOZ7AOTcXsv4UF/eeL2p8oPLCZoPnsQJz/gM yIgj3B9Qh/VQAgsYOl4Ve+wpOE2kMEp9Mg6ClUtAsrpYfgY81GIWUYMckIINObYaKkN4 AJN3B1wk3A9WG/ZDuaVi35rnwkNuAHyBxWUOI5J54c8aclDkgzA0Ke4yv5WOPtGWvLzi vSPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=tyomTbeXHwoWL2hrAF8S1rI5kbguY96zuSzDzrQnHfg=; b=xr0MUzYkxkcdaEBcGzjFORkNKva/0DoMcCLFuzmHMJn8rnM8afeVgfri0hQ2lmW8DM tWSUzTnB8FxnxO60wffYCAenB2wN4ygkMcjE3glCB0dDK7EsOBkFTnz8CEO6wnwdjLE5 BUbqmIY0TwEiw222rjumr43QZDPgfHtSIPSZRjxHn1akT5BS+DmG7M26tXpAa14ckoKB fmIWpI6IKOzarud4L/d6eO2tgUqvWs3/QVvWIlQy2BYr4T47EfJPegjvZEahNXJahD75 nQos/bHc5ddB1nKftqT/7Yhb9iQEj2RDpT9VI/OZ7ZH0La8N+ReD7IdFzLMeiQDXnj/O s5dg== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id uz9si924911ejb.386.2020.12.01.05.26.46; Tue, 01 Dec 2020 05:27:09 -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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729057AbgLANW0 (ORCPT + 99 others); Tue, 1 Dec 2020 08:22:26 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:39844 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727630AbgLANW0 (ORCPT ); Tue, 1 Dec 2020 08:22:26 -0500 Received: by mail-lj1-f196.google.com with SMTP id o24so2832404ljj.6; Tue, 01 Dec 2020 05:22:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=tyomTbeXHwoWL2hrAF8S1rI5kbguY96zuSzDzrQnHfg=; b=KRLnhTZ3Q50AANnSCOEB07DkWRWvRsewIxk3efJfpAfL8VTO+KQBZUNRyeF4OzWcYz JSUG0s8F0/EgBzfzOlzkej7abSDW2zZFFzZ3lbFrEtUb/Gyx/V+o+OyJ1M2hvy5sbV5Y Lhaz9eojFZVGKi189DzgkiIC6EJYm4o0BTxuAvp3IZHLctIIlDP7S0gzvumTuLb2fmnD V8xrKvqPZzfJu43gVFNIEO3N/sc8Hwg6EOmDOfrBzahU4ri3384GYsnpuk67YFGq2mzT lOyptyARmJ1vgQsrUMoZ7Kh+Waowe57ohLN8i/wEsRgefNeaKdAqAKcvtU0oOMQ7I73i HYCg== X-Gm-Message-State: AOAM530SGjYmAEfHGQYC4GLmfJj4I/8qeqnDn7+CD4s5MMUNiZtMUYjj aglWAJXRS0rKZH2/WqqvDAs= X-Received: by 2002:a2e:8346:: with SMTP id l6mr1239463ljh.132.1606828897528; Tue, 01 Dec 2020 05:21:37 -0800 (PST) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id n28sm199545lfh.272.2020.12.01.05.21.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2020 05:21:36 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1kk5ba-0007dK-PP; Tue, 01 Dec 2020 14:22:06 +0100 Date: Tue, 1 Dec 2020 14:22:06 +0100 From: Johan Hovold To: Andy Shevchenko Cc: Johan Hovold , Greg Kroah-Hartman , Jiri Slaby , "Mychaela N . Falconia" , "open list:SERIAL DRIVERS" , USB , Linux Kernel Mailing List Subject: Re: [PATCH 2/5] serial: core: add sysfs attribute to suppress ready signalling on open Message-ID: References: <20201130153742.9163-1-johan@kernel.org> <20201130153742.9163-3-johan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > 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. > > You miss the point; kstrobool accepts "12" today and treats it as true. > > You cannot extend such an interface to later accept a larger range than > > 0 and 1 as you didn't return an error for "12" from the start (as someone > > might now rely on "12" being treated as "1"). > > 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. > 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. Johan