serial: 8250_exar: use platform_device_register_full()
PATCH 1/1 serial: 8250_exar: use platform_device_register_full()
This driver doesn't really need to split the registration of the GPIO chip into stages, as platform_device_info already provides fields for the firmware node, parent device and the software node. Use platform_device_register_full() and simplify the code. This also addresses the problem with incorrect reference count of the assigned firmware node.
Signed-off-by Bartosz Golaszewski <[email protected]>
--- drivers/tty/serial/8250/8250_exar.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-)
drivers/tty/serial/8250/8250_exar.c +9 -16
@@ -1140,22 +1140,15 @@ static void setup_gpio(struct pci_dev *pcidev, u8 __iomem *p)static struct platform_device *__xr17v35x_register_gpio (struct pci_dev *pcidev,const struct software_node *node) { -struct platform_device *pdev; - - pdev =platform_device_alloc ("gpio_exar" ,PLATFORM_DEVID_AUTO ); -if (!pdev) -return NULL ; - - pdev->dev.parent = &pcidev->dev; -device_set_node (&pdev->dev,dev_fwnode (&pcidev->dev)); - -if (device_add_software_node (&pdev->dev, node) <0 || -platform_device_add (pdev) <0 ) { -platform_device_put (pdev); -return NULL ; - } - -return pdev; +struct platform_device_info pdevinfo = { + .name ="gpio_exar" , + .id =PLATFORM_DEVID_AUTO , + .parent = &pcidev->dev, + .fwnode =dev_fwnode (&pcidev->dev), + .swnode = node, + }; + +return platform_device_register_full (&pdevinfo); }static void __xr17v35x_unregister_gpio (struct platform_device *pdev)
---
base-commit: 0d33d21e47d9dc66f91e44da3fc9220c74d93df7
change-id: 20260728-exar-pdev-reg-full-e31a2447b4b3
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>