Skip to content

Commit 2bb596a

Browse files
Hans de Goedeij-intel
authored andcommitted
platform/x86: x86-android-tablets: Simplify node-group [un]registration
software_node_register_node_group() / software_node_unregister_node_group() both accept a NULL node-group as argument. So there is no need to check for the node-group being NULL before calling these functions, remove the checks to simplify the code. Note the "if (gpio_button_swnodes)" check for registering is kept because that also guards the creation of a gpio-button platform-device. Suggested-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Hans de Goede <hansg@kernel.org> Reviewed-by: Andy Shevchenko <andy@kernel.org> Link: https://patch.msgid.link/20250920200713.20193-15-hansg@kernel.org Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 936ddb5 commit 2bb596a

1 file changed

Lines changed: 11 additions & 20 deletions

File tree

  • drivers/platform/x86/x86-android-tablets

drivers/platform/x86/x86-android-tablets/core.c

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -387,14 +387,9 @@ static void x86_android_tablet_remove(struct platform_device *pdev)
387387
if (exit_handler)
388388
exit_handler();
389389

390-
if (gpio_button_swnodes)
391-
software_node_unregister_node_group(gpio_button_swnodes);
392-
393-
if (swnode_group)
394-
software_node_unregister_node_group(swnode_group);
395-
396-
if (gpiochip_node_group)
397-
software_node_unregister_node_group(gpiochip_node_group);
390+
software_node_unregister_node_group(gpio_button_swnodes);
391+
software_node_unregister_node_group(swnode_group);
392+
software_node_unregister_node_group(gpiochip_node_group);
398393
}
399394

400395
static __init int x86_android_tablet_probe(struct platform_device *pdev)
@@ -430,20 +425,16 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev)
430425
break;
431426
}
432427

433-
if (gpiochip_node_group) {
434-
ret = software_node_register_node_group(gpiochip_node_group);
435-
if (ret)
436-
return ret;
437-
}
428+
ret = software_node_register_node_group(gpiochip_node_group);
429+
if (ret)
430+
return ret;
438431

439-
if (dev_info->swnode_group) {
440-
ret = software_node_register_node_group(dev_info->swnode_group);
441-
if (ret) {
442-
x86_android_tablet_remove(pdev);
443-
return ret;
444-
}
445-
swnode_group = dev_info->swnode_group;
432+
ret = software_node_register_node_group(dev_info->swnode_group);
433+
if (ret) {
434+
x86_android_tablet_remove(pdev);
435+
return ret;
446436
}
437+
swnode_group = dev_info->swnode_group;
447438

448439
if (dev_info->init) {
449440
ret = dev_info->init(&pdev->dev);

0 commit comments

Comments
 (0)