Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 60679
b: refs/heads/master
c: e34b9c9
h: refs/heads/master
i:
  60677: 72db3d9
  60675: 081161b
  60671: e9fa1c9
v: v3
  • Loading branch information
Ishizaki Kou authored and Paul Mackerras committed Jul 10, 2007
1 parent 64574d6 commit b3e50db
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1558f9b44e1c6b5eba46f58214851fd24285641f
refs/heads/master: e34b9c94b6e8d63f94387f5148434db5f8f79084
27 changes: 24 additions & 3 deletions trunk/drivers/serial/of_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
#include <asm/of_platform.h>
#include <asm/prom.h>

struct of_serial_info {
int type;
int line;
};

/*
* Fill a struct uart_port for a given device node
*/
Expand Down Expand Up @@ -62,13 +67,18 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
static int __devinit of_platform_serial_probe(struct of_device *ofdev,
const struct of_device_id *id)
{
struct of_serial_info *info;
struct uart_port port;
int port_type;
int ret;

if (of_find_property(ofdev->node, "used-by-rtas", NULL))
return -EBUSY;

info = kmalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL)
return -ENOMEM;

port_type = (unsigned long)id->data;
ret = of_platform_serial_setup(ofdev, port_type, &port);
if (ret)
Expand All @@ -88,9 +98,12 @@ static int __devinit of_platform_serial_probe(struct of_device *ofdev,
if (ret < 0)
goto out;

ofdev->dev.driver_data = (void *)(unsigned long)ret;
info->type = port_type;
info->line = ret;
ofdev->dev.driver_data = info;
return 0;
out:
kfree(info);
irq_dispose_mapping(port.irq);
return ret;
}
Expand All @@ -100,8 +113,16 @@ static int __devinit of_platform_serial_probe(struct of_device *ofdev,
*/
static int of_platform_serial_remove(struct of_device *ofdev)
{
int line = (unsigned long)ofdev->dev.driver_data;
serial8250_unregister_port(line);
struct of_serial_info *info = ofdev->dev.driver_data;
switch (info->type) {
case PORT_8250 ... PORT_MAX_8250:
serial8250_unregister_port(info->line);
break;
default:
/* need to add code for these */
break;
}
kfree(info);
return 0;
}

Expand Down

0 comments on commit b3e50db

Please sign in to comment.