2017-11-05 03:28:53

by Bryan O'Donoghue

[permalink] [raw]
Subject: [PATCH 0/2] Convert greybus loopback to core async API

dbec27298b0d ('staging: greybus: operation: add generic timeout support')
gives the ability to remove lots of the asynchronous operation code in
loopback.

Kees is also doing a cleanup of timer code which for loopback will go away
when converting to the core API.

These two patches kill two birds with err, two stones (no aggression to
birds intended) namely:

- Converting over to the core asynchronous API
- Getting rid of the timer code in loopback which will unblock what Kees is
doing.

Bryan O'Donoghue (2):
staging: greybus: operation: add private data with get/set accessors
staging: greybus: loopback: convert loopback to use generic async
operations

drivers/staging/greybus/loopback.c | 165 +++++++-----------------------------
drivers/staging/greybus/operation.h | 13 +++
2 files changed, 44 insertions(+), 134 deletions(-)

--
2.7.4


From 1583048907471546650@xxx Fri Nov 03 12:44:44 +0000 2017
X-GM-THRID: 1582543628565070226
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread


2017-11-05 03:29:31

by Bryan O'Donoghue

[permalink] [raw]
Subject: [PATCH 1/2] staging: greybus: operation: add private data with get/set accessors

Asynchronous operation completion handler's lives are made easier if there
is a generic pointer that can store private data associated with the
operation. This patch adds a pointer field to operation.h and get/set
methods to access that pointer.

Signed-off-by: Bryan O'Donoghue <[email protected]>
Cc: Johan Hovold <[email protected]>
Cc: Alex Elder <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
drivers/staging/greybus/operation.h | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/staging/greybus/operation.h b/drivers/staging/greybus/operation.h
index 7529f01..bfec1e9 100644
--- a/drivers/staging/greybus/operation.h
+++ b/drivers/staging/greybus/operation.h
@@ -105,6 +105,8 @@ struct gb_operation {

int active;
struct list_head links; /* connection->operations */
+
+ void *private;
};

static inline bool
@@ -206,6 +208,17 @@ static inline int gb_operation_unidirectional(struct gb_connection *connection,
request, request_size, GB_OPERATION_TIMEOUT_DEFAULT);
}

+static inline void *gb_operation_get_data(struct gb_operation *operation)
+{
+ return operation->private;
+}
+
+static inline void gb_operation_set_data(struct gb_operation *operation,
+ void *data)
+{
+ operation->private = data;
+}
+
int gb_operation_init(void);
void gb_operation_exit(void);

--
2.7.4


From 1583352079062859000@xxx Mon Nov 06 21:03:31 +0000 2017
X-GM-THRID: 1581638883454797945
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread