Re: [PATCH v5] gpiolib: Bind gpio_device to a driver to enable fw_devlink=on by default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux