#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include <linux/atomic.h>
+#include <linux/pm_runtime.h>
#include <asm/div64.h>
int error = 0;
int us_wait = 0;
int type;
+ int ret;
u32 size;
struct gb_loopback *gb = data;
+ struct gb_bundle *bundle = gb->connection->bundle;
+
+ ret = gb_pm_runtime_get_sync(bundle);
+ if (ret)
+ return ret;
while (1) {
- if (!gb->type)
+ if (!gb->type) {
+ gb_pm_runtime_put_autosuspend(bundle);
wait_event_interruptible(gb->wq, gb->type ||
kthread_should_stop());
+ ret = gb_pm_runtime_get_sync(bundle);
+ if (ret)
+ return ret;
+ }
+
if (kthread_should_stop())
break;
if (us_wait)
udelay(us_wait);
}
+
+ gb_pm_runtime_put_autosuspend(bundle);
+
return 0;
}
spin_unlock_irqrestore(&gb_dev.lock, flags);
gb_connection_latency_tag_enable(connection);
+
+ gb_pm_runtime_put_autosuspend(bundle);
+
return 0;
out_kfifo1:
{
struct gb_loopback *gb = greybus_get_drvdata(bundle);
unsigned long flags;
+ int ret;
+
+ ret = gb_pm_runtime_get_sync(bundle);
+ if (ret)
+ gb_pm_runtime_get_noresume(bundle);
gb_connection_disable(gb->connection);