* [PATCH] Remove unused fields in btd_driver_data struct @ 2011-03-22 20:56 Claudio Takahasi 2011-03-22 21:10 ` Johan Hedberg 0 siblings, 1 reply; 5+ messages in thread From: Claudio Takahasi @ 2011-03-22 20:56 UTC (permalink / raw) To: linux-bluetooth; +Cc: Claudio Takahasi --- src/device.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/src/device.c b/src/device.c index e9d9e65..5121064 100644 --- a/src/device.c +++ b/src/device.c @@ -68,9 +68,7 @@ #define GLOBAL_TRUST "[all]" struct btd_driver_data { - guint id; struct btd_device_driver *driver; - void *priv; }; struct btd_disconnect_data { -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Remove unused fields in btd_driver_data struct 2011-03-22 20:56 [PATCH] Remove unused fields in btd_driver_data struct Claudio Takahasi @ 2011-03-22 21:10 ` Johan Hedberg 2011-03-22 21:36 ` Claudio Takahasi 0 siblings, 1 reply; 5+ messages in thread From: Johan Hedberg @ 2011-03-22 21:10 UTC (permalink / raw) To: Claudio Takahasi; +Cc: linux-bluetooth Hi Claudio, On Tue, Mar 22, 2011, Claudio Takahasi wrote: > --- > src/device.c | 2 -- > 1 files changed, 0 insertions(+), 2 deletions(-) > > diff --git a/src/device.c b/src/device.c > index e9d9e65..5121064 100644 > --- a/src/device.c > +++ b/src/device.c > @@ -68,9 +68,7 @@ > #define GLOBAL_TRUST "[all]" > > struct btd_driver_data { > - guint id; > struct btd_device_driver *driver; > - void *priv; > }; Why is btd_driver_data needed at all if btd_device_driver is the only thing that it contains (i.e. why can't places pointing to btd_driver_data just point to btd_device_driver directly)? Johan ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Remove unused fields in btd_driver_data struct 2011-03-22 21:10 ` Johan Hedberg @ 2011-03-22 21:36 ` Claudio Takahasi 2011-03-23 12:20 ` [PATCH 1/2] Remove unnecessary " Claudio Takahasi 0 siblings, 1 reply; 5+ messages in thread From: Claudio Takahasi @ 2011-03-22 21:36 UTC (permalink / raw) To: Claudio Takahasi, linux-bluetooth; +Cc: Johan Hedberg Hi Johan, On Tue, Mar 22, 2011 at 9:10 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote: > Hi Claudio, > > On Tue, Mar 22, 2011, Claudio Takahasi wrote: >> --- >> src/device.c | 2 -- >> 1 files changed, 0 insertions(+), 2 deletions(-) >> >> diff --git a/src/device.c b/src/device.c >> index e9d9e65..5121064 100644 >> --- a/src/device.c >> +++ b/src/device.c >> @@ -68,9 +68,7 @@ >> #define GLOBAL_TRUST "[all]" >> >> struct btd_driver_data { >> - guint id; >> struct btd_device_driver *driver; >> - void *priv; >> }; > > Why is btd_driver_data needed at all if btd_device_driver is the only > thing that it contains (i.e. why can't places pointing to > btd_driver_data just point to btd_device_driver directly)? > > Johan > I did a quick look in the code, we can point directly to the btd_device_driver and remove the btd_driver_data struct. This structure was added by the commit b76fbc7d in 2008, I don't think that there is a plan to use it :-) "*priv" was never used and "guint id;" seems to be added by mistake. Please ignore this patch, I will send another patch removing btd_driver_data struct. Claudio. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] Remove unnecessary btd_driver_data struct 2011-03-22 21:36 ` Claudio Takahasi @ 2011-03-23 12:20 ` Claudio Takahasi 2011-03-23 13:24 ` Johan Hedberg 0 siblings, 1 reply; 5+ messages in thread From: Claudio Takahasi @ 2011-03-23 12:20 UTC (permalink / raw) To: linux-bluetooth; +Cc: Claudio Takahasi --- src/device.c | 29 ++++++----------------------- 1 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/device.c b/src/device.c index e9d9e65..b4d13f2 100644 --- a/src/device.c +++ b/src/device.c @@ -67,12 +67,6 @@ /* When all services should trust a remote device */ #define GLOBAL_TRUST "[all]" -struct btd_driver_data { - guint id; - struct btd_device_driver *driver; - void *priv; -}; - struct btd_disconnect_data { guint id; disconnect_watch watch; @@ -120,7 +114,7 @@ struct btd_device { GSList *uuids; GSList *services; /* Primary services path */ GSList *primaries; /* List of primary services */ - GSList *drivers; /* List of driver_data */ + GSList *drivers; /* List of device drivers */ GSList *watches; /* List of disconnect_data */ gboolean temporary; struct agent *agent; @@ -413,15 +407,12 @@ static DBusMessage *set_trust(DBusConnection *conn, DBusMessage *msg, return dbus_message_new_method_return(msg); } -static void driver_remove(struct btd_driver_data *driver_data, +static void driver_remove(struct btd_device_driver *driver, struct btd_device *device) { - struct btd_device_driver *driver = driver_data->driver; - driver->remove(device); - device->drivers = g_slist_remove(device->drivers, driver_data); - g_free(driver_data); + device->drivers = g_slist_remove(device->drivers, driver); } static gboolean do_disconnect(gpointer user_data) @@ -1145,26 +1136,21 @@ void device_probe_drivers(struct btd_device *device, GSList *profiles) for (list = device_drivers; list; list = list->next) { struct btd_device_driver *driver = list->data; GSList *probe_uuids; - struct btd_driver_data *driver_data; probe_uuids = device_match_driver(device, driver, profiles); if (!probe_uuids) continue; - driver_data = g_new0(struct btd_driver_data, 1); - err = driver->probe(device, probe_uuids); if (err < 0) { error("%s driver probe failed for device %s", driver->name, addr); - g_free(driver_data); g_slist_free(probe_uuids); continue; } - driver_data->driver = driver; - device->drivers = g_slist_append(device->drivers, driver_data); + device->drivers = g_slist_append(device->drivers, driver); g_slist_free(probe_uuids); } @@ -1198,8 +1184,7 @@ static void device_remove_drivers(struct btd_device *device, GSList *uuids) DBG("Removing drivers for %s", dstaddr); for (list = device->drivers; list; list = next) { - struct btd_driver_data *driver_data = list->data; - struct btd_device_driver *driver = driver_data->driver; + struct btd_device_driver *driver = list->data; const char **uuid; next = list->next; @@ -1214,9 +1199,7 @@ static void device_remove_drivers(struct btd_device *device, GSList *uuids) driver->remove(device); device->drivers = g_slist_remove(device->drivers, - driver_data); - g_free(driver_data); - + driver); break; } } -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Remove unnecessary btd_driver_data struct 2011-03-23 12:20 ` [PATCH 1/2] Remove unnecessary " Claudio Takahasi @ 2011-03-23 13:24 ` Johan Hedberg 0 siblings, 0 replies; 5+ messages in thread From: Johan Hedberg @ 2011-03-23 13:24 UTC (permalink / raw) To: Claudio Takahasi; +Cc: linux-bluetooth Hi Claudio, On Wed, Mar 23, 2011, Claudio Takahasi wrote: > --- > src/device.c | 29 ++++++----------------------- > 1 files changed, 6 insertions(+), 23 deletions(-) Thanks. Both patches have been pushed upstream. Johan ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-03-23 13:24 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-03-22 20:56 [PATCH] Remove unused fields in btd_driver_data struct Claudio Takahasi 2011-03-22 21:10 ` Johan Hedberg 2011-03-22 21:36 ` Claudio Takahasi 2011-03-23 12:20 ` [PATCH 1/2] Remove unnecessary " Claudio Takahasi 2011-03-23 13:24 ` Johan Hedberg
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox