All of lore.kernel.org
 help / color / mirror / Atom feed
From: nicolas saenz julienne <nsaenz@kernel.org>
To: Stefan Wahren <stefan.wahren@i2se.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Fabio Aiuto <fabioaiuto83@gmail.com>, linux-staging@lists.linux.dev
Subject: Re: [PATCH V2 09/11] staging: vchiq_core: drop vchiq_status from vchiq_set_service_option
Date: Thu, 03 Jun 2021 10:03:02 +0200	[thread overview]
Message-ID: <ccefdaedd79855086684f6188c42a6f3abaa6926.camel@kernel.org> (raw)
In-Reply-To: <1619347863-16080-10-git-send-email-stefan.wahren@i2se.com>

On Sun, 2021-04-25 at 12:51 +0200, Stefan Wahren wrote:
> Replace the custom set of return values with proper Linux error codes for
> vchiq_set_service_option(). Now we can use the result directly as return
> value for vchiq_ioctl().
> 
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> ---

Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>

Regards,
Nicolas

>  .../vc04_services/interface/vchiq_arm/vchiq_arm.c      |  4 ++--
>  .../vc04_services/interface/vchiq_arm/vchiq_core.c     | 18 +++++++++---------
>  .../vc04_services/interface/vchiq_arm/vchiq_core.h     |  2 +-
>  3 files changed, 12 insertions(+), 12 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 3395201..ab2ce07 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -1517,8 +1517,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>  			break;
>  		}
>  
> 
> -		status = vchiq_set_service_option(
> -				args.handle, args.option, args.value);
> +		ret = vchiq_set_service_option(args.handle, args.option,
> +					       args.value);
>  	} break;
>  
> 
>  	case VCHIQ_IOC_LIB_VERSION: {
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> index 9f9677a..e150feb 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> @@ -3371,21 +3371,21 @@ void vchiq_get_config(struct vchiq_config *config)
>  	config->version_min            = VCHIQ_VERSION_MIN;
>  }
>  
> 
> -enum vchiq_status
> +int
>  vchiq_set_service_option(unsigned int handle,
>  	enum vchiq_service_option option, int value)
>  {
>  	struct vchiq_service *service = find_service_by_handle(handle);
> -	enum vchiq_status status = VCHIQ_ERROR;
>  	struct vchiq_service_quota *quota;
> +	int ret = -EINVAL;
>  
> 
>  	if (!service)
> -		return VCHIQ_ERROR;
> +		return -EINVAL;
>  
> 
>  	switch (option) {
>  	case VCHIQ_SERVICE_OPTION_AUTOCLOSE:
>  		service->auto_close = value;
> -		status = VCHIQ_SUCCESS;
> +		ret = 0;
>  		break;
>  
> 
>  	case VCHIQ_SERVICE_OPTION_SLOT_QUOTA:
> @@ -3402,7 +3402,7 @@ vchiq_set_service_option(unsigned int handle,
>  				 * dropped below its quota
>  				 */
>  				complete(&quota->quota_event);
> -			status = VCHIQ_SUCCESS;
> +			ret = 0;
>  		}
>  		break;
>  
> 
> @@ -3420,7 +3420,7 @@ vchiq_set_service_option(unsigned int handle,
>  				 * dropped below its quota
>  				 */
>  				complete(&quota->quota_event);
> -			status = VCHIQ_SUCCESS;
> +			ret = 0;
>  		}
>  		break;
>  
> 
> @@ -3428,13 +3428,13 @@ vchiq_set_service_option(unsigned int handle,
>  		if ((service->srvstate == VCHIQ_SRVSTATE_HIDDEN) ||
>  		    (service->srvstate == VCHIQ_SRVSTATE_LISTENING)) {
>  			service->sync = value;
> -			status = VCHIQ_SUCCESS;
> +			ret = 0;
>  		}
>  		break;
>  
> 
>  	case VCHIQ_SERVICE_OPTION_TRACE:
>  		service->trace = value;
> -		status = VCHIQ_SUCCESS;
> +		ret = 0;
>  		break;
>  
> 
>  	default:
> @@ -3442,7 +3442,7 @@ vchiq_set_service_option(unsigned int handle,
>  	}
>  	unlock_service(service);
>  
> 
> -	return status;
> +	return ret;
>  }
>  
> 
>  static int
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> index aad1c5c..bd1f590 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> @@ -712,7 +712,7 @@ extern int vchiq_get_client_id(unsigned int service);
>  
> 
>  extern void vchiq_get_config(struct vchiq_config *config);
>  
> 
> -extern enum vchiq_status
> +extern int
>  vchiq_set_service_option(unsigned int service, enum vchiq_service_option option,
>  			 int value);
>  
> 



  parent reply	other threads:[~2021-06-03  8:03 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 [this message]
2021-04-25 10:51 ` [PATCH V2 10/11] staging: vchiq_core: drop vchiq_status from vchiq_initialise Stefan Wahren
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=ccefdaedd79855086684f6188c42a6f3abaa6926.camel@kernel.org \
    --to=nsaenz@kernel.org \
    --cc=fabioaiuto83@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=stefan.wahren@i2se.com \
    /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.