From patchwork Thu Nov 2 14:32:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 117823 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2245100qgn; Thu, 2 Nov 2017 07:33:16 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RELOM9lJt9asx2dhk0ruujcbKSJzVvMj+UkxQaBX8viQCOSDans10X2Qk4VxcJTe+sTAez X-Received: by 10.99.186.73 with SMTP id l9mr3733092pgu.6.1509633196591; Thu, 02 Nov 2017 07:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509633196; cv=none; d=google.com; s=arc-20160816; b=mG/cm3RxgDZoiQnnTW7Sgw4LIHh4ajYNktSXRnEp1/187QsRpF5dFsPLfjzMybZU6G XbmmBXHcUTCnBxFwb087fcJgpiciDOsc9iSUQELOP56Uv5nSqJB44QgikOANwQM6Jp9v mun/1gVtKoJbOoh6C70L5J6bYORfFmb+WZW/nBeQi5UZ/iN+rG3OFCtMtjbmbXi2I7V6 kL6jK2n5KGM63XoR9srduemsc8Se3tQMmpHiUXQGcPSKmd3YwAVuZMgXxNB6Ol9XY4dm 7m+D0X0x7rHY2XMzWCp0FFrvZIT/hEpJ69NX9TQ0ICefro8FT6wVUwC60Cpt8fHhnH0I 0WKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=lkOQjwuOJTyuqWuaqetaHZw2XsswoqMZaZYXfypWuVQ=; b=Z3IXvddkn6hPUnEBm692TVzxvCUfvGOAgMz90tQkFjIdS/AdEclV21aHGX5NsNM3WC IZpZTt6B5Scz/McH7XsOqCTA3sZzSRhwg0VQfGy5JTHdJsoo+FR/6NmIYRnvOqkZ8fN5 RX4M5As9J5hnmf69e4XFrrVF/9rgzF9BsW06FulUXa8Ya5G6/tYmATmoyRVvA6M0RoRt A+1lNQKtpYJHb9sUsp1ElpvCiCzT8kamSjGw3gxzXbr5hpzny7NwzPbDCJrq9ae2+uxZ /R3u5/a51TmDkgeoude/or4gTV+TRAOOItX8bP74nO5L6I8aqypyjEFbPVKjA8inLz+3 eIPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si2534481plb.469.2017.11.02.07.33.16; Thu, 02 Nov 2017 07:33:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933563AbdKBOdP (ORCPT + 26 others); Thu, 2 Nov 2017 10:33:15 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:57882 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932999AbdKBOdM (ORCPT ); Thu, 2 Nov 2017 10:33:12 -0400 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0MfN1e-1dlb6O0I8Y-00OrlK; Thu, 02 Nov 2017 15:33:06 +0100 From: Arnd Bergmann To: "Bryan O'Donoghue" , Johan Hovold , Alex Elder , Greg Kroah-Hartman Cc: Arnd Bergmann , Viresh Kumar , Gioh Kim , Arushi Singhal , Abdul Rauf , greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] staging: greybus: remove unused kfifo_ts Date: Thu, 2 Nov 2017 15:32:51 +0100 Message-Id: <20171102143304.851481-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:j9Q/PG1SJriJVJyqs+HeYvvu2a5bqDm4W6Z8O4hoZz3xT+fVgSQ 3rQ0k0qhAeGB1g/4zhgus8D1rtdHdLF510FURoMayl2E9RVjAbodQ3XJgIBaxCI2ORXyHb9 RvGVe3sKSXbFPCq3O+hUeEfeCVr+bgUeoj3EbIeDlgSN7aBtU8smD4a0YyHoE2GBstDDYT4 9oQfnm5F2tQ9BEY7JIA3Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:l4b57FXkaFA=:Jah4Tbb0zY3vTyfWayR/vE rJVVHH+6SgxwlF9/H90JCFbSNJUfDmhla8NBwpXRC0ff8udbnEVxSmHPc2fExt+TgQin+hNwj yhZ0PdWNtlYdK61zisE/ub527Sh5g9ATCBqwykArYyZtbm3WCZcwLT2SWbaicG+DYUUR5nox7 c4HPV4nU2XNHkAITQghRzRI7yw5MZE6hlBEztB/jUxuiaGRYwRymaZ2BwZ8m0jMALKkPslYgN v33IOEaVg2YJ9LwY8GhWXCYvrWIqEA2HaBvi6p1usVJrVKJFqjmLVd1FU6mM3fAOv17TyVB89 TOIZRSDbRCc7iNQUdUDxSP8s0DUP42ASheFRK7RmC3P50t+/ChJHG5uCXAhylKenJj3dDNKSJ eCZBceGxTLkO1t64jUPMBuMcNk0iOWcMKtxvVo1GOs++xY5EEYfmzDhZbkq4kwmqE2llpeN1M C9+VLM0KblSoiAZnZ/n9OHbRrbCyd0yr05GRlqg6vBa7Zqd8+KqT7giEyM3OxMpMcw+sXNBxl JxTfA8CexTuDX2WORo3rsaAWAHsd3F9k3NYHkfqsxVMtFmQ5GgB8tIWNO+lGTp7rKJtUCROE+ n89ZOHEaA6Sfnmn4GZAKP3fwi6d1NaVJfdUzgDXHJy3QWkReUkvHcCtemIUH4daEf/FCgoLCj Z0Y9zi02vQl3Ggrbxc+IXLulqi5hbYsars2K/mPOWfeBA7PvJnz97fQclaUG3KFmjuN/QFcrx kynlIWJc9DxFHVSB0wMdM8aL9jF6s/yMpnioJA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As of commit 8e1d6c336d74 ("greybus: loopback: drop bus aggregate calculation"), nothing ever reads from kfifo_ts, so there is no reason to write to it or even allocate it any more. Signed-off-by: Arnd Bergmann --- drivers/staging/greybus/loopback.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) -- 2.9.0 Reviewed-by: Bryan O'Donoghue Reviewed-by: Viresh Kumar diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 08e255884206..85046fb16aad 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -72,7 +72,6 @@ struct gb_loopback { struct dentry *file; struct kfifo kfifo_lat; - struct kfifo kfifo_ts; struct mutex mutex; struct task_struct *task; struct list_head entry; @@ -262,7 +261,6 @@ static void gb_loopback_check_attr(struct gb_loopback *gb) gb->iteration_max, kfifo_depth); } kfifo_reset_out(&gb->kfifo_lat); - kfifo_reset_out(&gb->kfifo_ts); switch (gb->type) { case GB_LOOPBACK_TYPE_PING: @@ -387,13 +385,6 @@ static u64 gb_loopback_calc_latency(struct timeval *ts, struct timeval *te) return __gb_loopback_calc_latency(t1, t2); } -static void gb_loopback_push_latency_ts(struct gb_loopback *gb, - struct timeval *ts, struct timeval *te) -{ - kfifo_in(&gb->kfifo_ts, (unsigned char *)ts, sizeof(*ts)); - kfifo_in(&gb->kfifo_ts, (unsigned char *)te, sizeof(*te)); -} - static int gb_loopback_operation_sync(struct gb_loopback *gb, int type, void *request, int request_size, void *response, int response_size) @@ -433,7 +424,6 @@ static int gb_loopback_operation_sync(struct gb_loopback *gb, int type, do_gettimeofday(&te); /* Calculate the total time the message took */ - gb_loopback_push_latency_ts(gb, &ts, &te); gb->elapsed_nsecs = gb_loopback_calc_latency(&ts, &te); out_put_operation: @@ -521,11 +511,9 @@ static void gb_loopback_async_operation_callback(struct gb_operation *operation) err = true; } - if (!err) { - gb_loopback_push_latency_ts(gb, &op_async->ts, &te); + if (!err) gb->elapsed_nsecs = gb_loopback_calc_latency(&op_async->ts, &te); - } if (op_async->pending) { if (err) @@ -1241,18 +1229,12 @@ static int gb_loopback_probe(struct gb_bundle *bundle, retval = -ENOMEM; goto out_conn; } - if (kfifo_alloc(&gb->kfifo_ts, kfifo_depth * sizeof(struct timeval) * 2, - GFP_KERNEL)) { - retval = -ENOMEM; - goto out_kfifo0; - } - /* Fork worker thread */ mutex_init(&gb->mutex); gb->task = kthread_run(gb_loopback_fn, gb, "gb_loopback"); if (IS_ERR(gb->task)) { retval = PTR_ERR(gb->task); - goto out_kfifo1; + goto out_kfifo; } spin_lock_irqsave(&gb_dev.lock, flags); @@ -1266,9 +1248,7 @@ static int gb_loopback_probe(struct gb_bundle *bundle, return 0; -out_kfifo1: - kfifo_free(&gb->kfifo_ts); -out_kfifo0: +out_kfifo: kfifo_free(&gb->kfifo_lat); out_conn: device_unregister(dev); @@ -1302,7 +1282,6 @@ static void gb_loopback_disconnect(struct gb_bundle *bundle) kthread_stop(gb->task); kfifo_free(&gb->kfifo_lat); - kfifo_free(&gb->kfifo_ts); gb_connection_latency_tag_disable(gb->connection); debugfs_remove(gb->file); From patchwork Thu Nov 2 14:32:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 117824 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2245247qgn; Thu, 2 Nov 2017 07:33:25 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SQlCnwUEClSlULPpI9AZFyCfgZRsv1QIzCtHm5pVte2IVPpTj8HgXxwTOzwO3ZVbd3mcrx X-Received: by 10.159.246.16 with SMTP id b16mr2324814pls.0.1509633204819; Thu, 02 Nov 2017 07:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509633204; cv=none; d=google.com; s=arc-20160816; b=EuKNWIO5nxP3fAc+yb+nsP1LjDhYnapsXye3qvrcZNfY/Pom5lqUX6K2jE0c4IFfBx hjKza8kZoS31+CLeU7jK2Q4H4BnfuUjM5SbWHPN/FHhOIuoLhqDGtEq45ZA6NL5ldGjo tvEckybcBbp+4PtpcUE3Dn2toALybH6BLDSt1OgRgxTxzvI/3PlLro8SJAlcnzF8ZlGk S36gz7plEiSNBm5MnSXm7WzA/LJNFAMPzhHsmre08GrudzQ+NcjAEHjC6z6pRZbKeBP7 Iyi40Jyb+r9cK12PSJB7wKv6qdcc1wIljgzNajMbyRnqSv6xoHWqlAxATIShSlsph7+n TQIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ofVHaC6IBiXpMEYpLvf24PkZrKCMLF+cdT7LI3FY1Uw=; b=Y31k/fjh2VAh/+JtGQNYXdx88Ixsq6u6Ofu6KCZ3SsVr1tQhxMjFo30xrPJOhTBSbs epUdIM3pwErL/2osUl7VnlvpM/i6gKbCRwDH0KAdDCGP7dzuTm+mP6WmZIDSHbt0m6+Y kycZIbI/rViuyHHY9fBf31agIsq6o2ZNQBSlHlILGDoEyb2tDVnG021tYIVSVrq547PF gEy9slqruXZ8H8w+6vAoK9ZUDs1s6/wq44v1cZgvVJ6l05IAAq0PbDIIves/PRiR0tOs 0LJCyIRKWqfI7QwBWMwKZGKvJOTp9pVHit7oN4xiQDxtpD74kV8ho4TY9E9ZbqgGUeAC tWHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p33si2477873pld.51.2017.11.02.07.33.24; Thu, 02 Nov 2017 07:33:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933587AbdKBOdX (ORCPT + 26 others); Thu, 2 Nov 2017 10:33:23 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:52289 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932999AbdKBOdU (ORCPT ); Thu, 2 Nov 2017 10:33:20 -0400 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0Ly6OT-1d7HSv1g9d-015ZqP; Thu, 02 Nov 2017 15:33:12 +0100 From: Arnd Bergmann To: "Bryan O'Donoghue" , Johan Hovold , Alex Elder , Greg Kroah-Hartman Cc: Arnd Bergmann , Gioh Kim , Abdul Rauf , Arushi Singhal , greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] staging: greybus/loopback: use ktime_get() for time intervals Date: Thu, 2 Nov 2017 15:32:52 +0100 Message-Id: <20171102143304.851481-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171102143304.851481-1-arnd@arndb.de> References: <20171102143304.851481-1-arnd@arndb.de> X-Provags-ID: V03:K0:ofAwOwMcjEHy1RwGfIIqmmDChQlSVI3uXYMmHy/dYS7WRybfGkN aS4GANOMfwblJvp2272bJliLOneDmMA1FUfUa1y6ZembizpRXj8T7cgBSbOB0+8nMVzA1Il 073eTQzGWakeMlmqno8m6zOvzwycbDqFTVY+U1Mqg3Lp3+k/yEw0dYYOACTZpR6e93CUd/i vDZz3sJQUgTJqjHo/efEw== X-UI-Out-Filterresults: notjunk:1; V01:K0:VJFuYenMypM=:ykCe5//mYGbZaeRk+B9OWe WC4aPhOybTbHHlrFo3PxsE4FwUKYCyy4ojaz60YPybIcL0J23Q9AV/Wa6V32q9fwucGyzxYbw xZxnXhNGDdcNJqEW1XRY5OJ3asCed7pxpfaP7GE9p+TOaz0Hahr7e9OfLMNfhiKUnOAWTKpJF X0lXVXnSssRO2iUo7byohDZPwZutmzhygX7rXqHFHg84ohfjwVliHi0I6b7MGobSbilvTz3iX ewJ9DPQySsL0hQp3yow6ecoZ+0PFo81Jlf1i20Chb94pA1kXBRc5u84vjQxNipfO5ZtHQaH4N wZFVqJW/+u0zEZyO7bePvLAtLw0zfXF0AIoPDH+O1O7YStyH4mnDQy9Mwt9Ni8bQisFiPHgV5 37/5EpzsGO/kF8KESeIvVjTVeqG9wkjhEyd6EAsqOszr5wLdLJZ9dUkfTy3pvLmyRbiZmG0w2 JSAiGe+cqIAklLRv7kBhwIxZ11h70+4nsJv2zzoQDN8uSlu4mm+11sd8BOIhoy0hN4kAJdYfX G6C1S7+yUfzBKbMmSbObKB2PitOe2oIeIqQhGw3RBShailF7XjmC1SiBig4UXcEN6vhc1HfMQ W0j3F0/eci2dj3PCLhYrUI8hEwbiHRgA4IHM5t/YvE+A1QGk80DbQGy+VeaN2TyERsHzKf5fS xlhDC7GqnYLy0rZTcQ/4wScQU9IvGTM16oUp1MHlQxzaBEfEaJ6UoFzA44U8+nIEQrEo23+uN oNRx/oe3HJ2r0dwQrJ/e7Cj0EO/lEU/KiYanOA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This driver is the only one using the deprecated timeval_to_ns() helper. Changing it from do_gettimeofday() to ktime_get() makes the code more efficient, more robust against concurrent settimeofday(), more accurate and lets us get rid of that helper in the future. Signed-off-by: Arnd Bergmann --- drivers/staging/greybus/loopback.c | 42 ++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 24 deletions(-) -- 2.9.0 Reviewed-by: Viresh Kumar Acked-by: Bryan O'Donoghue diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 85046fb16aad..3d92638c424b 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -58,7 +58,7 @@ static struct gb_loopback_device gb_dev; struct gb_loopback_async_operation { struct gb_loopback *gb; struct gb_operation *operation; - struct timeval ts; + ktime_t ts; struct timer_list timer; struct list_head entry; struct work_struct work; @@ -81,7 +81,7 @@ struct gb_loopback { atomic_t outstanding_operations; /* Per connection stats */ - struct timeval ts; + ktime_t ts; struct gb_loopback_stats latency; struct gb_loopback_stats throughput; struct gb_loopback_stats requests_per_second; @@ -375,14 +375,9 @@ static u64 __gb_loopback_calc_latency(u64 t1, u64 t2) return NSEC_PER_DAY - t2 + t1; } -static u64 gb_loopback_calc_latency(struct timeval *ts, struct timeval *te) +static u64 gb_loopback_calc_latency(ktime_t ts, ktime_t te) { - u64 t1, t2; - - t1 = timeval_to_ns(ts); - t2 = timeval_to_ns(te); - - return __gb_loopback_calc_latency(t1, t2); + return __gb_loopback_calc_latency(ktime_to_ns(ts), ktime_to_ns(te)); } static int gb_loopback_operation_sync(struct gb_loopback *gb, int type, @@ -390,10 +385,10 @@ static int gb_loopback_operation_sync(struct gb_loopback *gb, int type, void *response, int response_size) { struct gb_operation *operation; - struct timeval ts, te; + ktime_t ts, te; int ret; - do_gettimeofday(&ts); + ts = ktime_get(); operation = gb_operation_create(gb->connection, type, request_size, response_size, GFP_KERNEL); if (!operation) @@ -421,10 +416,10 @@ static int gb_loopback_operation_sync(struct gb_loopback *gb, int type, } } - do_gettimeofday(&te); + te = ktime_get(); /* Calculate the total time the message took */ - gb->elapsed_nsecs = gb_loopback_calc_latency(&ts, &te); + gb->elapsed_nsecs = gb_loopback_calc_latency(ts, te); out_put_operation: gb_operation_put(operation); @@ -492,10 +487,10 @@ static void gb_loopback_async_operation_callback(struct gb_operation *operation) { struct gb_loopback_async_operation *op_async; struct gb_loopback *gb; - struct timeval te; + ktime_t te; bool err = false; - do_gettimeofday(&te); + te = ktime_get(); op_async = gb_loopback_operation_find(operation->id); if (!op_async) return; @@ -512,8 +507,7 @@ static void gb_loopback_async_operation_callback(struct gb_operation *operation) } if (!err) - gb->elapsed_nsecs = gb_loopback_calc_latency(&op_async->ts, - &te); + gb->elapsed_nsecs = gb_loopback_calc_latency(op_async->ts, te); if (op_async->pending) { if (err) @@ -608,7 +602,7 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type, list_add_tail(&op_async->entry, &gb_dev.list_op_async); spin_unlock_irqrestore(&gb_dev.lock, flags); - do_gettimeofday(&op_async->ts); + op_async->ts = ktime_get(); op_async->pending = true; atomic_inc(&gb->outstanding_operations); mutex_lock(&gb->mutex); @@ -842,7 +836,7 @@ static void gb_loopback_reset_stats(struct gb_loopback *gb) /* Should be initialized at least once per transaction set */ gb->apbridge_latency_ts = 0; gb->gbphy_latency_ts = 0; - memset(&gb->ts, 0, sizeof(struct timeval)); + gb->ts = ktime_set(0, 0); } static void gb_loopback_update_stats(struct gb_loopback_stats *stats, u32 val) @@ -925,15 +919,15 @@ static void gb_loopback_calculate_stats(struct gb_loopback *gb, bool error) { u64 nlat; u32 lat; - struct timeval te; + ktime_t te; if (!error) { gb->requests_completed++; gb_loopback_calculate_latency_stats(gb); } - do_gettimeofday(&te); - nlat = gb_loopback_calc_latency(&gb->ts, &te); + te = ktime_get(); + nlat = gb_loopback_calc_latency(gb->ts, te); if (nlat >= NSEC_PER_SEC || gb->iteration_count == gb->iteration_max) { lat = gb_loopback_nsec_to_usec_latency(nlat); @@ -1017,8 +1011,8 @@ static int gb_loopback_fn(void *data) size = gb->size; us_wait = gb->us_wait; type = gb->type; - if (gb->ts.tv_usec == 0 && gb->ts.tv_sec == 0) - do_gettimeofday(&gb->ts); + if (ktime_to_ns(gb->ts) == 0) + gb->ts = ktime_get(); mutex_unlock(&gb->mutex); /* Else operations to perform */