diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-12-28 21:01:32 -0800 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-31 14:06:05 -0800 |
commit | e3a411a3dfc1d633504aa63efab32b7e00318454 (patch) | |
tree | 2ba6117448edd7056c8fa48cc6a696ae73a6c21a /drivers/serial | |
parent | 6fc5bae797a6632bbccdd49a1b6a96121368a4b9 (diff) | |
download | op-kernel-dev-e3a411a3dfc1d633504aa63efab32b7e00318454.zip op-kernel-dev-e3a411a3dfc1d633504aa63efab32b7e00318454.tar.gz |
[SPARC64]: Fix of_iounmap() region release.
We need to pass in the resource otherwise we cannot
release the region properly. We must know whether it is
an I/O or MEM resource.
Spotted by Eric Brower.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/sunsab.c | 11 | ||||
-rw-r--r-- | drivers/serial/sunsu.c | 10 | ||||
-rw-r--r-- | drivers/serial/sunzilog.c | 14 |
3 files changed, 21 insertions, 14 deletions
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index 493d5bb..145d623 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c @@ -1037,7 +1037,8 @@ static int __devinit sunsab_init_one(struct uart_sunsab_port *up, err = request_irq(up->port.irq, sunsab_interrupt, IRQF_SHARED, "sab", up); if (err) { - of_iounmap(up->port.membase, + of_iounmap(&op->resource[0], + up->port.membase, sizeof(union sab82532_async_regs)); return err; } @@ -1064,7 +1065,8 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id * sizeof(union sab82532_async_regs), (inst * 2) + 1); if (err) { - of_iounmap(up[0].port.membase, + of_iounmap(&op->resource[0], + up[0].port.membase, sizeof(union sab82532_async_regs)); free_irq(up[0].port.irq, &up[0]); return err; @@ -1082,10 +1084,13 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id * static void __devexit sab_remove_one(struct uart_sunsab_port *up) { + struct of_device *op = to_of_device(up->port.dev); + uart_remove_one_port(&sunsab_reg, &up->port); if (!(up->port.line & 1)) free_irq(up->port.irq, up); - of_iounmap(up->port.membase, + of_iounmap(&op->resource[0], + up->port.membase, sizeof(union sab82532_async_regs)); } diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 564592b..3ec3df2 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c @@ -1480,13 +1480,13 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m return 0; out_unmap: - of_iounmap(up->port.membase, up->reg_size); + of_iounmap(&op->resource[0], up->port.membase, up->reg_size); return err; } -static int __devexit su_remove(struct of_device *dev) +static int __devexit su_remove(struct of_device *op) { - struct uart_sunsu_port *up = dev_get_drvdata(&dev->dev);; + struct uart_sunsu_port *up = dev_get_drvdata(&op->dev); if (up->su_type == SU_PORT_MS || up->su_type == SU_PORT_KBD) { @@ -1499,9 +1499,9 @@ static int __devexit su_remove(struct of_device *dev) } if (up->port.membase) - of_iounmap(up->port.membase, up->reg_size); + of_iounmap(&op->resource[0], up->port.membase, up->reg_size); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index 75de919..244f796 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c @@ -1379,13 +1379,15 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m if (!keyboard_mouse) { err = uart_add_one_port(&sunzilog_reg, &up[0].port); if (err) { - of_iounmap(rp, sizeof(struct zilog_layout)); + of_iounmap(&op->resource[0], + rp, sizeof(struct zilog_layout)); return err; } err = uart_add_one_port(&sunzilog_reg, &up[1].port); if (err) { uart_remove_one_port(&sunzilog_reg, &up[0].port); - of_iounmap(rp, sizeof(struct zilog_layout)); + of_iounmap(&op->resource[0], + rp, sizeof(struct zilog_layout)); return err; } } else { @@ -1414,18 +1416,18 @@ static void __devexit zs_remove_one(struct uart_sunzilog_port *up) uart_remove_one_port(&sunzilog_reg, &up->port); } -static int __devexit zs_remove(struct of_device *dev) +static int __devexit zs_remove(struct of_device *op) { - struct uart_sunzilog_port *up = dev_get_drvdata(&dev->dev); + struct uart_sunzilog_port *up = dev_get_drvdata(&op->dev); struct zilog_layout __iomem *regs; zs_remove_one(&up[0]); zs_remove_one(&up[1]); regs = sunzilog_chip_regs[up[0].port.line / 2]; - of_iounmap(regs, sizeof(struct zilog_layout)); + of_iounmap(&op->resource[0], regs, sizeof(struct zilog_layout)); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } |