[S390] qdio: Sanitize do_QDIO sanity checks
[cascardo/linux.git] / drivers / s390 / cio / qdio_main.c
index 127e78e..0038750 100644 (file)
@@ -455,13 +455,6 @@ static inline void inbound_primed(struct qdio_q *q, int count)
        count--;
        if (!count)
                return;
-
-       /*
-        * Need to change all PRIMED buffers to NOT_INIT, otherwise
-        * we're loosing initiative in the thinint code.
-        */
-       set_buf_states(q, q->first_to_check, SLSB_P_INPUT_NOT_INIT,
-                      count);
 }
 
 static int get_inbound_buffer_frontier(struct qdio_q *q)
@@ -476,19 +469,13 @@ static int get_inbound_buffer_frontier(struct qdio_q *q)
        count = min(atomic_read(&q->nr_buf_used), QDIO_MAX_BUFFERS_MASK);
        stop = add_buf(q->first_to_check, count);
 
-       /*
-        * No siga sync here, as a PCI or we after a thin interrupt
-        * will sync the queues.
-        */
-
-       /* need to set count to 1 for non-qebsm */
-       if (!is_qebsm(q))
-               count = 1;
-
-check_next:
        if (q->first_to_check == stop)
                goto out;
 
+       /*
+        * No siga sync here, as a PCI or we after a thin interrupt
+        * already sync'ed the queues.
+        */
        count = get_buf_states(q, q->first_to_check, &state, count, 1);
        if (!count)
                goto out;
@@ -496,14 +483,9 @@ check_next:
        switch (state) {
        case SLSB_P_INPUT_PRIMED:
                inbound_primed(q, count);
-               /*
-                * No siga-sync needed for non-qebsm here, as the inbound queue
-                * will be synced on the next siga-r, resp.
-                * qdio_inbound_q_done will do the siga-sync.
-                */
                q->first_to_check = add_buf(q->first_to_check, count);
                atomic_sub(count, &q->nr_buf_used);
-               goto check_next;
+               break;
        case SLSB_P_INPUT_ERROR:
                announce_buffer_error(q, count);
                /* process the buffer, the upper layer will take care of it */
@@ -641,11 +623,6 @@ static int get_outbound_buffer_frontier(struct qdio_q *q)
        count = min(atomic_read(&q->nr_buf_used), QDIO_MAX_BUFFERS_MASK);
        stop = add_buf(q->first_to_check, count);
 
-       /* need to set count to 1 for non-qebsm */
-       if (!is_qebsm(q))
-               count = 1;
-
-check_next:
        if (q->first_to_check == stop)
                return q->first_to_check;
 
@@ -660,13 +637,7 @@ check_next:
 
                atomic_sub(count, &q->nr_buf_used);
                q->first_to_check = add_buf(q->first_to_check, count);
-               /*
-                * We fetch all buffer states at once. get_buf_states may
-                * return count < stop. For QEBSM we do not loop.
-                */
-               if (is_qebsm(q))
-                       break;
-               goto check_next;
+               break;
        case SLSB_P_OUTPUT_ERROR:
                announce_buffer_error(q, count);
                /* process the buffer, the upper layer will take care of it */
@@ -1526,18 +1497,13 @@ out:
  * @count: how many buffers to process
  */
 int do_QDIO(struct ccw_device *cdev, unsigned int callflags,
-           int q_nr, int bufnr, int count)
+           int q_nr, unsigned int bufnr, unsigned int count)
 {
        struct qdio_irq *irq_ptr;
 
-       if ((bufnr > QDIO_MAX_BUFFERS_PER_Q) ||
-           (count > QDIO_MAX_BUFFERS_PER_Q) ||
-           (q_nr >= QDIO_MAX_QUEUES_PER_IRQ))
+       if (bufnr >= QDIO_MAX_BUFFERS_PER_Q || count > QDIO_MAX_BUFFERS_PER_Q)
                return -EINVAL;
 
-       if (!count)
-               return 0;
-
        irq_ptr = cdev->private->qdio_data;
        if (!irq_ptr)
                return -ENODEV;