Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67872
b: refs/heads/master
c: ce0d932
h: refs/heads/master
v: v3
  • Loading branch information
Roman Kagan authored and Greg Kroah-Hartman committed Oct 12, 2007
1 parent e488b85 commit 712d2b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fdf99c9ec10cb9cd44be3ac0bd007a49ac6dc751
refs/heads/master: ce0d9325b19555f05b08cbb1ea4c2393eec188ec
16 changes: 16 additions & 0 deletions trunk/drivers/usb/serial/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ static int usb_serial_device_match (struct device *dev, struct device_driver *dr
return 0;
}

static ssize_t show_port_number(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct usb_serial_port *port = to_usb_serial_port(dev);

return sprintf(buf, "%d\n", port->number - port->serial->minor);
}

static DEVICE_ATTR(port_number, S_IRUGO, show_port_number, NULL);

static int usb_serial_device_probe (struct device *dev)
{
struct usb_serial_driver *driver;
Expand All @@ -62,6 +72,10 @@ static int usb_serial_device_probe (struct device *dev)
goto exit;
}

retval = device_create_file(dev, &dev_attr_port_number);
if (retval)
goto exit;

minor = port->number;
tty_register_device (usb_serial_tty_driver, minor, dev);
dev_info(&port->serial->dev->dev,
Expand All @@ -84,6 +98,8 @@ static int usb_serial_device_remove (struct device *dev)
return -ENODEV;
}

device_remove_file(&port->dev, &dev_attr_port_number);

driver = port->serial->type;
if (driver->port_remove) {
if (!try_module_get(driver->driver.owner)) {
Expand Down

0 comments on commit 712d2b0

Please sign in to comment.