Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'reset-gpio-for-v6.19-2' of https://git.pengutronix.de/git/pza/linux into gpio/for-next

Reset/GPIO/swnode changes for v6.19 (v2)

* Fix chtwc_int33fe build issue since commit d7cdbbc93c56 ("software
node: allow referencing firmware nodes").

+20 -9
+20 -9
drivers/platform/x86/intel/chtwc_int33fe.c
··· 77 77 * software node. 78 78 */ 79 79 static struct software_node_ref_args fusb302_mux_refs[] = { 80 - { .node = NULL }, 80 + SOFTWARE_NODE_REFERENCE(NULL), 81 81 }; 82 82 83 83 static const struct property_entry fusb302_properties[] = { ··· 190 190 { 191 191 software_node_unregister_node_group(node_group); 192 192 193 - if (fusb302_mux_refs[0].node) { 194 - fwnode_handle_put(software_node_fwnode(fusb302_mux_refs[0].node)); 195 - fusb302_mux_refs[0].node = NULL; 196 - } 197 - 198 193 if (data->dp) { 199 194 data->dp->secondary = NULL; 200 195 fwnode_handle_put(data->dp); ··· 197 202 } 198 203 } 199 204 200 - static int cht_int33fe_add_nodes(struct cht_int33fe_data *data) 205 + static void cht_int33fe_put_swnode(void *data) 206 + { 207 + struct fwnode_handle *fwnode = data; 208 + 209 + fwnode_handle_put(fwnode); 210 + fusb302_mux_refs[0] = SOFTWARE_NODE_REFERENCE(NULL); 211 + } 212 + 213 + static int cht_int33fe_add_nodes(struct device *dev, struct cht_int33fe_data *data) 201 214 { 202 215 const struct software_node *mux_ref_node; 203 216 int ret; ··· 215 212 * until the mux driver has created software node for the mux device. 216 213 * It means we depend on the mux driver. This function will return 217 214 * -EPROBE_DEFER until the mux device is registered. 215 + * 216 + * FIXME: the relevant software node exists in intel-xhci-usb-role-switch 217 + * and - if exported - could be used to set up a static reference. 218 218 */ 219 219 mux_ref_node = software_node_find_by_name(NULL, "intel-xhci-usb-sw"); 220 220 if (!mux_ref_node) 221 221 return -EPROBE_DEFER; 222 + 223 + ret = devm_add_action_or_reset(dev, cht_int33fe_put_swnode, 224 + software_node_fwnode(mux_ref_node)); 225 + if (ret) 226 + return ret; 222 227 223 228 /* 224 229 * Update node used in "usb-role-switch" property. Note that we 225 230 * rely on software_node_register_node_group() to use the original 226 231 * instance of properties instead of copying them. 227 232 */ 228 - fusb302_mux_refs[0].node = mux_ref_node; 233 + fusb302_mux_refs[0] = SOFTWARE_NODE_REFERENCE(mux_ref_node); 229 234 230 235 ret = software_node_register_node_group(node_group); 231 236 if (ret) ··· 356 345 return fusb302_irq; 357 346 } 358 347 359 - ret = cht_int33fe_add_nodes(data); 348 + ret = cht_int33fe_add_nodes(dev, data); 360 349 if (ret) 361 350 return ret; 362 351