forked from mirrors/linux
		
	gpiolib: of: Prepare of_gpiochip_add() / of_gpiochip_remove() for fwnode
GPIO library is getting rid of of_node, fwnode should be utilized instead. Prepare of_gpiochip_add() / of_gpiochip_remove() for fwnode. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
		
							parent
							
								
									2fe8e1dcf9
								
							
						
					
					
						commit
						8afe825502
					
				
					 1 changed files with 6 additions and 4 deletions
				
			
		|  | @ -1104,9 +1104,11 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip) { return 0; } | ||||||
| 
 | 
 | ||||||
| int of_gpiochip_add(struct gpio_chip *chip) | int of_gpiochip_add(struct gpio_chip *chip) | ||||||
| { | { | ||||||
|  | 	struct device_node *np; | ||||||
| 	int ret; | 	int ret; | ||||||
| 
 | 
 | ||||||
| 	if (!chip->of_node) | 	np = to_of_node(chip->fwnode); | ||||||
|  | 	if (!np) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	if (!chip->of_xlate) { | 	if (!chip->of_xlate) { | ||||||
|  | @ -1123,18 +1125,18 @@ int of_gpiochip_add(struct gpio_chip *chip) | ||||||
| 	if (ret) | 	if (ret) | ||||||
| 		return ret; | 		return ret; | ||||||
| 
 | 
 | ||||||
| 	of_node_get(chip->of_node); | 	fwnode_handle_get(chip->fwnode); | ||||||
| 
 | 
 | ||||||
| 	ret = of_gpiochip_scan_gpios(chip); | 	ret = of_gpiochip_scan_gpios(chip); | ||||||
| 	if (ret) | 	if (ret) | ||||||
| 		of_node_put(chip->of_node); | 		fwnode_handle_put(chip->fwnode); | ||||||
| 
 | 
 | ||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void of_gpiochip_remove(struct gpio_chip *chip) | void of_gpiochip_remove(struct gpio_chip *chip) | ||||||
| { | { | ||||||
| 	of_node_put(chip->of_node); | 	fwnode_handle_put(chip->fwnode); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void of_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev) | void of_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Andy Shevchenko
						Andy Shevchenko