From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: [PATCH 3/5] net: rfkill: gpio: get the name and type from device property
Date: Wed, 5 Aug 2015 16:39:05 +0300 [thread overview]
Message-ID: <1438781947-7952-4-git-send-email-heikki.krogerus@linux.intel.com> (raw)
In-Reply-To: <1438781947-7952-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 d5d58d9..07323c3 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.4.6
next prev parent reply other threads:[~2015-08-05 13:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-05 13:39 [PATCH 0/5] net: rfkill: gpio: replace platform data with build-in property Heikki Krogerus
2015-08-05 13:39 ` [PATCH 1/5] device property: helper macros for property entry creation Heikki Krogerus
2015-08-05 14:02 ` Andy Shevchenko
2015-08-05 14:12 ` Shevchenko, Andriy
2015-08-06 7:48 ` Heikki Krogerus
[not found] ` <20150806074848.GH7675-FZxXFokcWpatqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
2015-08-07 22:08 ` Rafael J. Wysocki
2015-08-05 13:39 ` [PATCH 2/5] net: rfkill: add rfkill_find_type function Heikki Krogerus
[not found] ` <1438781947-7952-3-git-send-email-heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-08-05 14:07 ` Andy Shevchenko
2015-08-06 8:30 ` Heikki Krogerus
[not found] ` <20150806083004.GI7675-FZxXFokcWpatqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
2015-08-06 9:26 ` Andy Shevchenko
2015-08-06 11:31 ` Sergei Shtylyov
2015-08-13 9:27 ` Johannes Berg
2015-08-13 12:37 ` Heikki Krogerus
2015-08-05 13:39 ` Heikki Krogerus [this message]
2015-08-05 13:39 ` [PATCH 4/5] ARM: tegra: use build-in device properties with rfkill_gpio Heikki Krogerus
[not found] ` <1438781947-7952-1-git-send-email-heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-08-05 13:39 ` [PATCH 5/5] net: rfkill: gpio: remove rfkill_gpio_platform_data Heikki Krogerus
[not found] ` <1438781947-7952-6-git-send-email-heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-08-05 14:15 ` Andy Shevchenko
[not found] ` <1438784128.29746.177.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-08-06 7:22 ` 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=1438781947-7952-4-git-send-email-heikki.krogerus@linux.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=andriy.shevchenko@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=mika.westerberg@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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).