All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Nicolas Saenz Julienne <nsaenz@kernel.org>
Cc: Fabio Aiuto <fabioaiuto83@gmail.com>,
	linux-staging@lists.linux.dev,
	Stefan Wahren <stefan.wahren@i2se.com>
Subject: [PATCH V2 10/11] staging: vchiq_core: drop vchiq_status from vchiq_initialise
Date: Sun, 25 Apr 2021 12:51:02 +0200	[thread overview]
Message-ID: <1619347863-16080-11-git-send-email-stefan.wahren@i2se.com> (raw)
In-Reply-To: <1619347863-16080-1-git-send-email-stefan.wahren@i2se.com>

Replace the custom set of return values with proper Linux error codes for
vchiq_initialise().

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
---
 .../vc04_services/interface/vchiq_arm/vchiq_arm.c    | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index ab2ce07..04a72d4 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -147,12 +147,11 @@ vchiq_blocking_bulk_transfer(unsigned int handle, void *data,
 	unsigned int size, enum vchiq_bulk_dir dir);
 
 #define VCHIQ_INIT_RETRIES 10
-enum vchiq_status vchiq_initialise(struct vchiq_instance **instance_out)
+int vchiq_initialise(struct vchiq_instance **instance_out)
 {
-	enum vchiq_status status = VCHIQ_ERROR;
 	struct vchiq_state *state;
 	struct vchiq_instance *instance = NULL;
-	int i;
+	int i, ret;
 
 	vchiq_log_trace(vchiq_core_log_level, "%s called", __func__);
 
@@ -170,6 +169,7 @@ enum vchiq_status vchiq_initialise(struct vchiq_instance **instance_out)
 	if (i == VCHIQ_INIT_RETRIES) {
 		vchiq_log_error(vchiq_core_log_level,
 			"%s: videocore not initialized\n", __func__);
+		ret = -ENOTCONN;
 		goto failed;
 	} else if (i > 0) {
 		vchiq_log_warning(vchiq_core_log_level,
@@ -181,6 +181,7 @@ enum vchiq_status vchiq_initialise(struct vchiq_instance **instance_out)
 	if (!instance) {
 		vchiq_log_error(vchiq_core_log_level,
 			"%s: error allocating vchiq instance\n", __func__);
+		ret = -ENOMEM;
 		goto failed;
 	}
 
@@ -191,13 +192,13 @@ enum vchiq_status vchiq_initialise(struct vchiq_instance **instance_out)
 
 	*instance_out = instance;
 
-	status = VCHIQ_SUCCESS;
+	ret = 0;
 
 failed:
 	vchiq_log_trace(vchiq_core_log_level,
-		"%s(%p): returning %d", __func__, instance, status);
+		"%s(%p): returning %d", __func__, instance, ret);
 
-	return status;
+	return ret;
 }
 EXPORT_SYMBOL(vchiq_initialise);
 
@@ -2236,6 +2237,7 @@ vchiq_keepalive_thread_func(void *v)
 	enum vchiq_status status;
 	struct vchiq_instance *instance;
 	unsigned int ka_handle;
+	int ret;
 
 	struct vchiq_service_params_kernel params = {
 		.fourcc      = VCHIQ_MAKE_FOURCC('K', 'E', 'E', 'P'),
@@ -2244,10 +2246,10 @@ vchiq_keepalive_thread_func(void *v)
 		.version_min = KEEPALIVE_VER_MIN
 	};
 
-	status = vchiq_initialise(&instance);
-	if (status != VCHIQ_SUCCESS) {
+	ret = vchiq_initialise(&instance);
+	if (ret) {
 		vchiq_log_error(vchiq_susp_log_level,
-			"%s vchiq_initialise failed %d", __func__, status);
+			"%s vchiq_initialise failed %d", __func__, ret);
 		goto exit;
 	}
 
-- 
2.7.4


  parent reply	other threads:[~2021-04-25 10:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-25 10:50 [PATCH V2 00/11] staging: vchiq_arm: address TODO list Stefan Wahren
2021-04-25 10:50 ` [PATCH V2 01/11] staging: vchiq_arm: avoid crashing the kernel Stefan Wahren
2021-04-25 10:50 ` [PATCH V2 02/11] staging: vchiq_core: break early in vchiq_close_service_internal Stefan Wahren
2021-04-25 10:50 ` [PATCH V2 03/11] staging: vchiq_core: return early in do_abort_bulks Stefan Wahren
2021-04-26  8:37   ` nicolas saenz julienne
2021-04-25 10:50 ` [PATCH V2 04/11] staging: vchiq_core: introduce get_bulk_reason Stefan Wahren
2021-04-26  8:38   ` nicolas saenz julienne
2021-04-25 10:50 ` [PATCH V2 05/11] staging: vchiq_core: Drop unnecessary check in notify_bulks Stefan Wahren
2021-04-25 10:50 ` [PATCH V2 06/11] staging: vchiq_arm: drop return value of vchiq_arm_init_state Stefan Wahren
2021-04-25 10:50 ` [PATCH V2 07/11] staging: vchiq_2835_arm: drop enum vchiq_status Stefan Wahren
2021-04-25 10:51 ` [PATCH V2 08/11] staging: vchiq_arm: drop enum vchiq_status from vchiq_*_internal Stefan Wahren
2021-04-25 10:51 ` [PATCH V2 09/11] staging: vchiq_core: drop vchiq_status from vchiq_set_service_option Stefan Wahren
2021-04-26  8:39   ` nicolas saenz julienne
2021-06-03  8:03   ` nicolas saenz julienne
2021-04-25 10:51 ` Stefan Wahren [this message]
2021-04-25 10:51 ` [PATCH V2 11/11] staging: vchiq_core: drop vchiq_status from vchiq_init_state Stefan Wahren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1619347863-16080-11-git-send-email-stefan.wahren@i2se.com \
    --to=stefan.wahren@i2se.com \
    --cc=fabioaiuto83@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=nsaenz@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.