mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
platform/x86: x86-android-tablets: pass node group to gpio_secondary_fwnode_init()
Currently gpio_secondary_fwnode_init() uses a file-scope static gpiochip_node_group variable initialized in probe. Pass the node group directly to gpio_secondary_fwnode_init() as an argument instead of using a global variable. This allows reusing the helper for additional GPIO controllers in subsequent patches. Assisted-by: LLM Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Tested-by: Hans de Goede <johannes.goede@oss.qualcomm.com> # Yoga tab 2 1380, yt3 Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260830-x86-android-lenovo-swnode-v1-3-066a91acb4ba@gmail.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
parent
144113b0a7
commit
aab060ec96
|
|
@ -156,7 +156,6 @@ static struct platform_device **pdevs;
|
|||
static struct serdev_device **serdevs;
|
||||
static const struct software_node **gpio_button_swnodes;
|
||||
static const struct software_node **swnode_group;
|
||||
static const struct software_node **gpiochip_node_group;
|
||||
static void (*exit_handler)(void);
|
||||
|
||||
static __init struct i2c_adapter *
|
||||
|
|
@ -377,26 +376,27 @@ static void gpio_secondary_unregister_node_group(void *data)
|
|||
software_node_unregister_node_group(nodes);
|
||||
}
|
||||
|
||||
static int gpio_secondary_fwnode_init(struct device *parent)
|
||||
static int gpio_secondary_fwnode_init(struct device *parent,
|
||||
const struct software_node * const *node_group)
|
||||
{
|
||||
const struct software_node *const *swnode;
|
||||
struct fwnode_handle *fwnode;
|
||||
int ret;
|
||||
|
||||
if (!gpiochip_node_group)
|
||||
if (!node_group)
|
||||
return 0;
|
||||
|
||||
ret = software_node_register_node_group(gpiochip_node_group);
|
||||
ret = software_node_register_node_group(node_group);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = devm_add_action_or_reset(parent,
|
||||
gpio_secondary_unregister_node_group,
|
||||
gpiochip_node_group);
|
||||
(void *)node_group);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
for (swnode = gpiochip_node_group; *swnode; swnode++) {
|
||||
for (swnode = node_group; *swnode; swnode++) {
|
||||
struct device *dev __free(put_device) =
|
||||
acpi_bus_find_device_by_name((*swnode)->name);
|
||||
if (!dev)
|
||||
|
|
@ -453,6 +453,7 @@ static void x86_android_tablet_remove(struct platform_device *pdev)
|
|||
|
||||
static __init int x86_android_tablet_probe(struct platform_device *pdev)
|
||||
{
|
||||
const struct software_node * const *gpiochip_node_group;
|
||||
const struct x86_dev_info *dev_info;
|
||||
const struct dmi_system_id *id;
|
||||
int i, ret = 0;
|
||||
|
|
@ -484,7 +485,7 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev)
|
|||
break;
|
||||
}
|
||||
|
||||
ret = gpio_secondary_fwnode_init(&pdev->dev);
|
||||
ret = gpio_secondary_fwnode_init(&pdev->dev, gpiochip_node_group);
|
||||
if (ret) {
|
||||
x86_android_tablet_remove(pdev);
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user