Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751777AbdKFBcq (ORCPT ); Sun, 5 Nov 2017 20:32:46 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:49444 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751561AbdKFBc1 (ORCPT ); Sun, 5 Nov 2017 20:32:27 -0500 X-Google-Smtp-Source: ABhQp+QCv9Ys3vMRJ3MxthvNbIX8/UInq32K+sk361NygjinzXFHJU3m8Sb4+zbo2SQUbfoAyFkBcA== From: "Bryan O'Donoghue" To: johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, keescook@chromium.org, linux-kernel@vger.kernel.org Cc: "Bryan O'Donoghue" , Mitch Tasman , greybus-dev@lists.linaro.org Subject: [PATCH v3 3/4] staging: greybus: operation: add private data with get/set accessors Date: Mon, 6 Nov 2017 01:32:21 +0000 Message-Id: <1509931942-25712-4-git-send-email-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509931942-25712-1-git-send-email-pure.logic@nexus-software.ie> References: <1509931942-25712-1-git-send-email-pure.logic@nexus-software.ie> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 struct gb_operation and get/set methods to access that pointer. Signed-off-by: Bryan O'Donoghue Cc: Johan Hovold Cc: Alex Elder Cc: Greg Kroah-Hartman Cc: Mitch Tasman Cc: greybus-dev@lists.linaro.org Cc: devel@driverdev.osuosl.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Johan Hovold --- 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