RISCV: config: tizen_visionfive2: Disable JH7110 crypto driver
[platform/kernel/linux-starfive.git] / fs / pipe.c
index 1391901..a234035 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -437,12 +437,10 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
                goto out;
        }
 
-#ifdef CONFIG_WATCH_QUEUE
-       if (pipe->watch_queue) {
+       if (pipe_has_watch_queue(pipe)) {
                ret = -EXDEV;
                goto out;
        }
-#endif
 
        /*
         * If it wasn't empty we try to merge new data into
@@ -1307,6 +1305,11 @@ int pipe_resize_ring(struct pipe_inode_info *pipe, unsigned int nr_slots)
        pipe->tail = tail;
        pipe->head = head;
 
+       if (!pipe_has_watch_queue(pipe)) {
+               pipe->max_usage = nr_slots;
+               pipe->nr_accounted = nr_slots;
+       }
+
        spin_unlock_irq(&pipe->rd_wait.lock);
 
        /* This might have made more room for writers */
@@ -1324,10 +1327,8 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned int arg)
        unsigned int nr_slots, size;
        long ret = 0;
 
-#ifdef CONFIG_WATCH_QUEUE
-       if (pipe->watch_queue)
+       if (pipe_has_watch_queue(pipe))
                return -EBUSY;
-#endif
 
        size = round_pipe_size(arg);
        nr_slots = size >> PAGE_SHIFT;
@@ -1360,8 +1361,6 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned int arg)
        if (ret < 0)
                goto out_revert_acct;
 
-       pipe->max_usage = nr_slots;
-       pipe->nr_accounted = nr_slots;
        return pipe->max_usage * PAGE_SIZE;
 
 out_revert_acct:
@@ -1379,10 +1378,8 @@ struct pipe_inode_info *get_pipe_info(struct file *file, bool for_splice)
 
        if (file->f_op != &pipefifo_fops || !pipe)
                return NULL;
-#ifdef CONFIG_WATCH_QUEUE
-       if (for_splice && pipe->watch_queue)
+       if (for_splice && pipe_has_watch_queue(pipe))
                return NULL;
-#endif
        return pipe;
 }