Skip to contentSkip to conversation

pinctrl: meson: Switch to use fwnode instead of of_node

PATCH In review Andy Shevchenko 3 participants 4 messages Sep 5, 2022 – Sep 8, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: meson: Switch to use fwnode instead of of_node

GPIO library now accepts fwnode as a firmware node, so switch the driver to use it.

---
 drivers/pinctrl/meson/pinctrl-meson.c | 7 +++----
 drivers/pinctrl/meson/pinctrl-meson.h | 4 +++-
 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/pinctrl/meson/pinctrl-meson.c +3 -4
index cc2cd73ff8f9..530f3f934e19 100644
@@ -608,6 +608,7 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc)
 
 	pc->chip.label = pc->data->name;
 	pc->chip.parent = pc->dev;
+	pc->chip.fwnode = pc->fwnode;
 	pc->chip.request = gpiochip_generic_request;
 	pc->chip.free = gpiochip_generic_free;
 	pc->chip.set_config = gpiochip_generic_config;
@@ -619,8 +620,6 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc)
 	pc->chip.base = -1;
 	pc->chip.ngpio = pc->data->num_pins;
 	pc->chip.can_sleep = false;
-	pc->chip.of_node = pc->of_node;
-	pc->chip.of_gpio_n_cells = 2;
 
 	ret = gpiochip_add_data(&pc->chip, pc);
 	if (ret) {
@@ -678,8 +677,8 @@ static int meson_pinctrl_parse_dt(struct meson_pinctrl *pc)
 		return -EINVAL;
 	}
 
-	gpio_np = to_of_node(gpiochip_node_get_first(pc->dev));
-	pc->of_node = gpio_np;
+	pc->fwnode = gpiochip_node_get_first(pc->dev);
+	gpio_np = to_of_node(pc->fwnode);
 
 	pc->reg_mux = meson_map_resource(pc, gpio_np, "mux");
 	if (IS_ERR_OR_NULL(pc->reg_mux)) {
drivers/pinctrl/meson/pinctrl-meson.h +3 -1
index b197827027bd..34fc4e8612e4 100644
@@ -12,6 +12,8 @@
 #include <linux/types.h>
 #include <linux/module.h>
 
+struct fwnode_handle;
+
 struct meson_pinctrl;
 
 /**
@@ -131,7 +133,7 @@ struct meson_pinctrl {
 	struct regmap *reg_gpio;
 	struct regmap *reg_ds;
 	struct gpio_chip chip;
-	struct device_node *of_node;
+	struct fwnode_handle *fwnode;
 };
 
 #define FUNCTION(fn)							\
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 55 lines · Andy Shevchenko

GPIO library now accepts fwnode as a firmware node, so switch the driver to use it.

---
  drivers/pinctrl/meson/pinctrl-meson.c | 7 +++----
  drivers/pinctrl/meson/pinctrl-meson.h | 4 +++-
  2 files changed, 6 insertions(+), 5 deletions(-)
drivers/pinctrl/meson/pinctrl-meson.c +3 -4
index cc2cd73ff8f9..530f3f934e19 100644
@@ -608,6 +608,7 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc)
 
  	pc->chip.label = pc->data->name;
  	pc->chip.parent = pc->dev;
+	pc->chip.fwnode = pc->fwnode;
  	pc->chip.request = gpiochip_generic_request;
  	pc->chip.free = gpiochip_generic_free;
  	pc->chip.set_config = gpiochip_generic_config;
@@ -619,8 +620,6 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc)
  	pc->chip.base = -1;
  	pc->chip.ngpio = pc->data->num_pins;
  	pc->chip.can_sleep = false;
-	pc->chip.of_node = pc->of_node;
-	pc->chip.of_gpio_n_cells = 2;
 
  	ret = gpiochip_add_data(&pc->chip, pc);
  	if (ret) {
@@ -678,8 +677,8 @@ static int meson_pinctrl_parse_dt(struct meson_pinctrl *pc)
  		return -EINVAL;
  	}
 
-	gpio_np = to_of_node(gpiochip_node_get_first(pc->dev));
-	pc->of_node = gpio_np;
+	pc->fwnode = gpiochip_node_get_first(pc->dev);
+	gpio_np = to_of_node(pc->fwnode);
 
  	pc->reg_mux = meson_map_resource(pc, gpio_np, "mux");
  	if (IS_ERR_OR_NULL(pc->reg_mux)) {
drivers/pinctrl/meson/pinctrl-meson.h +2 -0
index b197827027bd..34fc4e8612e4 100644
@@ -12,6 +12,8 @@
  #include <linux/types.h>
  #include <linux/module.h>
 
+struct fwnode_handle;
+
  struct meson_pinctrl;
 
  /**

drivers/pinctrl/meson/pinctrl-meson.h struct meson_pinctrl { · line 139

Quoted 8 lines
drivers/pinctrl/meson/pinctrl-meson.h +1 -1
@@ -131,7 +133,7 @@ struct meson_pinctrl {
  	struct regmap *reg_gpio;
  	struct regmap *reg_ds;
  	struct gpio_chip chip;
-	struct device_node *of_node;
+	struct fwnode_handle *fwnode;
  };
 
  #define FUNCTION(fn)							\
#2 lore raw
Quoted 3 lines · Neil Armstrong
Quoted 2 lines · Andy Shevchenko

GPIO library now accepts fwnode as a firmware node, so switch the driver to use it.

...

Quoted 1 line

Thanks!

Signature · 2 lines
With Best Regards,
Andy Shevchenko