Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp589132pxb; Wed, 27 Jan 2021 16:01:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7Zb9RfjOW0Mx17PlHWEo2rcsqfZvN08gxRxtt/wk/0SleJdqn0QwSn7jNDWu8kZk6+YUZ X-Received: by 2002:aa7:ca51:: with SMTP id j17mr11532368edt.124.1611792099746; Wed, 27 Jan 2021 16:01:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611792099; cv=none; d=google.com; s=arc-20160816; b=KSizlZQm0knetZZmWY2B4tyHtbtj/v008fZjXnF7jY4y1beld49LH5TGMEzoT9P6gy vG4GqbLPIAcdQa4HZtH3KM87XDJhvS0/tM3Dxqq4My5sUF1OKz9Zif5xqiiXB3wK5iLD ZZdXuf57vUomob1nMEjrHUhen31L4aopaYw8C6jo2kG2uTkDMCk8eByG/eogMkG+eJ8r 7X5lG25UilhQxKH9L2X93c9jaM7rLHhWnRu2wGoSbvQuJOqp/mrshWcNa/N91+VJw1hL sFBU2424cyfYD22wY8p+I7q/qMjH/K9IVYO+cd1UR9KbIfRQ8UBT3Jv7KnZn1dfJgTq4 AYaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Qqg87q6fRYh0uVLXRvnL8lduoFCRvpTSBgNlnG7E0/w=; b=kvKJu0WDo1GY9j8neP7xI2Wbrp7QNlUPSa/FAThWIjjo3msDScsOWcdrmTPwwXIjlo u32V+VkjSniLtJzDmhEyYn4MzWTkkiXYZrHT7V7CpipVR3/KTcB3zeog8fpGRYgNaszF rK9zs8ZbmHI0mZ0DVy+JscuoKLOjOeXgQr9pAq9kVWP+kgSoFURigtjRH0qR4/7Ok8by qmW/g7wd00bcFMoopWvIq3Q0ghy3gxZ3N5KebctI0GtI5lz0ZBTjyKqKJd2SPnPmt057 8Yp/bmBOafo9QPMIP0TDv6ys/Z5B6O+mzZNsJTIA7kMzfMasMkn7jeL4ILMzeJaVCdvT SlGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=FN14CvD8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gg14si1526113ejb.367.2021.01.27.16.01.15; Wed, 27 Jan 2021 16:01:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=FN14CvD8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234452AbhA0Oeq (ORCPT + 99 others); Wed, 27 Jan 2021 09:34:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbhA0OcK (ORCPT ); Wed, 27 Jan 2021 09:32:10 -0500 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07494C061573 for ; Wed, 27 Jan 2021 06:31:30 -0800 (PST) Received: by mail-ej1-x62b.google.com with SMTP id w1so2905915ejf.11 for ; Wed, 27 Jan 2021 06:31:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Qqg87q6fRYh0uVLXRvnL8lduoFCRvpTSBgNlnG7E0/w=; b=FN14CvD8/wuqht4OsjLpznRaUft1L7xtWwY+35E69AWs3AqXyeuQa1bd76s/jx+04Z 4d7YeITqS/cz8/THnFZs0YRHwV533A4kJ/izXLQcCR5/rg3ms1O9g7oNAhad1K6iNoQA ZiLT/mW6hidZV7S2bQdXCuZZP16QvHmuYhH6yybQi77O7rRSeCA9McWecfOtazz7UjNM cx40sgXyUweKIR5fic5Mt1ORqvs9zxeFtuMkYQVUBwS+FvyW/RO6NW4xYtPWl/FBBOXN wlWTF5+qGCqU44BzMvFHGk1eGaZO0cH56FMTqiLKMp5b2IDm5fWigUaUIJ4pIR16bUWC e2qA== 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=Qqg87q6fRYh0uVLXRvnL8lduoFCRvpTSBgNlnG7E0/w=; b=B+Fehn/8HW0Cj4woxvJ4bVXNIJXibbbznkrsxeSbBU7gftAJWY4TpKIqWU4hNCmUfu DgiGl9GvORZ+4QdUT93t3NodwgT3DZCERhJ8BqCLDfjQPTReXYYhybmRoYhadFP2HA3q Bcz6V9H3xTDb6ugJ23UIPNcV6ABs8Zu7jf7lXgLy38qu0vFYZk2E7MECiyuzJbL+UkM2 k56q1mhM48p7f3UgPTUDohfYFFRXN/b2YIQdtAO3teG1os1eQt0GeBYs1N1VxSkwz7CQ nRuklLxvn4KoHNzNTE7tdcc2Ghb0fF8x+chmngojOJgftT0bwNdMSnDxDc0UGUggoHpg 8z4Q== X-Gm-Message-State: AOAM530a/1MNwy2MTdHki2KUWfgYtu6vF1yu5guRtwDL14izmeuni23r IhkHXWk9HMKOv2Aetlh97PskiRQ132gFQF0oqr2ePw== X-Received: by 2002:a17:906:9401:: with SMTP id q1mr7256319ejx.516.1611757888748; Wed, 27 Jan 2021 06:31:28 -0800 (PST) MIME-Version: 1.0 References: <20210122193600.1415639-1-saravanak@google.com> In-Reply-To: From: Bartosz Golaszewski Date: Wed, 27 Jan 2021 15:31:17 +0100 Message-ID: Subject: Re: [PATCH v5] gpiolib: Bind gpio_device to a driver to enable fw_devlink=on by default To: Greg Kroah-Hartman Cc: Saravana Kannan , Linus Walleij , Marc Zyngier , Jisheng Zhang , Kever Yang , kernel-team@android.com, linux-gpio , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 27, 2021 at 3:22 PM Greg Kroah-Hartman wrote: > > On Fri, Jan 22, 2021 at 11:35:59AM -0800, Saravana Kannan wrote: > > There are multiple instances of GPIO device tree nodes of the form: > > > > foo { > > compatible = "acme,foo"; > > ... > > > > gpio0: gpio0@xxxxxxxx { > > compatible = "acme,bar"; > > ... > > gpio-controller; > > }; > > > > gpio1: gpio1@xxxxxxxx { > > compatible = "acme,bar"; > > ... > > gpio-controller; > > }; > > > > ... > > } > > > > bazz { > > my-gpios = <&gpio0 ...>; > > } > > > > Case 1: The driver for "foo" populates struct device for these gpio* > > nodes and then probes them using a driver that binds with "acme,bar". > > This driver for "acme,bar" then registers the gpio* nodes with gpiolib. > > This lines up with how DT nodes with the "compatible" property are > > typically converted to struct devices and then registered with driver > > core to probe them. This also allows the gpio* devices to hook into all > > the driver core capabilities like runtime PM, probe deferral, > > suspend/resume ordering, device links, etc. > > > > Case 2: The driver for "foo" doesn't populate struct devices for these > > gpio* nodes before registering them with gpiolib. Instead it just loops > > through its child nodes and directly registers the gpio* nodes with > > gpiolib. > > > > Drivers that follow case 2 cause problems with fw_devlink=on. This is > > because fw_devlink will prevent bazz from probing until there's a struct > > device that has gpio0 as its fwnode (because bazz lists gpio0 as a GPIO > > supplier). Once the struct device is available, fw_devlink will create a > > device link with gpio0 device as the supplier and bazz device as the > > consumer. After this point, since the gpio0 device will never bind to a > > driver, the device link will prevent bazz device from ever probing. > > > > Finding and refactoring all the instances of drivers that follow case 2 > > will cause a lot of code churn and it is not something that can be done > > in one shot. In some instances it might not even be possible to refactor > > them cleanly. Examples of such instances are [1] [2]. > > > > This patch works around this problem and avoids all the code churn by > > simply setting the fwnode of the gpio_device and creating a stub driver > > to bind to the gpio_device. This allows all the consumers to continue > > probing when the driver follows case 2. > > > > [1] - https://lore.kernel.org/lkml/20201014191235.7f71fcb4@xhacker.debian/ > > [2] - https://lore.kernel.org/lkml/e28e1f38d87c12a3c714a6573beba6e1@kernel.org/ > > Cc: Marc Zyngier > > Cc: Jisheng Zhang > > Cc: Kever Yang > > Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default") > > As this commit is in my driver-core git tree, can I just take this in > the same tree? Can I get an ack from the maintainer for this? > > thanks, > > greg k-h Go ahead. Acked-by: Bartosz Golaszewski