Commit a2161d1d authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman
Browse files

staging: vchiq_core: drop vchiq_status from vchiq_set_service_option



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().

Reviewed-by: default avatarNicolas Saenz Julienne <nsaenz@kernel.org>
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/1619347863-16080-10-git-send-email-stefan.wahren@i2se.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a9fbd828
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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: {
+9 −9
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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);