mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>
Cc: Sekhar Nori <nsekhar@ti.com>, <linux-gpio@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Grygorii Strashko <grygorii.strashko@ti.com>,
	Johan Hovold <johan@kernel.org>
Subject: [PATCH 2/2] gpiolib: assign chip owner to dev->driver->owner if not set
Date: Thu, 25 Jun 2015 20:30:51 +0300	[thread overview]
Message-ID: <1435253451-19817-2-git-send-email-grygorii.strashko@ti.com> (raw)
In-Reply-To: <1435253451-19817-1-git-send-email-grygorii.strashko@ti.com>

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(+)

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);
 
-- 
2.4.4


  reply	other threads:[~2015-06-25 17:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25 17:30 [PATCH 1/2] gpiolib: irqchip: prevent driver unloading if gpio is used as irq only Grygorii Strashko
2015-06-25 17:30 ` Grygorii Strashko [this message]
2015-06-30 13:41   ` [PATCH 2/2] gpiolib: assign chip owner to dev->driver->owner if not set Alexandre Courbot
2015-07-16 11:22   ` Linus Walleij
2015-07-16 11:25     ` Linus Walleij
2015-07-16 11:53       ` Grygorii Strashko
2015-06-30 13:47 ` [PATCH 1/2] gpiolib: irqchip: prevent driver unloading if gpio is used as irq only Alexandre Courbot
2015-07-16 11:20 ` Linus Walleij

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=1435253451-19817-2-git-send-email-grygorii.strashko@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=gnurou@gmail.com \
    --cc=johan@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nsekhar@ti.com \
    /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

all inboxes | Powered by JetHome®