Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1002715imm; Tue, 2 Oct 2018 00:38:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV60f0GDHIQql/Bc/ugGbU+w8sW0a5yFsr0YQPOx9e5rPcvs56bdJjtn+7Cxtpr8ChE5NFvLG X-Received: by 2002:a63:de05:: with SMTP id f5-v6mr13372641pgg.292.1538465921830; Tue, 02 Oct 2018 00:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538465921; cv=none; d=google.com; s=arc-20160816; b=Fg2fc8wXLLjFmzrZpYGYZsqayCat8P0C9EJpbxAZVopGOPEYsg+lD/lIo7Xwi1BIb9 iMTxk7VzLXlyOTlpZXNxP6Bywtae/02nfNfXo4QaaoTV3m6KihCYaPYxKc4R6eoBOE4D TBn2rUBOqZWDdz6aGlpgeXUrcEP5oQ3d0U7/lw1BaYLNGozvUcxMFTdM9g9/vEj8vDkm eGNe6JL6wGA6SzWR0RMggoFnT7uZJQOL1KAEfVlT6gZA4Zjz55q0wpwAoiYmpYRYPioq TnH3JgDhoaaEXHGpynYaBEQF0b650jf4g5uM0fqUeGVRRntyqWwmlOrG4ydlVmW0t9j8 pQmQ== 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=ZIFVwKcegaKlBtuId7khisMMeBY0nBOFH9sAxDM8maU=; b=Q6i5lGOw6yiF3ZNXmYBVc0HwapI3hivySadonA47wX5yA8IGq+POfscRK8EK/lu62z YTTwyUCl6wXZ+hr+I4c1FmgVrUIJOqCUG3kXcLPPHL5VnfPvf7G5cYn5ytWM7IqAUV5p b0QQAxExm1PzRTaLMUl+Xx15gIjRcCS8o5MEj5Xhy8LpSXgyRAsJRsEb8tyLxUfsxOni eNzi+3POpmfn8z99QGxVMQKX3mJeuG6L4TO1Vq0dOgh6fbK12cwUZILG5Zd1ztgbGKTx lcGMURZQ8qTvIR7z0uw9qMeBG3r5mReTgPSwZ3szMxkprwd+xMDTJYZFHRgmVNN3kLvA idSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ELl1vi5A; 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 g8-v6si15901824pli.338.2018.10.02.00.38.26; Tue, 02 Oct 2018 00:38:41 -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=ELl1vi5A; 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 S1726884AbeJBOUL (ORCPT + 99 others); Tue, 2 Oct 2018 10:20:11 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:41632 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726822AbeJBOUK (ORCPT ); Tue, 2 Oct 2018 10:20:10 -0400 Received: by mail-io1-f67.google.com with SMTP id q4-v6so1321805iob.8 for ; Tue, 02 Oct 2018 00:38:18 -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=ZIFVwKcegaKlBtuId7khisMMeBY0nBOFH9sAxDM8maU=; b=ELl1vi5Aqjbi4A05jc39T+3r1R1JQg0yHXF3hwHqDfjqS/TQlSqBztVgtyEGjDHbZk mTeeL+1MYbKGg/Nl47XGJZ2yzPnlBwbbmuqSG5BNOjz8wToPZnp5CheAZJrPI2IaPu4d INktiDBFuRCMn4oezdAYtwurbkNandYksAm9s= 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=ZIFVwKcegaKlBtuId7khisMMeBY0nBOFH9sAxDM8maU=; b=rcA8lXkGhD2Yj2Ci5dVssvjTZYGHysx9N1v1AFIOTv8t1kyVWXqOx1yMg/KNyhSBob JCb/jpf6ACacEaKtON0BVkSiEAcZ/Xk/gewDTaoQGhzB2RllMIxMFWAsqVB+xaD7SAkn lWKigaKiG1SUQUQu47xSx2w3CPCLKr8iBLYT8eZ0PpzjR+0YgPUKy/wxK+6mnapGu0dI 5vXhTSdhC8c9aAKgM3Y6Oq/GksXJ9TJBa4RkXg2Ew1ceEP6kUxgZmQ+Ai7QyFcNFd0Q+ bLvgB5BIe1R5uY+R/lcqfsh5VhJQDOtZNnxFEoa/7Y9sh/nLKK0VwWSBgxdVAuv2HO/v 9m/w== X-Gm-Message-State: ABuFfohBUTlvT4GBjmOIRjB2NDAPFEPYkp0iNo2rHXWzF3BF4ojM/ehL oLRb1Iz0ibvrSZJjMnNEUZwRaZqCULD34E+14ZBMJA== X-Received: by 2002:a6b:4006:: with SMTP id k6-v6mr8851843ioa.277.1538465897665; Tue, 02 Oct 2018 00:38:17 -0700 (PDT) MIME-Version: 1.0 References: <20180921103604.13361-1-ricardo.ribalda@gmail.com> <20180921103604.13361-2-ricardo.ribalda@gmail.com> <153803107307.119890.10052910965015646333@swboyd.mtv.corp.google.com> <3e07cab8-0f3e-7474-8f6d-e6bb16e8f998@codeaurora.org> <5aea282d-6fc9-cd70-cec4-10f28aa819b9@codeaurora.org> In-Reply-To: From: Linus Walleij Date: Tue, 2 Oct 2018 09:38:05 +0200 Message-ID: Subject: Re: [PATCH v2] gpiolib: Show correct direction from the beginning To: Ricardo Ribalda Delgado Cc: timur@kernel.org, jhugo@codeaurora.org, Stephen Boyd , "linux-kernel@vger.kernel.org" , "open list:GPIO SUBSYSTEM" 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 Tue, Oct 2, 2018 at 9:15 AM Ricardo Ribalda Delgado wrote: > On Mon, Oct 1, 2018 at 11:20 PM Linus Walleij wrote: > > gpiochip_add_data() doesn't allocate anything, it > > just adds a already allocated (or static!) gpio_chip > > to the gpiolib subsystem. > > Take a look to gpiochip_add_data_with_key() > ->gpiochip_init_valid_mask() > -> gpiochip->valid_mask = gpiochip_allocate_mask(gpiochip); Aha I see... > > In fact I think it is wrong to set up the mask after > > calling gpiolob_add_data(), because of exactly the > > type of problem you're seeing. > > I agree, and I believe that the cleaner way would be to add a function > pointer that replaces: > > gpiochip_allocate_mask() > bitmap_fill(p, chip->ngpio); > > with a proper initalization from the driver OK > But as today the only driver that seems to be using valid_mask is msm, > so perhaps a hack is something better and then when we have a second > driver that requires it we figure out the real requirements. But it is > definately your decision ;) I would just add some exported function to gpiolib to do what you need so you can set up the valid_mask before calling gpiochip_add*. Yours, Linus Walleij