mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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 <heikki.krogerus@linux.intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
		
							parent
							
								
									648b50dd6a
								
							
						
					
					
						commit
						7d5e9737ef
					
				
					 1 changed files with 11 additions and 5 deletions
				
			
		| 
						 | 
					@ -81,7 +81,6 @@ static int rfkill_gpio_acpi_probe(struct device *dev,
 | 
				
			||||||
	if (!id)
 | 
						if (!id)
 | 
				
			||||||
		return -ENODEV;
 | 
							return -ENODEV;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rfkill->name = dev_name(dev);
 | 
					 | 
				
			||||||
	rfkill->type = (unsigned)id->driver_data;
 | 
						rfkill->type = (unsigned)id->driver_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return acpi_dev_add_driver_gpios(ACPI_COMPANION(dev),
 | 
						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_platform_data *pdata = pdev->dev.platform_data;
 | 
				
			||||||
	struct rfkill_gpio_data *rfkill;
 | 
						struct rfkill_gpio_data *rfkill;
 | 
				
			||||||
	struct gpio_desc *gpio;
 | 
						struct gpio_desc *gpio;
 | 
				
			||||||
 | 
						const char *type_name;
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL);
 | 
						rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL);
 | 
				
			||||||
	if (!rfkill)
 | 
						if (!rfkill)
 | 
				
			||||||
		return -ENOMEM;
 | 
							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)) {
 | 
						if (ACPI_HANDLE(&pdev->dev)) {
 | 
				
			||||||
		ret = rfkill_gpio_acpi_probe(&pdev->dev, rfkill);
 | 
							ret = rfkill_gpio_acpi_probe(&pdev->dev, rfkill);
 | 
				
			||||||
		if (ret)
 | 
							if (ret)
 | 
				
			||||||
| 
						 | 
					@ -124,10 +132,8 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rfkill->shutdown_gpio = gpio;
 | 
						rfkill->shutdown_gpio = gpio;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Make sure at-least one of the GPIO is defined and that
 | 
						/* Make sure at-least one GPIO is defined for this instance */
 | 
				
			||||||
	 * a name is specified for this instance
 | 
						if (!rfkill->reset_gpio && !rfkill->shutdown_gpio) {
 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	if ((!rfkill->reset_gpio && !rfkill->shutdown_gpio) || !rfkill->name) {
 | 
					 | 
				
			||||||
		dev_err(&pdev->dev, "invalid platform data\n");
 | 
							dev_err(&pdev->dev, "invalid platform data\n");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue