summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorCrescent Hsieh <crescentcy.hsieh@moxa.com>2026-07-31 15:48:19 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-08-03 16:51:57 +0200
commit8e929ae7c96c8d2a397bee2c98186bc38581fb78 (patch)
treeea46e4c9875ca4c840bda703b28be12f71d59069 /drivers/tty
parent8a6c543cf8b3630a3db714e1be99931ab5f98513 (diff)
downloadlinux-8e929ae7c96c8d2a397bee2c98186bc38581fb78.tar.gz
linux-8e929ae7c96c8d2a397bee2c98186bc38581fb78.zip
serial: 8250_mxpcie: introduce per-port private data structure
Introduce a private per-port data structure for the mxpcie driver and replace the shared flexible array of registered lines with an array of per-port objects. This prepares the driver for storing per-port state needed by subsequent features. No functional change intended. Signed-off-by: Crescent Hsieh <crescentcy.hsieh@moxa.com> Link: https://patch.msgid.link/20260731074820.735619-14-crescentcy.hsieh@moxa.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/8250/8250_mxpcie.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/tty/serial/8250/8250_mxpcie.c b/drivers/tty/serial/8250/8250_mxpcie.c
index 6f44a557a6d6..b37e014af553 100644
--- a/drivers/tty/serial/8250/8250_mxpcie.c
+++ b/drivers/tty/serial/8250/8250_mxpcie.c
@@ -101,12 +101,16 @@
#define MOXA_EVEN_RS_MASK GENMASK(3, 0)
#define MOXA_ODD_RS_MASK GENMASK(7, 4)
+struct mxpcie8250_port {
+ int line;
+};
+
struct mxpcie8250 {
unsigned int supp_rs;
unsigned int num_ports;
void __iomem *bar1_base; /* UART registers (MMIO) */
void __iomem *bar2_base; /* UIR / GPIO / CPLD (IO) */
- int line[] __counted_by(num_ports);
+ struct mxpcie8250_port port[] __counted_by(num_ports);
};
enum {
@@ -501,7 +505,7 @@ static int mxpcie8250_probe(struct pci_dev *pdev, const struct pci_device_id *id
num_ports = mxpcie8250_get_nports(device);
- priv = devm_kzalloc(dev, struct_size(priv, line, num_ports), GFP_KERNEL);
+ priv = devm_kzalloc(dev, struct_size(priv, port, num_ports), GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -542,12 +546,12 @@ static int mxpcie8250_probe(struct pci_dev *pdev, const struct pci_device_id *id
dev_dbg(dev, "Setup PCI port: port %lx, irq %d, type %d\n",
up.port.iobase, up.port.irq, up.port.iotype);
- priv->line[i] = serial8250_register_8250_port(&up);
- if (priv->line[i] < 0) {
+ priv->port[i].line = serial8250_register_8250_port(&up);
+ if (priv->port[i].line < 0) {
dev_err(dev,
"Couldn't register serial port %lx, irq %d, type %d, error %d\n",
up.port.iobase, up.port.irq,
- up.port.iotype, priv->line[i]);
+ up.port.iotype, priv->port[i].line);
break;
}
}
@@ -561,7 +565,7 @@ static void mxpcie8250_remove(struct pci_dev *pdev)
struct mxpcie8250 *priv = pci_get_drvdata(pdev);
for (unsigned int i = 0; i < priv->num_ports; i++)
- serial8250_unregister_port(priv->line[i]);
+ serial8250_unregister_port(priv->port[i].line);
}
static const struct pci_device_id mxpcie8250_pci_ids[] = {