Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1567292imm; Wed, 19 Sep 2018 22:24:33 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbVk1LPahHRz5waC7VbmEoF+xC6+Jm4mOCn7KmBaJSEqpLXCRsPkhxJYVWk9R8OVmtmw1Wk X-Received: by 2002:a17:902:9a0c:: with SMTP id v12-v6mr37847938plp.159.1537421073026; Wed, 19 Sep 2018 22:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537421072; cv=none; d=google.com; s=arc-20160816; b=K1M+gUmIfE4PodCr/rNLKZ6772iIkR+KmKtjtxhnxz22xQy1VkVMDxXzeEKVn0Lljh uO0FQTisWXw82ggZcf1bIp900GgORWHAM14wBrFutFlhjwzcxPQwTAN/wdPl6m+mcG90 X0Ogwhs1pIwoGB8yk6Q+CJiJ8qoGin3ov2XsOSxTmTVc2/eXKobCKWQ5HqI1TaLszZ5m FWIItYDxVqrhuKSb3Q1Iajw52oV9Z0gG7NW6k84f+KH0yD/rBBsfIr+2GAXP2rQHQedu K97Y2BHKzl4EqTRX8a3MK/ls4eA7KxBmX3x5Ss5gEKx1s/UFnsAEDiZk4iIj5Ii9gLTQ brzw== 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=qD3luyRsioFeQrcJ7TpS7PquXaRw+VnodNG1ePV0gdQ=; b=GEPzzkJtvLCyBvlrFQAjK9+WN/of4+iO1ZKIZw7QnMkXS2NrVgo2A1WNRUXNCRMxhk l9KGHye7H6KwVLySSngrbnDFNtxH0Gbe+p8rF0McyR3ZfclTzt3yKjiMv18+EEqt/Xia 8Ppybz7m9V1Mm2kKIldCyb+nEJEBLVbpLWQYKS0+YEwMc/2Rtk2w8pEDVpvUBJXVdZiR fOvx5sHZgBBJBPMw/vD+HZstjZB5ZBTwGfDe4NTG9mmKtaPa4EYvcUvgYU9aFvn/LACn G2aowHm1OLnwjxq2BIN2vFpy6qRRKpFXYz3DImrFKdlCLUCqIeq7PvIPZTPpqhM6uygh PUWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JtWECeF/"; 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 n5-v6si22898498pgg.572.2018.09.19.22.24.17; Wed, 19 Sep 2018 22:24:32 -0700 (PDT) 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="JtWECeF/"; 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 S1731457AbeITLFa (ORCPT + 99 others); Thu, 20 Sep 2018 07:05:30 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:43985 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730172AbeITLFa (ORCPT ); Thu, 20 Sep 2018 07:05:30 -0400 Received: by mail-io1-f68.google.com with SMTP id y10-v6so6380793ioa.10 for ; Wed, 19 Sep 2018 22:23:56 -0700 (PDT) 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=qD3luyRsioFeQrcJ7TpS7PquXaRw+VnodNG1ePV0gdQ=; b=JtWECeF/Os9Z70oJxLXUCFIouTEakAzgEMSU75ATeWZCKGr3BxdrsmFybfJPT0EBfB KXmKsrtr27dC5rYJtF/yPuJ06stGH+BTV/HXC0O5qOig/YbAyjjANGOaEP8Z9Vis6EMP VB8TinbaZMeQws3hlUjYLTomHd3Jvv6wMj0io= 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=qD3luyRsioFeQrcJ7TpS7PquXaRw+VnodNG1ePV0gdQ=; b=IXXLIiGLqgbw7/eWO+h2Y0RJb2+y2iySK6CsUXzf5UpWoTzhXCUcNblloI0Ms4ZcTB b+GLJsuBI5Ww0sPxm6sBs/p0S38YlsqZgfhyBjaIIlpwclXEwHccvYe8VaU3FmyWnof7 p7vIJPfQW8KgD+aDPUgxDKqT+MF3397XKXIc7QqhVqKxtd5k+retEuX1fDA2HXE403Zl 7gylJ9A+zC3rSwMuPQ+37Rd+Nfd/8MUWO6a0ROdfA2W/PlpKGzbMZQ4qHBMla3coKuuE AEH0sJGh5nWkc9QgIatr+byQJgZWaZJxXiOHMluTfTTEQtY/wNd/Hqc7W5JRj3zssDJp 4S2g== X-Gm-Message-State: APzg51DZRgsVAM0ypU3yw0P7mdRdbnweN/wP9uoyS/Ju7lfqJlQo6hY/ IhbNXZ/lkYLuFryGBQ0rItelhvpvOlMzTwOQ7gUnZQ== X-Received: by 2002:a6b:c3c4:: with SMTP id t187-v6mr31340127iof.304.1537421035845; Wed, 19 Sep 2018 22:23:55 -0700 (PDT) MIME-Version: 1.0 References: <20180914070839.4667-1-ricardo.ribalda@gmail.com> <20180914070839.4667-2-ricardo.ribalda@gmail.com> In-Reply-To: From: Linus Walleij Date: Wed, 19 Sep 2018 22:23:42 -0700 Message-ID: Subject: Re: [PATCH] gpiolib: Show correct direction from the beginning To: timur@kernel.org Cc: Ricardo Ribalda Delgado , Timur Tabi , Stephen Boyd , "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" 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 Wed, Sep 19, 2018 at 4:50 AM Timur Tabi wrote: > On 9/18/18 11:04 PM, Ricardo Ribalda Delgado wrote: > > And should't that be tacked in qcom hardware with something like: > > > > if (!priv->initialized) > > return INPUT; > > > > if you or Timur point me to the harware that was crashing I would not > > mind looking into that, but the current situations seems to me like a > > hack. > > I'd say the previous code was the hack. My comment about not touching > the hardware until it is properly claimed is valid, and it applies to > all platforms. I am a bit uncertain, I understand the reasoning that unless a GPIO line has been "claimed" (i.e. .request() was called on it) then we should not call any of the gpiochip callbacks. But this is merely a convention, the gpiochip becomes what we want it to be and it has the semantics we want it to have. It also makes sense to inquire the direction initially so we know the state of the hardware in the library. I think most gpiochips easily survives calling the .get_direction() early, Qualcomm's stand out here. Now that we have .valid_mask in the gpiochip could we simply just add this back, resepecting valid_mask and avoid checking the direction of precisely these GPIOs? Yours, Linus Walleij