summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/bootrom.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-07-22 14:13:43 -0700
committerGreg Kroah-Hartman <gregkh@google.com>2016-07-22 15:25:18 -0700
commit40d276ede92e85e4f414ac655c217e0bf5292cbb (patch)
tree2ce384b1acc47482844079c254444eec4a33af61 /drivers/staging/greybus/bootrom.c
parent6d9e6ffca4226007672800a6681c42cc877aab60 (diff)
greybus: bootrom: Create gb_bootrom_cancel_timeout()
We set timeouts using gb_bootrom_set_timeout(), which hides the internal implementation, i.e. workqueues. While canceling timeouts, we do cancel_delayed_work_sync(), which exposes the internal implementation and doesn't look that clean. Create gb_bootrom_cancel_timeout() to hide the internal implementation here as well. Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/bootrom.c')
-rw-r--r--drivers/staging/greybus/bootrom.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c
index 7cc4d034c421..b90b25cadf5d 100644
--- a/drivers/staging/greybus/bootrom.c
+++ b/drivers/staging/greybus/bootrom.c
@@ -92,6 +92,11 @@ static void gb_bootrom_set_timeout(struct gb_bootrom *bootrom,
schedule_delayed_work(&bootrom->dwork, msecs_to_jiffies(timeout));
}
+static void gb_bootrom_cancel_timeout(struct gb_bootrom *bootrom)
+{
+ cancel_delayed_work_sync(&bootrom->dwork);
+}
+
/*
* The es2 chip doesn't have VID/PID programmed into the hardware and we need to
* hack that up to distinguish different modules and their firmware blobs.
@@ -188,7 +193,7 @@ static int gb_bootrom_firmware_size_request(struct gb_operation *op)
int ret;
/* Disable timeouts */
- cancel_delayed_work_sync(&bootrom->dwork);
+ gb_bootrom_cancel_timeout(bootrom);
if (op->request->payload_size != sizeof(*size_request)) {
dev_err(dev, "%s: illegal size of firmware size request (%zu != %zu)\n",
@@ -242,7 +247,7 @@ static int gb_bootrom_get_firmware(struct gb_operation *op)
int ret = 0;
/* Disable timeouts */
- cancel_delayed_work_sync(&bootrom->dwork);
+ gb_bootrom_cancel_timeout(bootrom);
if (op->request->payload_size != sizeof(*firmware_request)) {
dev_err(dev, "%s: Illegal size of get firmware request (%zu %zu)\n",
@@ -310,7 +315,7 @@ static int gb_bootrom_ready_to_boot(struct gb_operation *op)
int ret = 0;
/* Disable timeouts */
- cancel_delayed_work_sync(&bootrom->dwork);
+ gb_bootrom_cancel_timeout(bootrom);
if (op->request->payload_size != sizeof(*rtb_request)) {
dev_err(dev, "%s: Illegal size of ready to boot request (%zu %zu)\n",
@@ -468,7 +473,7 @@ static int gb_bootrom_probe(struct gb_bundle *bundle,
return 0;
err_cancel_timeout:
- cancel_delayed_work_sync(&bootrom->dwork);
+ gb_bootrom_cancel_timeout(bootrom);
err_connection_disable:
gb_connection_disable(connection);
err_connection_destroy:
@@ -488,7 +493,7 @@ static void gb_bootrom_disconnect(struct gb_bundle *bundle)
gb_connection_disable(bootrom->connection);
/* Disable timeouts */
- cancel_delayed_work_sync(&bootrom->dwork);
+ gb_bootrom_cancel_timeout(bootrom);
/*
* Release firmware: