From f449b80bffc98b01f4460905985a97416e5da8e2 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 7 Nov 2008 18:21:43 -0300 Subject: Fix driver removal for serial port driver. Because of the last changes serial port driver would not remove all ports registered on probe just the one registered with serial port uuid if registered. --- serial/manager.c | 6 +++--- serial/port.c | 13 +++---------- serial/port.h | 2 +- 3 files changed, 7 insertions(+), 14 deletions(-) (limited to 'serial') diff --git a/serial/manager.c b/serial/manager.c index 60aa78e5..13968c09 100644 --- a/serial/manager.c +++ b/serial/manager.c @@ -107,13 +107,13 @@ static int serial_probe(struct btd_device *device, const char *uuid) return port_register(connection, path, &src, &dst, uuid, ch); } -static void serial_remove(struct btd_device *device, const char *uuid) +static void serial_remove(struct btd_device *device) { const gchar *path = device_get_path(device); DBG("path %s", path); - port_unregister(path, uuid); + port_unregister(path); } @@ -129,7 +129,7 @@ static int port_probe(struct btd_device *device, GSList *uuids) static void port_remove(struct btd_device *device) { - return serial_remove(device, SERIAL_PORT_UUID); + return serial_remove(device); } static struct btd_device_driver serial_port_driver = { diff --git a/serial/port.c b/serial/port.c index 1f62b5e4..911c777e 100644 --- a/serial/port.c +++ b/serial/port.c @@ -463,23 +463,16 @@ int port_register(DBusConnection *conn, const char *path, bdaddr_t *src, return 0; } -int port_unregister(const char *path, const char *uuid) +int port_unregister(const char *path) { struct serial_device *device; - struct serial_port *port; device = find_device(devices, path); if (!device) return -ENOENT; - port = find_port(device->ports, uuid); - if (!port) - return -ENOENT; - - device->ports = g_slist_remove(device->ports, port); - serial_port_free(port); - if (device->ports) - return 0; + g_slist_foreach(device->ports, (GFunc) serial_port_free, NULL); + g_slist_free(device->ports); g_dbus_unregister_interface(device->conn, path, SERIAL_PORT_INTERFACE); diff --git a/serial/port.h b/serial/port.h index 6002ae02..9665dc9d 100644 --- a/serial/port.h +++ b/serial/port.h @@ -26,4 +26,4 @@ void port_release_all(void); int port_register(DBusConnection *conn, const char *path, bdaddr_t *src, bdaddr_t *dst, const char *name, uint8_t channel); -int port_unregister(const char *path, const char *uuid); +int port_unregister(const char *path); -- cgit