Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3217119imu; Sat, 24 Nov 2018 00:20:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/ValyUB+FqzqZkMrw6vXm6tpRl9txXqOll5U4+SsUTOKCSNQQmOdqC7nbcFxInqGbqSkk+v X-Received: by 2002:a17:902:8484:: with SMTP id c4mr18588080plo.59.1543047602341; Sat, 24 Nov 2018 00:20:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543047602; cv=none; d=google.com; s=arc-20160816; b=LRx1eB6xuhXlbJQBA6O1YVjouRcFYZg05BGkgG4CxISlRqDg+FtU5hQF2fgqlMsA6H EJNNbr45QGy67NaQU1SjdPYdh6x0ndgHI2QEX9ZV2nmxpNa472dMYkd3EWEIqnbUjzkV cRT1bFbj3PWypO1gqszDg/loEqtQkI0rUCtVitxUeZwLmTukvfHv1HUJWh0ouZHMMrW8 0WqveTZXHYNcBmPtrI7eUbr32bMcNFnaMsTLP8YsocEdOqCXMvL3FrMpMWNxXfhx0Jk4 GHB93Iu5IDguoDsd97eRxsNBCKPHOCL+l+2G/JhcJHCYpBxMpPe2uy+S8+mKRAr4CYFs ivLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=kIj36/zyD1Ru52blSuw/L5cXp3mGSJ9KUJuFx9pDUQo=; b=m9lEBAYt4fMyocPDT3rGwqSesOd4vzN0jobUYFxecXTNxhidDhIluuqvTD74FwCP66 mlQkl8T3dsxQyeqRAQQaXe2c0+SlGzB8mOknbgfKW29yrlynG+zdBSuDruQO5APlG/9y iAkLTnbXnTVOkTYLhIe6rcbAZNwSRLejqIWbkQR9WCPGRq2GLf1kslut9lHPUHMYGbYz wnEXKCKDenTJ1pjC6IHeX/1HqXCRbTbK5YpOFqWej/wo2ax45M4f4RTOpA8Lb0Dbuboj JicXxQ2Aa2oWKrvrWXu7DGtyj8ZbeKOq0EGpvBiA6gABQcaJmq1TT/LwsFJeefAD5mur MJSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iyCBDgIO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j22si49793626pgj.244.2018.11.24.00.19.48; Sat, 24 Nov 2018 00:20:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iyCBDgIO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502872AbeKWUYl (ORCPT + 99 others); Fri, 23 Nov 2018 15:24:41 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:40067 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390381AbeKWUYk (ORCPT ); Fri, 23 Nov 2018 15:24:40 -0500 Received: by mail-lf1-f66.google.com with SMTP id v5so8255291lfe.7 for ; Fri, 23 Nov 2018 01:41:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kIj36/zyD1Ru52blSuw/L5cXp3mGSJ9KUJuFx9pDUQo=; b=iyCBDgIOkvgupqNK3ucwnaTmmTvHMX0edt1kADbFjbEhn46wM0+jm/+jxQfC0Npbj4 EM0XclqlQPcIYXoO/tF6RzK7mOADC6rfB6bDgMJUF/Q+B4h2To1cDtwflR2DgMKPzTnj rzf1TYcoBXn+bNM/lPOTzTSWLuTJrkk+ofbdU= 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=kIj36/zyD1Ru52blSuw/L5cXp3mGSJ9KUJuFx9pDUQo=; b=QR9Gtx/SdZrvWc0IlICWlZiW8U+5I10paOcNNau1vmtlCRS/5YsRY+Jf+MQRQgQ/PX +IF6RlaNoY2iPOImXV+AxMGql90nT/3QfyMxTy0DvQ3j8oAYUu1M4KVFI0TObwfd2Itw T09QG4sxpSl0ZwjDuRcFgyLJrSZvYa2MG7+r5JXkD3mY5FibWk+mjST/UKU8InnK6jNI UZ8I4XLJfp8U5AiCbN3fIJoqE3VutLAJkjMUl3Y1451IdQnvWL4b/0OduyQUnGBzrgZn y32AAzd64iXviRyQakfv/Sk8eig7y09mTC5jQGeeOCw00zpkIxPRMM+AM2+Fc1YSw5QJ AfsQ== X-Gm-Message-State: AGRZ1gKtnAyaktBynGNs872MSpJtnP8EqD99XMf5qGDdp0Mrj8OuOLjK tC/t9nL3yFwov/1+CcxDSF7AnuLKwPpxX47h52k+OA== X-Received: by 2002:a19:2752:: with SMTP id n79mr9233667lfn.11.1542966068753; Fri, 23 Nov 2018 01:41:08 -0800 (PST) MIME-Version: 1.0 References: <20181122173015.23905-1-ckeepax@opensource.cirrus.com> <20181122173015.23905-3-ckeepax@opensource.cirrus.com> In-Reply-To: <20181122173015.23905-3-ckeepax@opensource.cirrus.com> From: Linus Walleij Date: Fri, 23 Nov 2018 10:40:57 +0100 Message-ID: Subject: Re: [PATCH 3/3] gpio: Add reference counting for non-exclusive GPIOs To: Charles Keepax Cc: Mark Brown , Liam Girdwood , Marek Szyprowski , "linux-kernel@vger.kernel.org" , patches@opensource.cirrus.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 22, 2018 at 6:30 PM Charles Keepax wrote: > Currently, a GPIO can be requested multiple times when the > NONEXCLUSIVE flag is set, however it must still be freed a single > time. This makes client code rather complex, since multiple drivers > may request the GPIO but only a single one can free it. Rather than > manually handling this in each driver add some basic reference > counting into the core. Currently, this is fairly primitive but > so is the support for the NONEXCLUSIVE flag and the implementation > covers those use-cases. > > Reported-by: Marek Szyprowski > Signed-off-by: Charles Keepax This patch is not fixing anything right now, correct? I discussed the notion of pulling reference counting for nonexclusive GPIOs into gpiolib with Mark but the benefit is a bit unclear: if the subsystem using nonexeclusive GPIOs (currently only regulators) would still have to keep its own reference count or somehow semantically know when the last user is gone, the point is kind of moot. I haven't looked closely at the regulators case but I got the impression that it is more complex than just reference counting so, currently I don't know if this is such a good idea. Anyway I would like to push this until we have cleaned up with the rest of the series I have boiling, if you don't mind. (Patch 1+2 should be fine anyway.) Yours, Linus Walleij