Skip to content

Commit 7d5e973

Browse files
Heikki Krogerusjmberg-intel
authored andcommitted
net: rfkill: gpio: get the name and type from device property
This prepares the driver for removal of platform data. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent 648b50d commit 7d5e973

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

net/rfkill/rfkill-gpio.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ static int rfkill_gpio_acpi_probe(struct device *dev,
8181
if (!id)
8282
return -ENODEV;
8383

84-
rfkill->name = dev_name(dev);
8584
rfkill->type = (unsigned)id->driver_data;
8685

8786
return acpi_dev_add_driver_gpios(ACPI_COMPANION(dev),
@@ -93,12 +92,21 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
9392
struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;
9493
struct rfkill_gpio_data *rfkill;
9594
struct gpio_desc *gpio;
95+
const char *type_name;
9696
int ret;
9797

9898
rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL);
9999
if (!rfkill)
100100
return -ENOMEM;
101101

102+
device_property_read_string(&pdev->dev, "name", &rfkill->name);
103+
device_property_read_string(&pdev->dev, "type", &type_name);
104+
105+
if (!rfkill->name)
106+
rfkill->name = dev_name(&pdev->dev);
107+
108+
rfkill->type = rfkill_find_type(type_name);
109+
102110
if (ACPI_HANDLE(&pdev->dev)) {
103111
ret = rfkill_gpio_acpi_probe(&pdev->dev, rfkill);
104112
if (ret)
@@ -124,10 +132,8 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
124132

125133
rfkill->shutdown_gpio = gpio;
126134

127-
/* Make sure at-least one of the GPIO is defined and that
128-
* a name is specified for this instance
129-
*/
130-
if ((!rfkill->reset_gpio && !rfkill->shutdown_gpio) || !rfkill->name) {
135+
/* Make sure at-least one GPIO is defined for this instance */
136+
if (!rfkill->reset_gpio && !rfkill->shutdown_gpio) {
131137
dev_err(&pdev->dev, "invalid platform data\n");
132138
return -EINVAL;
133139
}

0 commit comments

Comments
 (0)