Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1200774
| From | Heikki Krogerus <heikki.krogerus@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/5] net: rfkill: gpio: get the name and type from device property |
| Date | 2015-08-05 15:50 +0200 |
| Message-ID | <pU7eZ-2WR-57@gated-at.bofh.it> (permalink) |
| References | <pU75g-2L3-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/5] net: rfkill: gpio: replace platform data with build-in property Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2015-08-05 15:40 +0200
[PATCH 1/5] device property: helper macros for property entry creation Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2015-08-05 15:40 +0200
Re: [PATCH 1/5] device property: helper macros for property entry creation Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-08-05 16:10 +0200
Re: [PATCH 1/5] device property: helper macros for property entry creation "Shevchenko, Andriy" <andriy.shevchenko@intel.com> - 2015-08-05 16:20 +0200
Re: [PATCH 1/5] device property: helper macros for property entry creation Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2015-08-06 09:50 +0200
Re: [PATCH 1/5] device property: helper macros for property entry creation "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-08-07 23:50 +0200
[PATCH 2/5] net: rfkill: add rfkill_find_type function Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2015-08-05 15:40 +0200
Re: [PATCH 2/5] net: rfkill: add rfkill_find_type function Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-08-05 16:10 +0200
Re: [PATCH 2/5] net: rfkill: add rfkill_find_type function Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2015-08-06 10:40 +0200
Re: [PATCH 2/5] net: rfkill: add rfkill_find_type function Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-08-06 11:30 +0200
Re: [PATCH 2/5] net: rfkill: add rfkill_find_type function Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-08-06 13:40 +0200
Re: [PATCH 2/5] net: rfkill: add rfkill_find_type function Johannes Berg <johannes@sipsolutions.net> - 2015-08-13 11:30 +0200
Re: [PATCH 2/5] net: rfkill: add rfkill_find_type function Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2015-08-13 14:40 +0200
[PATCH 5/5] net: rfkill: gpio: remove rfkill_gpio_platform_data Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2015-08-05 15:40 +0200
Re: [PATCH 5/5] net: rfkill: gpio: remove rfkill_gpio_platform_data Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-08-05 16:20 +0200
Re: [PATCH 5/5] net: rfkill: gpio: remove rfkill_gpio_platform_data Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2015-08-06 09:30 +0200
[PATCH 4/5] ARM: tegra: use build-in device properties with rfkill_gpio Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2015-08-05 15:50 +0200
[PATCH 3/5] net: rfkill: gpio: get the name and type from device property Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2015-08-05 15:50 +0200
csiph-web