linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: [PATCHv2 2/4] net: rfkill: gpio: get the name and type from device property
Date: Mon, 25 Jan 2016 12:03:47 +0300	[thread overview]
Message-ID: <1453712629-143317-3-git-send-email-heikki.krogerus@linux.intel.com> (raw)
In-Reply-To: <1453712629-143317-1-git-send-email-heikki.krogerus@linux.intel.com>

This prepares the driver for removal of platform data.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 net/rfkill/rfkill-gpio.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index 4b1e3f3..1a9c031 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -81,7 +81,6 @@ static int rfkill_gpio_acpi_probe(struct device *dev,
 	if (!id)
 		return -ENODEV;
 
-	rfkill->name = dev_name(dev);
 	rfkill->type = (unsigned)id->driver_data;
 
 	return acpi_dev_add_driver_gpios(ACPI_COMPANION(dev),
@@ -93,12 +92,21 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
 	struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;
 	struct rfkill_gpio_data *rfkill;
 	struct gpio_desc *gpio;
+	const char *type_name;
 	int ret;
 
 	rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL);
 	if (!rfkill)
 		return -ENOMEM;
 
+	device_property_read_string(&pdev->dev, "name", &rfkill->name);
+	device_property_read_string(&pdev->dev, "type", &type_name);
+
+	if (!rfkill->name)
+		rfkill->name = dev_name(&pdev->dev);
+
+	rfkill->type = rfkill_find_type(type_name);
+
 	if (ACPI_HANDLE(&pdev->dev)) {
 		ret = rfkill_gpio_acpi_probe(&pdev->dev, rfkill);
 		if (ret)
@@ -124,10 +132,8 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
 
 	rfkill->shutdown_gpio = gpio;
 
-	/* Make sure at-least one of the GPIO is defined and that
-	 * a name is specified for this instance
-	 */
-	if ((!rfkill->reset_gpio && !rfkill->shutdown_gpio) || !rfkill->name) {
+	/* Make sure at-least one GPIO is defined for this instance */
+	if (!rfkill->reset_gpio && !rfkill->shutdown_gpio) {
 		dev_err(&pdev->dev, "invalid platform data\n");
 		return -EINVAL;
 	}
-- 
2.7.0.rc3


  parent reply	other threads:[~2016-01-25  9:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25  9:03 [PATCHv2 0/4] net: rfkill: gpio: replace platform data with build-in property Heikki Krogerus
2016-01-25  9:03 ` [PATCHv2 1/4] net: rfkill: add rfkill_find_type function Heikki Krogerus
2016-01-25  9:03 ` Heikki Krogerus [this message]
2016-01-25  9:03 ` [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio Heikki Krogerus
2016-01-25 12:18   ` Thierry Reding
2016-01-25 20:59     ` [PATCHv2 3/4] ARM: tegra: use build-in device properties withrfkill_gpio Marc Dietrich
2016-01-26  8:46       ` Johannes Berg
2016-01-26  8:52         ` [PATCHv2 3/4] ARM: tegra: use build-in device propertieswithrfkill_gpio Marc Dietrich
2016-01-26  8:42     ` [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio Johannes Berg
2016-02-18 20:04       ` Johannes Berg
2016-02-19 18:03         ` Thierry Reding
2016-02-23 10:31           ` Johannes Berg
2016-02-23 10:15         ` Arnd Bergmann
2016-02-23 10:31           ` Arnd Bergmann
2016-02-23 10:38             ` Marc Dietrich
2016-02-23 13:17               ` Arnd Bergmann
2016-02-23 13:42                 ` Marc Dietrich
2016-02-23 15:06                   ` Arnd Bergmann
2016-02-23 20:39                     ` Johannes Berg
2016-01-25  9:03 ` [PATCHv2 4/4] net: rfkill: gpio: remove rfkill_gpio_platform_data Heikki Krogerus

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=1453712629-143317-3-git-send-email-heikki.krogerus@linux.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.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).