[S390] sclp: clean up send/receive naming scheme
authorPeter Oberparleiter <peter.oberparleiter@de.ibm.com>
Tue, 19 Feb 2008 14:29:32 +0000 (15:29 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 19 Feb 2008 14:29:34 +0000 (15:29 +0100)
Make state change events adjust the correct mask by cleaning up
naming inconsistencies. Also remove chance for lockup by removing
unnecessary mask related check before reading events.

Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/char/sclp.c
drivers/s390/char/sclp.h
drivers/s390/char/sclp_config.c
drivers/s390/char/sclp_cpi_sys.c
drivers/s390/char/sclp_rw.c
drivers/s390/char/sclp_vt220.c

index 25629b92dec362ef2e22c4343ca383e0976e49c8..2c7a1ee6b0410fb1f5fc1eeda314ab837a4d6e29 100644 (file)
@@ -29,10 +29,10 @@ static ext_int_info_t ext_int_info_hwc;
 /* Lock to protect internal data consistency. */
 static DEFINE_SPINLOCK(sclp_lock);
 
-/* Mask of events that we can receive from the sclp interface. */
+/* Mask of events that we can send to the sclp interface. */
 static sccb_mask_t sclp_receive_mask;
 
-/* Mask of events that we can send to the sclp interface. */
+/* Mask of events that we can receive from the sclp interface. */
 static sccb_mask_t sclp_send_mask;
 
 /* List of registered event listeners and senders. */
@@ -380,7 +380,7 @@ sclp_interrupt_handler(__u16 code)
                }
                sclp_running_state = sclp_running_state_idle;
        }
-       if (evbuf_pending && sclp_receive_mask != 0 &&
+       if (evbuf_pending &&
            sclp_activation_state == sclp_activation_state_active)
                __sclp_queue_read_req();
        spin_unlock(&sclp_lock);
@@ -459,8 +459,8 @@ sclp_dispatch_state_change(void)
                reg = NULL;
                list_for_each(l, &sclp_reg_list) {
                        reg = list_entry(l, struct sclp_register, list);
-                       receive_mask = reg->receive_mask & sclp_receive_mask;
-                       send_mask = reg->send_mask & sclp_send_mask;
+                       receive_mask = reg->send_mask & sclp_receive_mask;
+                       send_mask = reg->receive_mask & sclp_send_mask;
                        if (reg->sclp_receive_mask != receive_mask ||
                            reg->sclp_send_mask != send_mask) {
                                reg->sclp_receive_mask = receive_mask;
@@ -615,8 +615,8 @@ struct init_sccb {
        u16 mask_length;
        sccb_mask_t receive_mask;
        sccb_mask_t send_mask;
-       sccb_mask_t sclp_send_mask;
        sccb_mask_t sclp_receive_mask;
+       sccb_mask_t sclp_send_mask;
 } __attribute__((packed));
 
 /* Prepare init mask request. Called while sclp_lock is locked. */
index aa8186d18aee8c957a074d845507b74ac985cf1e..bac80e856f97978d1c9354e7df7830fc2fa76691 100644 (file)
@@ -122,11 +122,13 @@ struct sclp_req {
 /* of some routines it wants to be called from the low level driver */
 struct sclp_register {
        struct list_head list;
-       /* event masks this user is registered for */
+       /* User wants to receive: */
        sccb_mask_t receive_mask;
+       /* User wants to send: */
        sccb_mask_t send_mask;
-       /* actually present events */
+       /* H/W can receive: */
        sccb_mask_t sclp_receive_mask;
+       /* H/W can send: */
        sccb_mask_t sclp_send_mask;
        /* called if event type availability changes */
        void (*state_change_fn)(struct sclp_register *);
index 9dc77f14fa52042978de137751e74168972b3a42..b8f35bc52b7b9d5cda1528ed1952b160a7dfa329 100644 (file)
@@ -64,7 +64,7 @@ static int __init sclp_conf_init(void)
                return rc;
        }
 
-       if (!(sclp_conf_register.sclp_receive_mask & EVTYP_CONFMGMDATA_MASK)) {
+       if (!(sclp_conf_register.sclp_send_mask & EVTYP_CONFMGMDATA_MASK)) {
                printk(KERN_WARNING TAG "no configuration management.\n");
                sclp_unregister(&sclp_conf_register);
                rc = -ENOSYS;
index 41617032afdced7e737a7f37060370ebb684bfe0..9f37456222e9bde478386ea921e7cba393c7fa2d 100644 (file)
@@ -129,7 +129,7 @@ static int cpi_req(void)
                        "to hardware console.\n");
                goto out;
        }
-       if (!(sclp_cpi_event.sclp_send_mask & EVTYP_CTLPROGIDENT_MASK)) {
+       if (!(sclp_cpi_event.sclp_receive_mask & EVTYP_CTLPROGIDENT_MASK)) {
                printk(KERN_WARNING "cpi: no control program "
                        "identification support\n");
                rc = -EOPNOTSUPP;
index ad7195d3de0cfaf5613df7b75b8c6cb3d0865d52..da09781b32f7b0959441c2d6a4a544319d284edf 100644 (file)
@@ -452,10 +452,10 @@ sclp_emit_buffer(struct sclp_buffer *buffer,
                return -EIO;
 
        sccb = buffer->sccb;
-       if (sclp_rw_event.sclp_send_mask & EVTYP_MSG_MASK)
+       if (sclp_rw_event.sclp_receive_mask & EVTYP_MSG_MASK)
                /* Use normal write message */
                sccb->msg_buf.header.type = EVTYP_MSG;
-       else if (sclp_rw_event.sclp_send_mask & EVTYP_PMSGCMD_MASK)
+       else if (sclp_rw_event.sclp_receive_mask & EVTYP_PMSGCMD_MASK)
                /* Use write priority message */
                sccb->msg_buf.header.type = EVTYP_PMSGCMD;
        else
index f47f4a768be5cf53019d259edaf544daa6230a1c..92f527201792971095eea15a1503c0938d1eaeb0 100644 (file)
@@ -202,7 +202,7 @@ sclp_vt220_callback(struct sclp_req *request, void *data)
 static int
 __sclp_vt220_emit(struct sclp_vt220_request *request)
 {
-       if (!(sclp_vt220_register.sclp_send_mask & EVTYP_VT220MSG_MASK)) {
+       if (!(sclp_vt220_register.sclp_receive_mask & EVTYP_VT220MSG_MASK)) {
                request->sclp_req.status = SCLP_REQ_FAILED;
                return -EIO;
        }