Received: by 10.192.165.156 with SMTP id m28csp2379863imm; Thu, 12 Apr 2018 13:19:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/nGc7nKUV0SIjFLQg0ZSJjSCqlvQdlXQ1R25t7O/gEmmuAkRwBONrzxpKYMDFnsZ3+uC2p X-Received: by 10.99.122.70 with SMTP id j6mr1777625pgn.269.1523564340818; Thu, 12 Apr 2018 13:19:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523564340; cv=none; d=google.com; s=arc-20160816; b=BJ1ocIEb/BdjRYSVGQhlk6jlCJWflz0JX2s+BHF9W5s/WRuepEQDUoSc4aFGbBCBGz 8F3C9TgVL9/ATV8tulwYkE4bPXi5XgGq44H2Qn2G5B8QvbkRPVN6DkPxFlJQGKVR0+6z WP6oYoji7jkfu7M1tg3SUog8oRaopJ3qEOP1WkFro1oAUqWefi6SvXAL9/AfGfaJieoD 4Ft1MzROD8d85WRDs/Km/T/MOrQMFwQygi17I05t5j2nLA3LP6JYfY8PA1WhEr0EftTm f7vAh/NaK1adyktIx+mTvkXLoYxMiJ+fR8IuBd+9ENGjQZXWxQEijptHhzLWkmck3Wic EAtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=frlEpkx76aHB2MYngHV7qOkjBtija6sC6i6/bZ7GdYI=; b=Nws8DnP1R+Vtijb/1gynKERt4c5TKcnhzv4tQBYCQNk5jypfqY4NEHHyy6DY5wJT6b AjELV9zb/NOHIs9hNb1ATZ413A8pmXUTu1h0KMvxL2+P6xKv7O+MhfGR9cxSOsqrZKkk 5SwHiA6JO6eUi/iT7zoRqET5TPOqTinjvW2B0Lxv6TMSeYJAIUur1S3Q0eYWooWGynoH Kmq/bwwUJe9SBG0+YICUcSUEisJrdisaHw4hUhQopD1qc2bzV+Mjik42U3rhtU+nMT6T /sPGZb/zbX5oSdxjJJH+P9gJfuQlHpG+enf2yqoYzPxNytfYK5ofx9Z3eFwdLfrX2faC 44UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Pf/tutnc; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h91-v6si3931389pld.716.2018.04.12.13.18.47; Thu, 12 Apr 2018 13:19:00 -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=@gmail.com header.s=20161025 header.b=Pf/tutnc; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753681AbeDLUAO (ORCPT + 99 others); Thu, 12 Apr 2018 16:00:14 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:46836 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752923AbeDLUAL (ORCPT ); Thu, 12 Apr 2018 16:00:11 -0400 Received: by mail-wr0-f196.google.com with SMTP id d1so6220959wrj.13; Thu, 12 Apr 2018 13:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=frlEpkx76aHB2MYngHV7qOkjBtija6sC6i6/bZ7GdYI=; b=Pf/tutnc3OUv5KynQBd8eBJ2oZXWUAJTNRBz30I8EtJoqaSWLk0+preRstn582JuGo WI5ybkBL7odXW/pQtkmm+oMI8a7Wf436RJyaZwaihUG6wtyVcl+Pwvc828Xdmsxo33ps 55THyUohNJIr/lBsixV6/T9ObwURxPjlTdHb6pyEXT9ZvK07TOsLYjvou0X9roHTaQGs HA+0kagJJl0DNQMIsN8wUpgu9mIz8DYyd3Q3BcKv6qi0NsDHnz9tdn2yYjCUfuad/4s4 ApXHG2eviSpDeSY7prPN/WUoc0L5aVBGlzqckGld5ttLLYXlS5Hk6yru10ttsWEFI4kt /0+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=frlEpkx76aHB2MYngHV7qOkjBtija6sC6i6/bZ7GdYI=; b=sSLZbkgZhg42IbWddRw7togpoxilgkFwsJDIKOil2m723oltw+oA9weQASTIdOKJIC OD7EaL+FlO5FEARg94DSVWrlN3LwxSyFHb1XgWUaFvF8BJ4Lcp4l2ARaJ48S6jfXf+8u dxXg1XYP4QG3LP9Hd3RcEeJuvQMH5KrAJL/L3Wnrg3/2kobvmqnO0TTKFmd/JXfZQJQs HPg2m/kY5VFnfPoavGAlt0XLImC0m6JHhmk0amwu6rALVZ7148n2q2un+knZTJMrhu1i k7ZdV4KA8QnNc+UgfGbk8onul64SAIylBrzDDS6hoFSgc5rknQXGKWCFE+t/xh/VP9TT PI2g== X-Gm-Message-State: ALQs6tBtG8JfBPRy6ilJ60fwkcDPOosBPQABlKtkHZ6de/5HEzd9jIcQ rx3CC15XHIYCDdm2zYxUS11whMyC X-Received: by 10.223.135.51 with SMTP id a48mr1629618wra.242.1523563210281; Thu, 12 Apr 2018 13:00:10 -0700 (PDT) Received: from debian64.daheim (p200300D5FBC4BDFC0000000000000830.dip0.t-ipconnect.de. [2003:d5:fbc4:bdfc::830]) by smtp.gmail.com with ESMTPSA id m35sm5632218wrm.59.2018.04.12.13.00.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Apr 2018 13:00:08 -0700 (PDT) Received: from localhost.daheim ([127.0.0.1] helo=debian64.localnet) by debian64.daheim with esmtp (Exim 4.90_1) (envelope-from ) id 1f6iO7-0003r1-R7; Thu, 12 Apr 2018 22:00:07 +0200 From: Christian Lamparter To: Bartosz Golaszewski Cc: Linus Walleij , Jonathan Corbet , linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] gpiolib: add hogs support for machine code Date: Thu, 12 Apr 2018 22:00:07 +0200 Message-ID: <17720832.6ELUnVt0BR@debian64> In-Reply-To: <20180410203028.11412-1-brgl@bgdev.pl> References: <20180410203028.11412-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Dienstag, 10. April 2018 22:30:28 CEST Bartosz Golaszewski wrote: > Board files constitute a significant part of the users of the legacy > GPIO framework. In many cases they only export a line and set its > desired value. We could use GPIO hogs for that like we do for DT and > ACPI but there's no support for that in machine code. > > This patch proposes to extend the machine.h API with support for > registering hog tables in board files. > > Signed-off-by: Bartosz Golaszewski > --- > @@ -1326,6 +1364,8 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, > > acpi_gpiochip_add(chip); > > + machine_gpiochip_add(chip); > + > /* > * By first adding the chardev, and then adding the device, > * we get a device node entry in sysfs under > @@ -3462,6 +3502,33 @@ void gpiod_remove_lookup_table(struct gpiod_lookup_table *table) I think I see the same problem right here in regards to pinctrls and gpiohogs that have with DeviceTree: The problem is that unlike native gpio-controllers, pinctrls need to have a "pin/gpio range" defined before any gpio-hogs can be added. If this is not the case the generic pinctrl_gpio_reguest() [0] will fail with -EPROBE_DEFER at this point. (see the call chain in the "pinctrl: msm: fix gpio-hog related boot issueslogin register" mail starting from gpiod_hog). And now the crux of the matter is that currently in order for pinctrl drivers to register the range they have to call gpiochip_add_pin_range() [1]. But they only can do it after the gpiochip_add_data_with_key() [2], since this function initializes the pin_ranges list [3]. So what will happen is that you'll get an "gpiochip_machine_hog: unable to hog GPIO line $LABEL $GPIONR -517" error for every single gpio-hog and wonder why :(. Regards, Christian [0] [1] [2] [3]