linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saravana Kannan <saravanak@google.com>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Marc Zyngier <maz@kernel.org>,
	Jisheng Zhang <Jisheng.Zhang@synaptics.com>,
	Kever Yang <kever.yang@rock-chips.com>,
	Android Kernel Team <kernel-team@android.com>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>
Subject: Re: [PATCH v5] gpiolib: Bind gpio_device to a driver to enable fw_devlink=on by default
Date: Mon, 1 Feb 2021 12:15:53 -0800	[thread overview]
Message-ID: <CAGETcx9fqnCZTC=afDUHnS6gES8WW4SwFNmH5sWaGVRYiysOMQ@mail.gmail.com> (raw)
In-Reply-To: <09502076-02e9-39ee-e432-24260696a927@gmail.com>

On Mon, Feb 1, 2021 at 8:49 AM Dmitry Osipenko <digetx@gmail.com> 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)
 {
        /*

  reply	other threads:[~2021-02-01 20:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 19:35 [PATCH v5] gpiolib: Bind gpio_device to a driver to enable fw_devlink=on by default Saravana Kannan
2021-01-23 22:52 ` Linus Walleij
2021-01-24  2:53   ` Saravana Kannan
2021-01-24 22:48     ` Linus Walleij
2021-01-26  8:14       ` Greg Kroah-Hartman
     [not found] ` <CAHp75VfKiuVd7JO-0nwCuvy7tgPZScOpKX8Q4+oT+JSBR+d=ew@mail.gmail.com>
2021-01-26 18:16   ` [PATCH v2] " Saravana Kannan
2021-01-26 18:32     ` Andy Shevchenko
2021-01-27 14:22 ` [PATCH v5] " Greg Kroah-Hartman
2021-01-27 14:31   ` Bartosz Golaszewski
2021-01-27 15:04     ` Greg Kroah-Hartman
2021-01-30 17:39 ` Dmitry Osipenko
2021-01-31 21:28   ` Saravana Kannan
2021-02-01 16:49     ` Dmitry Osipenko
2021-02-01 20:15       ` Saravana Kannan [this message]
2021-02-01 21:15         ` Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGETcx9fqnCZTC=afDUHnS6gES8WW4SwFNmH5sWaGVRYiysOMQ@mail.gmail.com' \
    --to=saravanak@google.com \
    --cc=Jisheng.Zhang@synaptics.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=digetx@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@android.com \
    --cc=kever.yang@rock-chips.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=maz@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).