mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 20:46:48 +02:00
drm/xe/oa: Allow stream enable/disable functions to return error
Stream enable/disable functions previously had void return because failure during function execution was not possible. This will change when we introduce functionality to disable preemption on the stream exec queue. Therefore, in preparation for this functionality, prepare this code to be able to handle error returns. Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240626181817.1516229-2-ashutosh.dixit@intel.com Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
8d789ff4a4
commit
1bab7ecf5c
|
|
@ -1013,24 +1013,26 @@ static void xe_oa_stream_disable(struct xe_oa_stream *stream)
|
|||
hrtimer_cancel(&stream->poll_check_timer);
|
||||
}
|
||||
|
||||
static void xe_oa_enable_locked(struct xe_oa_stream *stream)
|
||||
static int xe_oa_enable_locked(struct xe_oa_stream *stream)
|
||||
{
|
||||
if (stream->enabled)
|
||||
return;
|
||||
|
||||
stream->enabled = true;
|
||||
return 0;
|
||||
|
||||
xe_oa_stream_enable(stream);
|
||||
|
||||
stream->enabled = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void xe_oa_disable_locked(struct xe_oa_stream *stream)
|
||||
static int xe_oa_disable_locked(struct xe_oa_stream *stream)
|
||||
{
|
||||
if (!stream->enabled)
|
||||
return;
|
||||
|
||||
stream->enabled = false;
|
||||
return 0;
|
||||
|
||||
xe_oa_stream_disable(stream);
|
||||
|
||||
stream->enabled = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long xe_oa_config_locked(struct xe_oa_stream *stream, u64 arg)
|
||||
|
|
@ -1105,11 +1107,9 @@ static long xe_oa_ioctl_locked(struct xe_oa_stream *stream,
|
|||
{
|
||||
switch (cmd) {
|
||||
case DRM_XE_PERF_IOCTL_ENABLE:
|
||||
xe_oa_enable_locked(stream);
|
||||
return 0;
|
||||
return xe_oa_enable_locked(stream);
|
||||
case DRM_XE_PERF_IOCTL_DISABLE:
|
||||
xe_oa_disable_locked(stream);
|
||||
return 0;
|
||||
return xe_oa_disable_locked(stream);
|
||||
case DRM_XE_PERF_IOCTL_CONFIG:
|
||||
return xe_oa_config_locked(stream, arg);
|
||||
case DRM_XE_PERF_IOCTL_STATUS:
|
||||
|
|
@ -1432,19 +1432,25 @@ static int xe_oa_stream_open_ioctl_locked(struct xe_oa *oa,
|
|||
if (ret)
|
||||
goto err_free;
|
||||
|
||||
if (!param->disabled) {
|
||||
ret = xe_oa_enable_locked(stream);
|
||||
if (ret)
|
||||
goto err_destroy;
|
||||
}
|
||||
|
||||
stream_fd = anon_inode_getfd("[xe_oa]", &xe_oa_fops, stream, 0);
|
||||
if (stream_fd < 0) {
|
||||
ret = stream_fd;
|
||||
goto err_destroy;
|
||||
goto err_disable;
|
||||
}
|
||||
|
||||
if (!param->disabled)
|
||||
xe_oa_enable_locked(stream);
|
||||
|
||||
/* Hold a reference on the drm device till stream_fd is released */
|
||||
drm_dev_get(&stream->oa->xe->drm);
|
||||
|
||||
return stream_fd;
|
||||
err_disable:
|
||||
if (!param->disabled)
|
||||
xe_oa_disable_locked(stream);
|
||||
err_destroy:
|
||||
xe_oa_stream_destroy(stream);
|
||||
err_free:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user