diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-01-11 07:44:46 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-03-24 15:56:46 -0400 |
commit | 81610b8fbfc027a67707ff567d490819a3d55844 (patch) | |
tree | b828ef4868938534fb17d75659246715179a29f5 /drivers/firewire | |
parent | 5d9cb7d276a9c465fef5a771792eac2cf1929f2b (diff) |
firewire: cdev: simplify a schedule_delayed_work wrapper
The kernel API documentation says that queue_delayed_work() returns 0
(only) if the work was already queued. The return codes of
schedule_delayed_work() are not documented but the same.
In init_iso_resource(), the work has never been queued yet, hence we
can assume schedule_delayed_work() to be a guaranteed success there.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/fw-cdev.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c index 257b0c709a8b..214e534efee5 100644 --- a/drivers/firewire/fw-cdev.c +++ b/drivers/firewire/fw-cdev.c | |||
@@ -129,7 +129,7 @@ struct iso_resource { | |||
129 | struct iso_resource_event *e_alloc, *e_dealloc; | 129 | struct iso_resource_event *e_alloc, *e_dealloc; |
130 | }; | 130 | }; |
131 | 131 | ||
132 | static int schedule_iso_resource(struct iso_resource *); | 132 | static void schedule_iso_resource(struct iso_resource *); |
133 | static void release_iso_resource(struct client *, struct client_resource *); | 133 | static void release_iso_resource(struct client *, struct client_resource *); |
134 | 134 | ||
135 | /* | 135 | /* |
@@ -1111,17 +1111,11 @@ static void iso_resource_work(struct work_struct *work) | |||
1111 | client_put(client); | 1111 | client_put(client); |
1112 | } | 1112 | } |
1113 | 1113 | ||
1114 | static int schedule_iso_resource(struct iso_resource *r) | 1114 | static void schedule_iso_resource(struct iso_resource *r) |
1115 | { | 1115 | { |
1116 | int scheduled; | ||
1117 | |||
1118 | client_get(r->client); | 1116 | client_get(r->client); |
1119 | 1117 | if (!schedule_delayed_work(&r->work, 0)) | |
1120 | scheduled = schedule_delayed_work(&r->work, 0); | ||
1121 | if (!scheduled) | ||
1122 | client_put(r->client); | 1118 | client_put(r->client); |
1123 | |||
1124 | return scheduled; | ||
1125 | } | 1119 | } |
1126 | 1120 | ||
1127 | static void release_iso_resource(struct client *client, | 1121 | static void release_iso_resource(struct client *client, |
@@ -1173,13 +1167,13 @@ static int init_iso_resource(struct client *client, | |||
1173 | if (todo == ISO_RES_ALLOC) { | 1167 | if (todo == ISO_RES_ALLOC) { |
1174 | r->resource.release = release_iso_resource; | 1168 | r->resource.release = release_iso_resource; |
1175 | ret = add_client_resource(client, &r->resource, GFP_KERNEL); | 1169 | ret = add_client_resource(client, &r->resource, GFP_KERNEL); |
1170 | if (ret < 0) | ||
1171 | goto fail; | ||
1176 | } else { | 1172 | } else { |
1177 | r->resource.release = NULL; | 1173 | r->resource.release = NULL; |
1178 | r->resource.handle = -1; | 1174 | r->resource.handle = -1; |
1179 | ret = schedule_iso_resource(r) ? 0 : -ENOMEM; | 1175 | schedule_iso_resource(r); |
1180 | } | 1176 | } |
1181 | if (ret < 0) | ||
1182 | goto fail; | ||
1183 | request->handle = r->resource.handle; | 1177 | request->handle = r->resource.handle; |
1184 | 1178 | ||
1185 | return 0; | 1179 | return 0; |