diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-12-29 00:01:32 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-31 17:06:05 -0500 |
commit | e3a411a3dfc1d633504aa63efab32b7e00318454 (patch) | |
tree | 2ba6117448edd7056c8fa48cc6a696ae73a6c21a /drivers/serial | |
parent | 6fc5bae797a6632bbccdd49a1b6a96121368a4b9 (diff) |
[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 493d5bbb661b..145d6236954b 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, | |||
1037 | err = request_irq(up->port.irq, sunsab_interrupt, | 1037 | err = request_irq(up->port.irq, sunsab_interrupt, |
1038 | IRQF_SHARED, "sab", up); | 1038 | IRQF_SHARED, "sab", up); |
1039 | if (err) { | 1039 | if (err) { |
1040 | of_iounmap(up->port.membase, | 1040 | of_iounmap(&op->resource[0], |
1041 | up->port.membase, | ||
1041 | sizeof(union sab82532_async_regs)); | 1042 | sizeof(union sab82532_async_regs)); |
1042 | return err; | 1043 | return err; |
1043 | } | 1044 | } |
@@ -1064,7 +1065,8 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id * | |||
1064 | sizeof(union sab82532_async_regs), | 1065 | sizeof(union sab82532_async_regs), |
1065 | (inst * 2) + 1); | 1066 | (inst * 2) + 1); |
1066 | if (err) { | 1067 | if (err) { |
1067 | of_iounmap(up[0].port.membase, | 1068 | of_iounmap(&op->resource[0], |
1069 | up[0].port.membase, | ||
1068 | sizeof(union sab82532_async_regs)); | 1070 | sizeof(union sab82532_async_regs)); |
1069 | free_irq(up[0].port.irq, &up[0]); | 1071 | free_irq(up[0].port.irq, &up[0]); |
1070 | return err; | 1072 | return err; |
@@ -1082,10 +1084,13 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id * | |||
1082 | 1084 | ||
1083 | static void __devexit sab_remove_one(struct uart_sunsab_port *up) | 1085 | static void __devexit sab_remove_one(struct uart_sunsab_port *up) |
1084 | { | 1086 | { |
1087 | struct of_device *op = to_of_device(up->port.dev); | ||
1088 | |||
1085 | uart_remove_one_port(&sunsab_reg, &up->port); | 1089 | uart_remove_one_port(&sunsab_reg, &up->port); |
1086 | if (!(up->port.line & 1)) | 1090 | if (!(up->port.line & 1)) |
1087 | free_irq(up->port.irq, up); | 1091 | free_irq(up->port.irq, up); |
1088 | of_iounmap(up->port.membase, | 1092 | of_iounmap(&op->resource[0], |
1093 | up->port.membase, | ||
1089 | sizeof(union sab82532_async_regs)); | 1094 | sizeof(union sab82532_async_regs)); |
1090 | } | 1095 | } |
1091 | 1096 | ||
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 564592b2b2ba..3ec3df21816b 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 | |||
1480 | return 0; | 1480 | return 0; |
1481 | 1481 | ||
1482 | out_unmap: | 1482 | out_unmap: |
1483 | of_iounmap(up->port.membase, up->reg_size); | 1483 | of_iounmap(&op->resource[0], up->port.membase, up->reg_size); |
1484 | return err; | 1484 | return err; |
1485 | } | 1485 | } |
1486 | 1486 | ||
1487 | static int __devexit su_remove(struct of_device *dev) | 1487 | static int __devexit su_remove(struct of_device *op) |
1488 | { | 1488 | { |
1489 | struct uart_sunsu_port *up = dev_get_drvdata(&dev->dev);; | 1489 | struct uart_sunsu_port *up = dev_get_drvdata(&op->dev); |
1490 | 1490 | ||
1491 | if (up->su_type == SU_PORT_MS || | 1491 | if (up->su_type == SU_PORT_MS || |
1492 | up->su_type == SU_PORT_KBD) { | 1492 | up->su_type == SU_PORT_KBD) { |
@@ -1499,9 +1499,9 @@ static int __devexit su_remove(struct of_device *dev) | |||
1499 | } | 1499 | } |
1500 | 1500 | ||
1501 | if (up->port.membase) | 1501 | if (up->port.membase) |
1502 | of_iounmap(up->port.membase, up->reg_size); | 1502 | of_iounmap(&op->resource[0], up->port.membase, up->reg_size); |
1503 | 1503 | ||
1504 | dev_set_drvdata(&dev->dev, NULL); | 1504 | dev_set_drvdata(&op->dev, NULL); |
1505 | 1505 | ||
1506 | return 0; | 1506 | return 0; |
1507 | } | 1507 | } |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index 75de919a9471..244f796dc625 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 | |||
1379 | if (!keyboard_mouse) { | 1379 | if (!keyboard_mouse) { |
1380 | err = uart_add_one_port(&sunzilog_reg, &up[0].port); | 1380 | err = uart_add_one_port(&sunzilog_reg, &up[0].port); |
1381 | if (err) { | 1381 | if (err) { |
1382 | of_iounmap(rp, sizeof(struct zilog_layout)); | 1382 | of_iounmap(&op->resource[0], |
1383 | rp, sizeof(struct zilog_layout)); | ||
1383 | return err; | 1384 | return err; |
1384 | } | 1385 | } |
1385 | err = uart_add_one_port(&sunzilog_reg, &up[1].port); | 1386 | err = uart_add_one_port(&sunzilog_reg, &up[1].port); |
1386 | if (err) { | 1387 | if (err) { |
1387 | uart_remove_one_port(&sunzilog_reg, &up[0].port); | 1388 | uart_remove_one_port(&sunzilog_reg, &up[0].port); |
1388 | of_iounmap(rp, sizeof(struct zilog_layout)); | 1389 | of_iounmap(&op->resource[0], |
1390 | rp, sizeof(struct zilog_layout)); | ||
1389 | return err; | 1391 | return err; |
1390 | } | 1392 | } |
1391 | } else { | 1393 | } else { |
@@ -1414,18 +1416,18 @@ static void __devexit zs_remove_one(struct uart_sunzilog_port *up) | |||
1414 | uart_remove_one_port(&sunzilog_reg, &up->port); | 1416 | uart_remove_one_port(&sunzilog_reg, &up->port); |
1415 | } | 1417 | } |
1416 | 1418 | ||
1417 | static int __devexit zs_remove(struct of_device *dev) | 1419 | static int __devexit zs_remove(struct of_device *op) |
1418 | { | 1420 | { |
1419 | struct uart_sunzilog_port *up = dev_get_drvdata(&dev->dev); | 1421 | struct uart_sunzilog_port *up = dev_get_drvdata(&op->dev); |
1420 | struct zilog_layout __iomem *regs; | 1422 | struct zilog_layout __iomem *regs; |
1421 | 1423 | ||
1422 | zs_remove_one(&up[0]); | 1424 | zs_remove_one(&up[0]); |
1423 | zs_remove_one(&up[1]); | 1425 | zs_remove_one(&up[1]); |
1424 | 1426 | ||
1425 | regs = sunzilog_chip_regs[up[0].port.line / 2]; | 1427 | regs = sunzilog_chip_regs[up[0].port.line / 2]; |
1426 | of_iounmap(regs, sizeof(struct zilog_layout)); | 1428 | of_iounmap(&op->resource[0], regs, sizeof(struct zilog_layout)); |
1427 | 1429 | ||
1428 | dev_set_drvdata(&dev->dev, NULL); | 1430 | dev_set_drvdata(&op->dev, NULL); |
1429 | 1431 | ||
1430 | return 0; | 1432 | return 0; |
1431 | } | 1433 | } |