Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4130248pxb; Mon, 1 Feb 2021 13:18:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/C1WSgR0Na3D06ZA4KQ472CaZaByiAFHqPaqcRtkiGfKS8t5NJlv3GU9rT+U7G2v/qi+d X-Received: by 2002:a17:906:2b18:: with SMTP id a24mr4926289ejg.50.1612214296387; Mon, 01 Feb 2021 13:18:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612214296; cv=none; d=google.com; s=arc-20160816; b=wlVvCweNGqNTF5R+9icTT5DSU70U1u5/kDXeTjXIVeEd+jsB+CoDzl4/Zhlfh3NKbz wfZ7O8MNx6d0/LO4D2lEvsBr1TOUXTqFvG+vLAwz3mSIIuVjKYk4O/LYOrg/XHo3wMfd lNbMZbhtcwarpLIqMbkuCaC5q0PxCCTOH1cbaMme50RW6uP9eMiZ/exIOYqk1TLFwAX5 5U8QF9ka5+B5e/1Ywh2UZAu1xUqX/Qij1NLb9m9mH2V3WPz8W7hTKlJjn1GOiB8J+OWU oAv+jviDuCYaslq2bqpfJWbIiDgbD7BFgQACnNLNva1IXi943D//JMCefHhIyelG0E3h sa0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=irOj1nASK0NREc3BcDFDuw6eRYD59HzaD0YvEhbe2rA=; b=A6kUNW+aaGw9gVLmfit7lDb25mZHwN8Qy7v2c+0K9EgYmN2RYvORgnGOWVitaBZ58i sjqR9wqaVkyoT+g1jUsCju8eXKfbkd7VwS2E4n0tRn8J3j9n1mpeZy8+R+t8XMojADFF sCCWNFgmqq1sboBv0hMKiknEPZqDYfIXiKGCi5/R/BqerrnGVXPyYekJ07RvYrydfwPj OQI8/q4hvyWYY90LGXaE22Tih8ENaEdqaqseU4PtFiZIdd1rJvB5iLNOW71gjYqMYJQs 6KORbo2s7xZdPgjCQzzAUlw15lYdWynJAXy2ct045oMwonApynZAnow2Vyk4ijOa0CWH RTKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=r6u2S91U; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s25si11096878ejz.751.2021.02.01.13.17.40; Mon, 01 Feb 2021 13:18:16 -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=@gmail.com header.s=20161025 header.b=r6u2S91U; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232202AbhBAVQ0 (ORCPT + 99 others); Mon, 1 Feb 2021 16:16:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229525AbhBAVQZ (ORCPT ); Mon, 1 Feb 2021 16:16:25 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C59CC061756; Mon, 1 Feb 2021 13:15:45 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id e15so4661621lft.13; Mon, 01 Feb 2021 13:15:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=irOj1nASK0NREc3BcDFDuw6eRYD59HzaD0YvEhbe2rA=; b=r6u2S91UMDxQwNdFTsw6DnqRBYyHcKo6KI5z0VToO/XYoEQDiQSd1LiKk82mPbMBuu tDuND+PJGJzf0S3OW0DJ2FnLDRrsvjRa766Iby5rjjIFf7B+8jpTAxaPk+8qY9muwp0o EzUkwQuUEVMQN1WV4njw4EvOlpbY6W8bjwlVb9BVzivY2fwVv8u0YC588ma3YgNqIzMR FLHSJyJ8oioo1j0D8N85ZjUegpJNVIoHQ54qOkOGabg604XOPas8rD2Sjj8uDj3WgnXE P42zY6QD2t+cZjXGY7k/h0OeXjrUqWix4u5r0MzEdzE5wrMjX1rlns5sAnglDWroy2wA FxxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=irOj1nASK0NREc3BcDFDuw6eRYD59HzaD0YvEhbe2rA=; b=gZHG0PhAznycy1SESzPmUIuCOvjrUUNJTLlHvHGEwxbm8Gp2lhaWPdxDrXkeIgAR7m vAmqBNpgz+M0f9HB7BgryItZ8EDu7EGnvIdGqzaP/OOIfQQaKIjtyz2jaPUJOiUj1BxD iQT8dFilwjutXqdoaDYvVdC13hhKuN6iqJgIcwlNQHgkuu7+ElVwU7Cx66cKwiRkwzMa buj3fm3eznX2i7h5YjBf3g0meuWKLnETTh+CUgMmirU2Y6SoDqUzlfEcmUNyURlnJ9vS BhFFYihaMqygAPGzTw6WQecMnZQ1HaV4y9P23hWbCrQZkvbRQNLCbF1kmzJIsJAI53EQ LXqQ== X-Gm-Message-State: AOAM533dz83QoOxS2rJ1r4N7MqzP837JRRdvY7sciBIM/L694up+O/TP hCi3aue8fukmC/eerymDTotTIWl8UXY= X-Received: by 2002:ac2:4ad0:: with SMTP id m16mr3317361lfp.53.1612214143755; Mon, 01 Feb 2021 13:15:43 -0800 (PST) Received: from ?IPv6:2a00:1370:814d:ea25:a10:76ff:fe69:21b6? ([2a00:1370:814d:ea25:a10:76ff:fe69:21b6]) by smtp.googlemail.com with ESMTPSA id o16sm988956lft.44.2021.02.01.13.15.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Feb 2021 13:15:43 -0800 (PST) Subject: Re: [PATCH v5] gpiolib: Bind gpio_device to a driver to enable fw_devlink=on by default To: Saravana Kannan Cc: Linus Walleij , Bartosz Golaszewski , Greg Kroah-Hartman , Marc Zyngier , Jisheng Zhang , Kever Yang , Android Kernel Team , "open list:GPIO SUBSYSTEM" , LKML , "linux-tegra@vger.kernel.org" References: <20210122193600.1415639-1-saravanak@google.com> <544ad0e4-0954-274c-8e77-866aaa5661a8@gmail.com> <09502076-02e9-39ee-e432-24260696a927@gmail.com> From: Dmitry Osipenko Message-ID: Date: Tue, 2 Feb 2021 00:15:42 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 01.02.2021 23:15, Saravana Kannan пишет: > On Mon, Feb 1, 2021 at 8:49 AM Dmitry Osipenko wrote: >> >> 01.02.2021 00:28, Saravana Kannan пишет: >>>> This patch causes these new errors on NVIDIA Tegra30 Nexus 7 using recent linux-next: >>>> >>>> gpio-1022 (cpu-pwr-req-hog): hogged as input >>>> max77620-pinctrl max77620-pinctrl: pin gpio4 already requested by max77620-pinctrl; cannot claim for gpiochip1 >>>> max77620-pinctrl max77620-pinctrl: pin-4 (gpiochip1) status -22 >>>> max77620-pinctrl max77620-pinctrl: could not request pin 4 (gpio4) from group gpio4 on device max77620-pinctrl >>>> gpio_stub_drv gpiochip1: Error applying setting, reverse things back >>>> gpio_stub_drv: probe of gpiochip1 failed with error -22 >>>> >>>> Please fix, thanks in advance. >>> I have a partial guess on why this is happening. So can you try this patch? >>> >>> Thanks, >>> Saravana >>> >>> --- a/drivers/gpio/gpiolib.c >>> +++ b/drivers/gpio/gpiolib.c >>> @@ -4213,6 +4213,8 @@ static int gpio_stub_drv_probe(struct device *dev) >>> * gpio_device of the GPIO chip with the firmware node and then simply >>> * bind it to this stub driver. >>> */ >>> + if (dev->fwnode && dev->fwnode->dev != dev) >>> + return -EBUSY; >>> return 0; >>> } >> >> This change doesn't help, exactly the same errors are still there. > > Sorry, I see what's happening. Try this instead. If it works, I'll > send out a proper patch. > > Thanks, > Saravana > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > index 8e0564c50840..f3d0ffe8a930 100644 > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -56,8 +56,10 @@ > static DEFINE_IDA(gpio_ida); > static dev_t gpio_devt; > #define GPIO_DEV_MAX 256 /* 256 GPIO chip devices supported */ > +static int gpio_bus_match(struct device *dev, struct device_driver *drv); > static struct bus_type gpio_bus_type = { > .name = "gpio", > + .match = gpio_bus_match, > }; > > /* > @@ -4199,6 +4201,14 @@ void gpiod_put_array(struct gpio_descs *descs) > } > EXPORT_SYMBOL_GPL(gpiod_put_array); > > + > +static int gpio_bus_match(struct device *dev, struct device_driver *drv) > +{ > + if (dev->fwnode && dev->fwnode->dev != dev) > + return 0; > + return 1; > +} > + > static int gpio_stub_drv_probe(struct device *dev) > { > /* > This works, thank you! Tested-by: Dmitry Osipenko