serial: 8250_exar: Constify the software nodes

Software node is always created for additional device
properties. If the properties are constant, the software
node can also be constant.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20210304081311.17340-1-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Heikki Krogerus 2021-03-04 11:13:11 +03:00 коммит произвёл Greg Kroah-Hartman
Родитель b89cfc05a2
Коммит 81171e7d31
1 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@ -354,7 +354,7 @@ static void setup_gpio(struct pci_dev *pcidev, u8 __iomem *p)
static void * static void *
__xr17v35x_register_gpio(struct pci_dev *pcidev, __xr17v35x_register_gpio(struct pci_dev *pcidev,
const struct property_entry *properties) const struct software_node *node)
{ {
struct platform_device *pdev; struct platform_device *pdev;
@ -365,7 +365,7 @@ __xr17v35x_register_gpio(struct pci_dev *pcidev,
pdev->dev.parent = &pcidev->dev; pdev->dev.parent = &pcidev->dev;
ACPI_COMPANION_SET(&pdev->dev, ACPI_COMPANION(&pcidev->dev)); ACPI_COMPANION_SET(&pdev->dev, ACPI_COMPANION(&pcidev->dev));
if (platform_device_add_properties(pdev, properties) < 0 || if (device_add_software_node(&pdev->dev, node) < 0 ||
platform_device_add(pdev) < 0) { platform_device_add(pdev) < 0) {
platform_device_put(pdev); platform_device_put(pdev);
return NULL; return NULL;
@ -380,12 +380,16 @@ static const struct property_entry exar_gpio_properties[] = {
{ } { }
}; };
static const struct software_node exar_gpio_node = {
.properties = exar_gpio_properties,
};
static int xr17v35x_register_gpio(struct pci_dev *pcidev, static int xr17v35x_register_gpio(struct pci_dev *pcidev,
struct uart_8250_port *port) struct uart_8250_port *port)
{ {
if (pcidev->vendor == PCI_VENDOR_ID_EXAR) if (pcidev->vendor == PCI_VENDOR_ID_EXAR)
port->port.private_data = port->port.private_data =
__xr17v35x_register_gpio(pcidev, exar_gpio_properties); __xr17v35x_register_gpio(pcidev, &exar_gpio_node);
return 0; return 0;
} }
@ -457,6 +461,10 @@ static const struct property_entry iot2040_gpio_properties[] = {
{ } { }
}; };
static const struct software_node iot2040_gpio_node = {
.properties = iot2040_gpio_properties,
};
static int iot2040_register_gpio(struct pci_dev *pcidev, static int iot2040_register_gpio(struct pci_dev *pcidev,
struct uart_8250_port *port) struct uart_8250_port *port)
{ {
@ -468,7 +476,7 @@ static int iot2040_register_gpio(struct pci_dev *pcidev,
writeb(IOT2040_UARTS_GPIO_HI_MODE, p + UART_EXAR_MPIOSEL_15_8); writeb(IOT2040_UARTS_GPIO_HI_MODE, p + UART_EXAR_MPIOSEL_15_8);
port->port.private_data = port->port.private_data =
__xr17v35x_register_gpio(pcidev, iot2040_gpio_properties); __xr17v35x_register_gpio(pcidev, &iot2040_gpio_node);
return 0; return 0;
} }
@ -547,6 +555,7 @@ static void pci_xr17v35x_exit(struct pci_dev *pcidev)
struct uart_8250_port *port = serial8250_get_port(priv->line[0]); struct uart_8250_port *port = serial8250_get_port(priv->line[0]);
struct platform_device *pdev = port->port.private_data; struct platform_device *pdev = port->port.private_data;
device_remove_software_node(&pdev->dev);
platform_device_unregister(pdev); platform_device_unregister(pdev);
port->port.private_data = NULL; port->port.private_data = NULL;
} }