From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752114AbdJZJL1 (ORCPT ); Thu, 26 Oct 2017 05:11:27 -0400 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:43832 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752050AbdJZJLT (ORCPT ); Thu, 26 Oct 2017 05:11:19 -0400 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Date: Thu, 26 Oct 2017 10:10:50 +0100 From: Charles Keepax To: Andrew Jeffery CC: Linus Walleij , Bartosz Golaszewski , Michael Welling , "linux-gpio@vger.kernel.org" , Jonathan Corbet , Joel Stanley , Ryan Chen , Rob Herring , Frank Rowand , Charles Keepax , Laxman Dewangan , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , , "devicetree@vger.kernel.org" , OpenBMC Maillist , Subject: Re: [RFC PATCH 3/5] gpio: gpiolib: Add chardev support for maintaining GPIO values on reset Message-ID: <20171026091050.vpeulil4g7cqbxj4@localhost.localdomain> References: <20171020033727.21557-1-andrew@aj.id.au> <20171020033727.21557-4-andrew@aj.id.au> <1508490173.24322.53.camel@aj.id.au> <20171025081454.4avrf57mf33khu7c@localhost.localdomain> <1508976339.13477.5.camel@aj.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1508976339.13477.5.camel@aj.id.au> User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710260127 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 26, 2017 at 10:35:39AM +1030, Andrew Jeffery wrote: > On Wed, 2017-10-25 at 09:14 +0100, Charles Keepax wrote: > > On Fri, Oct 20, 2017 at 07:32:53PM +1030, Andrew Jeffery wrote: > > > On Fri, 2017-10-20 at 09:27 +0200, Linus Walleij wrote: > > > > I don't see it as helpful to give userspace control over whether the line > > > > is persistent or not. It is more reasonable to assume persistance for > > > > userspace use cases, don't you think? Whether the system goes to sleep > > > > or the gpiochip resets should not make a door suddenly close or the > > > > lights in the christmas tree go out, right? I think if the gpiochip supports > > > > persistance of any kind, we should try to use it and not have userspace > > > > provide flags for that. > > > > > > Right. I guess the counter argument to your examples is if the gpio is > > > controlling any active process that we don't want to continue if we've > > > lost the capacity to monitor some other inputs (some kind of dead-man's  > > > switch). But maybe the argument is that should be implemented in the > > > kernel anyway? > > > > > > > To me it certainly feels like decisions like this should live in > > the kernel, your talking about things that could cause very weird > > hardware behaviour if set wrong, so it makes sense to me to have > > that responsibility guarded in the kernel. > > I feel that taking this argument to its logical conclusion leads to > never exporting any GPIOs to userspace and doing everything in the > kernel. If userspace has exported the GPIO and is managing its state, > then it can *already* cause very weird hardware behaviour if set wrong. > The fact that userspace is controlling the GPIO state and not the > kernel already says that the kernel doesn't know how to manage it, so > why not expose the option for userspace to set the persistence, given > that it should know what it's doing? Admittedly yes, I guess it really comes down to use-cases. There are fairly strong use-cases to control GPIOs from user-space that justify the risks. The use-cases for being able to set non-persistent GPIOs from user-space seem less clear to me, but if they exist I certainly don't have any objection. Thanks, Charles