Message ID | 1435253451-19817-2-git-send-email-grygorii.strashko@ti.com |
---|---|
State | New |
Headers | show |
On Fri, Jun 26, 2015 at 2:30 AM, Grygorii Strashko <grygorii.strashko@ti.com> wrote: > Assign GPIO chip owner field to chip->dev->driver->owner if it was not > configured by GPIO driver. Sounds good, setting this field manually seems to make less and less sense anyway as most drivers follow the device model. > > Cc: Johan Hovold <johan@kernel.org> > Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> > --- > Hi, > > There is also one positive additional side effect: > lines like below can be removed from a lot of GPIO > drivers > rdc321x_gpio_dev->chip.owner = THIS_MODULE; A good idea for a follow-up patch! ;) Acked-by: Alexandre Courbot <acourbot@nvidia.com> -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Jun 25, 2015 at 7:30 PM, Grygorii Strashko <grygorii.strashko@ti.com> wrote: > Assign GPIO chip owner field to chip->dev->driver->owner if it was not > configured by GPIO driver. > > Cc: Johan Hovold <johan@kernel.org> > Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Patch applied with Alex' review tag. > There is also one positive additional side effect: > lines like below can be removed from a lot of GPIO > drivers > rdc321x_gpio_dev->chip.owner = THIS_MODULE; Yes let's do this :) Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Jul 16, 2015 at 1:22 PM, Linus Walleij <linus.walleij@linaro.org> wrote: > On Thu, Jun 25, 2015 at 7:30 PM, Grygorii Strashko > <grygorii.strashko@ti.com> wrote: > >> Assign GPIO chip owner field to chip->dev->driver->owner if it was not >> configured by GPIO driver. >> >> Cc: Johan Hovold <johan@kernel.org> >> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> > > Patch applied with Alex' review tag. > >> There is also one positive additional side effect: >> lines like below can be removed from a lot of GPIO >> drivers >> rdc321x_gpio_dev->chip.owner = THIS_MODULE; > > Yes let's do this :) Or actually, I have had some second thought to why gpio_chip is duplicating struct members from struct device at all. Why should it even have "owner" and "of_node"? Should we not just rewrite this code to follow the struct device *dev pointer in gpio_chip and use "owner" and "of_node" from there? Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 07/16/2015 02:25 PM, Linus Walleij wrote: > On Thu, Jul 16, 2015 at 1:22 PM, Linus Walleij <linus.walleij@linaro.org> wrote: >> On Thu, Jun 25, 2015 at 7:30 PM, Grygorii Strashko >> <grygorii.strashko@ti.com> wrote: >> >>> Assign GPIO chip owner field to chip->dev->driver->owner if it was not >>> configured by GPIO driver. >>> >>> Cc: Johan Hovold <johan@kernel.org> >>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> >> >> Patch applied with Alex' review tag. >> >>> There is also one positive additional side effect: >>> lines like below can be removed from a lot of GPIO >>> drivers >>> rdc321x_gpio_dev->chip.owner = THIS_MODULE; >> >> Yes let's do this :) > > Or actually, I have had some second thought to why gpio_chip > is duplicating struct members from struct device at all. > > Why should it even have "owner" and "of_node"? > > Should we not just rewrite this code to follow the struct device *dev > pointer in gpio_chip and use "owner" and "of_node" from there? > Seems not all drivers implemented using Dev/Driver approach, so they don't have dev at all ;) gpio-samsung.c for example (non-DT driver).
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 9b1d247..d51af5d 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -287,6 +287,9 @@ int gpiochip_add(struct gpio_chip *chip) INIT_LIST_HEAD(&chip->pin_ranges); #endif + if (!chip->owner && chip->dev && chip->dev->driver) + chip->owner = chip->dev->driver->owner; + of_gpiochip_add(chip); acpi_gpiochip_add(chip);
Assign GPIO chip owner field to chip->dev->driver->owner if it was not configured by GPIO driver. Cc: Johan Hovold <johan@kernel.org> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> --- Hi, There is also one positive additional side effect: lines like below can be removed from a lot of GPIO drivers rdc321x_gpio_dev->chip.owner = THIS_MODULE; drivers/gpio/gpiolib.c | 3 +++ 1 file changed, 3 insertions(+)