]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/char/ipmi/ipmi_si_intf.c
IPMI: add 0.9 support
[karo-tx-linux.git] / drivers / char / ipmi / ipmi_si_intf.c
index e018932af795c73b024ca95860c2b8319b0773d0..4f560d0bb8089fa296dadeaee3a21bfb7a91b052 100644 (file)
@@ -675,7 +675,8 @@ static void handle_transaction_done(struct smi_info *smi_info)
 }
 
 /* Called on timeouts and events.  Timeouts should pass the elapsed
-   time, interrupts should pass in zero. */
+   time, interrupts should pass in zero.  Must be called with
+   si_lock held and interrupts disabled. */
 static enum si_sm_result smi_event_handler(struct smi_info *smi_info,
                                           int time)
 {
@@ -892,13 +893,16 @@ static int ipmi_thread(void *data)
 static void poll(void *send_info)
 {
        struct smi_info *smi_info = send_info;
+       unsigned long flags;
 
        /*
         * Make sure there is some delay in the poll loop so we can
         * drive time forward and timeout things.
         */
        udelay(10);
+       spin_lock_irqsave(&smi_info->si_lock, flags);
        smi_event_handler(smi_info, 10);
+       spin_unlock_irqrestore(&smi_info->si_lock, flags);
 }
 
 static void request_events(void *send_info)
@@ -2376,20 +2380,9 @@ static int try_get_dev_id(struct smi_info *smi_info)
        /* Otherwise, we got some data. */
        resp_len = smi_info->handlers->get_result(smi_info->si_sm,
                                                  resp, IPMI_MAX_MSG_LENGTH);
-       if (resp_len < 14) {
-               /* That's odd, it should be longer. */
-               rv = -EINVAL;
-               goto out;
-       }
-
-       if ((resp[1] != IPMI_GET_DEVICE_ID_CMD) || (resp[2] != 0)) {
-               /* That's odd, it shouldn't be able to fail. */
-               rv = -EINVAL;
-               goto out;
-       }
 
-       /* Record info from the get device id, in case we need it. */
-       ipmi_demangle_device_id(resp+3, resp_len-3, &smi_info->device_id);
+       /* Check and record info from the get device id, in case we need it. */
+       rv = ipmi_demangle_device_id(resp, resp_len, &smi_info->device_id);
 
  out:
        kfree(resp);