for (i = 0; i < CLU_SIZE; ++i)
vsp1_dl_body_write(dlb, VI6_CLU_DATA, ctrl->p_new.p_u32[i]);
- spin_lock_irq(&clu->lock);
- swap(clu->clu, dlb);
- spin_unlock_irq(&clu->lock);
+ scoped_guard(spinlock_irq, &clu->lock) {
+ swap(clu->clu, dlb);
+ }
vsp1_dl_body_put(dlb);
return 0;
{
struct vsp1_clu *clu = to_clu(&entity->subdev);
struct vsp1_dl_body *clu_dlb;
- unsigned long flags;
u32 ctrl = VI6_CLU_CTRL_AAI | VI6_CLU_CTRL_MVS | VI6_CLU_CTRL_EN;
/* 2D mode can only be used with the YCbCr pixel encoding. */
vsp1_clu_write(clu, dlb, VI6_CLU_CTRL, ctrl);
- spin_lock_irqsave(&clu->lock, flags);
- clu_dlb = clu->clu;
- clu->clu = NULL;
- spin_unlock_irqrestore(&clu->lock, flags);
+ scoped_guard(spinlock_irqsave, &clu->lock) {
+ clu_dlb = clu->clu;
+ clu->clu = NULL;
+ }
if (clu_dlb) {
vsp1_dl_list_add_body(dl, clu_dlb);
void vsp1_dlm_reset(struct vsp1_dl_manager *dlm)
{
- unsigned long flags;
size_t list_count;
- spin_lock_irqsave(&dlm->lock, flags);
-
- __vsp1_dl_list_put(dlm->active);
- __vsp1_dl_list_put(dlm->queued);
- __vsp1_dl_list_put(dlm->pending);
+ scoped_guard(spinlock_irqsave, &dlm->lock) {
+ __vsp1_dl_list_put(dlm->active);
+ __vsp1_dl_list_put(dlm->queued);
+ __vsp1_dl_list_put(dlm->pending);
- list_count = list_count_nodes(&dlm->free);
- spin_unlock_irqrestore(&dlm->lock, flags);
+ list_count = list_count_nodes(&dlm->free);
+ }
WARN_ON_ONCE(list_count != dlm->list_count);
struct vsp1_device *vsp1 = dev_get_drvdata(dev);
struct vsp1_drm_pipeline *drm_pipe;
struct vsp1_pipeline *pipe;
- unsigned long flags;
int ret;
if (pipe_index >= vsp1->info->lif_count)
}
/* Start the pipeline. */
- spin_lock_irqsave(&pipe->irqlock, flags);
- vsp1_pipeline_run(pipe);
- spin_unlock_irqrestore(&pipe->irqlock, flags);
+ scoped_guard(spinlock_irqsave, &pipe->irqlock) {
+ vsp1_pipeline_run(pipe);
+ }
dev_dbg(vsp1->dev, "%s: pipeline enabled\n", __func__);
vsp1_dl_body_write(dlb, VI6_LUT_TABLE + 4 * i,
ctrl->p_new.p_u32[i]);
- spin_lock_irq(&lut->lock);
- swap(lut->lut, dlb);
- spin_unlock_irq(&lut->lock);
+ scoped_guard(spinlock_irq, &lut->lock) {
+ swap(lut->lut, dlb);
+ }
vsp1_dl_body_put(dlb);
return 0;
{
struct vsp1_lut *lut = to_lut(&entity->subdev);
struct vsp1_dl_body *lut_dlb;
- unsigned long flags;
- spin_lock_irqsave(&lut->lock, flags);
- lut_dlb = lut->lut;
- lut->lut = NULL;
- spin_unlock_irqrestore(&lut->lock, flags);
+ scoped_guard(spinlock_irqsave, &lut->lock) {
+ lut_dlb = lut->lut;
+ lut->lut = NULL;
+ }
if (lut_dlb) {
vsp1_dl_list_add_body(dl, lut_dlb);
{
struct vsp1_device *vsp1 = pipe->output->entity.vsp1;
struct vsp1_entity *entity;
- unsigned long flags;
int ret;
if (pipe->lif) {
*/
ret = vsp1_reset_wpf(vsp1, pipe->output->entity.index);
if (ret == 0) {
- spin_lock_irqsave(&pipe->irqlock, flags);
- pipe->state = VSP1_PIPELINE_STOPPED;
- spin_unlock_irqrestore(&pipe->irqlock, flags);
+ scoped_guard(spinlock_irqsave, &pipe->irqlock) {
+ pipe->state = VSP1_PIPELINE_STOPPED;
+ }
}
} else {
/* Otherwise just request a stop and wait. */
- spin_lock_irqsave(&pipe->irqlock, flags);
- if (pipe->state == VSP1_PIPELINE_RUNNING)
- pipe->state = VSP1_PIPELINE_STOPPING;
- spin_unlock_irqrestore(&pipe->irqlock, flags);
+ scoped_guard(spinlock_irqsave, &pipe->irqlock) {
+ if (pipe->state == VSP1_PIPELINE_RUNNING)
+ pipe->state = VSP1_PIPELINE_STOPPING;
+ }
ret = wait_event_timeout(pipe->wq, vsp1_pipeline_stopped(pipe),
msecs_to_jiffies(500));
struct vsp1_pipeline *pipe = video->rwpf->entity.pipe;
struct vsp1_vb2_buffer *next = NULL;
struct vsp1_vb2_buffer *done;
- unsigned long flags;
unsigned int i;
- spin_lock_irqsave(&video->irqlock, flags);
-
- if (list_empty(&video->irqqueue)) {
- spin_unlock_irqrestore(&video->irqlock, flags);
- return NULL;
- }
-
- done = list_first_entry(&video->irqqueue,
- struct vsp1_vb2_buffer, queue);
-
- list_del(&done->queue);
+ scoped_guard(spinlock_irqsave, &video->irqlock) {
+ if (list_empty(&video->irqqueue))
+ return NULL;
- if (!list_empty(&video->irqqueue))
- next = list_first_entry(&video->irqqueue,
+ done = list_first_entry(&video->irqqueue,
struct vsp1_vb2_buffer, queue);
- spin_unlock_irqrestore(&video->irqlock, flags);
+ list_del(&done->queue);
+
+ if (!list_empty(&video->irqqueue))
+ next = list_first_entry(&video->irqqueue,
+ struct vsp1_vb2_buffer, queue);
+ }
done->buf.sequence = pipe->sequence;
done->buf.vb2_buf.timestamp = ktime_get_ns();
struct vsp1_video *video = vb2_get_drv_priv(vb->vb2_queue);
struct vsp1_pipeline *pipe = video->rwpf->entity.pipe;
struct vsp1_vb2_buffer *buf = to_vsp1_vb2_buffer(vbuf);
- unsigned long flags;
bool empty;
- spin_lock_irqsave(&video->irqlock, flags);
- empty = list_empty(&video->irqqueue);
- list_add_tail(&buf->queue, &video->irqqueue);
- spin_unlock_irqrestore(&video->irqlock, flags);
+ scoped_guard(spinlock_irqsave, &video->irqlock) {
+ empty = list_empty(&video->irqqueue);
+ list_add_tail(&buf->queue, &video->irqqueue);
+ }
if (!empty)
return;
{
struct vsp1_video *video = vb2_get_drv_priv(vq);
struct vsp1_pipeline *pipe = video->rwpf->entity.pipe;
- unsigned long flags;
int ret;
/*
* Clear the buffers ready flag to make sure the device won't be started
* by a QBUF on the video node on the other side of the pipeline.
*/
- spin_lock_irqsave(&video->irqlock, flags);
- pipe->buffers_ready &= ~(1 << video->pipe_index);
- spin_unlock_irqrestore(&video->irqlock, flags);
+ scoped_guard(spinlock_irqsave, &video->irqlock) {
+ pipe->buffers_ready &= ~(1 << video->pipe_index);
+ }
scoped_guard(mutex, &pipe->lock) {
if (--pipe->stream_count == pipe->num_inputs) {
void vsp1_video_suspend(struct vsp1_device *vsp1)
{
- unsigned long flags;
unsigned int i;
int ret;
if (pipe == NULL)
continue;
- spin_lock_irqsave(&pipe->irqlock, flags);
- if (pipe->state == VSP1_PIPELINE_RUNNING)
- pipe->state = VSP1_PIPELINE_STOPPING;
- spin_unlock_irqrestore(&pipe->irqlock, flags);
+ scoped_guard(spinlock_irqsave, &pipe->irqlock) {
+ if (pipe->state == VSP1_PIPELINE_RUNNING)
+ pipe->state = VSP1_PIPELINE_STOPPING;
+ }
}
for (i = 0; i < vsp1->info->wpf_count; ++i) {
void vsp1_video_resume(struct vsp1_device *vsp1)
{
- unsigned long flags;
unsigned int i;
/* Resume all running pipelines. */
*/
pipe->configured = false;
- spin_lock_irqsave(&pipe->irqlock, flags);
- if (vsp1_pipeline_ready(pipe))
- vsp1_video_pipeline_run(pipe);
- spin_unlock_irqrestore(&pipe->irqlock, flags);
+ scoped_guard(spinlock_irqsave, &pipe->irqlock) {
+ if (vsp1_pipeline_ready(pipe))
+ vsp1_video_pipeline_run(pipe);
+ }
}
}
const unsigned int mask = BIT(WPF_CTRL_VFLIP)
| BIT(WPF_CTRL_HFLIP);
struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev);
- unsigned long flags;
u32 outfmt;
- spin_lock_irqsave(&wpf->flip.lock, flags);
- wpf->flip.active = (wpf->flip.active & ~mask)
- | (wpf->flip.pending & mask);
- spin_unlock_irqrestore(&wpf->flip.lock, flags);
+ scoped_guard(spinlock_irqsave, &wpf->flip.lock) {
+ wpf->flip.active = (wpf->flip.active & ~mask)
+ | (wpf->flip.pending & mask);
+ }
outfmt = (wpf->alpha << VI6_WPF_OUTFMT_PDV_SHIFT) | wpf->outfmt;