diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/ipmi/ipmi_bt_sm.c | 8 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_kcs_sm.c | 4 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 50 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_smic_sm.c | 2 |
4 files changed, 39 insertions, 25 deletions
diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c index a22a7a502740..f5e4cd7617f6 100644 --- a/drivers/char/ipmi/ipmi_bt_sm.c +++ b/drivers/char/ipmi/ipmi_bt_sm.c | |||
@@ -201,7 +201,7 @@ static unsigned int bt_init_data(struct si_sm_data *bt, struct si_sm_io *io) | |||
201 | } | 201 | } |
202 | bt->state = BT_STATE_IDLE; /* start here */ | 202 | bt->state = BT_STATE_IDLE; /* start here */ |
203 | bt->complete = BT_STATE_IDLE; /* end here */ | 203 | bt->complete = BT_STATE_IDLE; /* end here */ |
204 | bt->BT_CAP_req2rsp = BT_NORMAL_TIMEOUT * 1000000; | 204 | bt->BT_CAP_req2rsp = BT_NORMAL_TIMEOUT * USEC_PER_SEC; |
205 | bt->BT_CAP_retries = BT_NORMAL_RETRY_LIMIT; | 205 | bt->BT_CAP_retries = BT_NORMAL_RETRY_LIMIT; |
206 | /* BT_CAP_outreqs == zero is a flag to read BT Capabilities */ | 206 | /* BT_CAP_outreqs == zero is a flag to read BT Capabilities */ |
207 | return 3; /* We claim 3 bytes of space; ought to check SPMI table */ | 207 | return 3; /* We claim 3 bytes of space; ought to check SPMI table */ |
@@ -613,7 +613,7 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) | |||
613 | HOST2BMC(42); /* Sequence number */ | 613 | HOST2BMC(42); /* Sequence number */ |
614 | HOST2BMC(3); /* Cmd == Soft reset */ | 614 | HOST2BMC(3); /* Cmd == Soft reset */ |
615 | BT_CONTROL(BT_H2B_ATN); | 615 | BT_CONTROL(BT_H2B_ATN); |
616 | bt->timeout = BT_RESET_DELAY * 1000000; | 616 | bt->timeout = BT_RESET_DELAY * USEC_PER_SEC; |
617 | BT_STATE_CHANGE(BT_STATE_RESET3, | 617 | BT_STATE_CHANGE(BT_STATE_RESET3, |
618 | SI_SM_CALL_WITH_DELAY); | 618 | SI_SM_CALL_WITH_DELAY); |
619 | 619 | ||
@@ -651,14 +651,14 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) | |||
651 | bt_init_data(bt, bt->io); | 651 | bt_init_data(bt, bt->io); |
652 | if ((i == 8) && !BT_CAP[2]) { | 652 | if ((i == 8) && !BT_CAP[2]) { |
653 | bt->BT_CAP_outreqs = BT_CAP[3]; | 653 | bt->BT_CAP_outreqs = BT_CAP[3]; |
654 | bt->BT_CAP_req2rsp = BT_CAP[6] * 1000000; | 654 | bt->BT_CAP_req2rsp = BT_CAP[6] * USEC_PER_SEC; |
655 | bt->BT_CAP_retries = BT_CAP[7]; | 655 | bt->BT_CAP_retries = BT_CAP[7]; |
656 | } else | 656 | } else |
657 | printk(KERN_WARNING "IPMI BT: using default values\n"); | 657 | printk(KERN_WARNING "IPMI BT: using default values\n"); |
658 | if (!bt->BT_CAP_outreqs) | 658 | if (!bt->BT_CAP_outreqs) |
659 | bt->BT_CAP_outreqs = 1; | 659 | bt->BT_CAP_outreqs = 1; |
660 | printk(KERN_WARNING "IPMI BT: req2rsp=%ld secs retries=%d\n", | 660 | printk(KERN_WARNING "IPMI BT: req2rsp=%ld secs retries=%d\n", |
661 | bt->BT_CAP_req2rsp / 1000000L, bt->BT_CAP_retries); | 661 | bt->BT_CAP_req2rsp / USEC_PER_SEC, bt->BT_CAP_retries); |
662 | bt->timeout = bt->BT_CAP_req2rsp; | 662 | bt->timeout = bt->BT_CAP_req2rsp; |
663 | return SI_SM_CALL_WITHOUT_DELAY; | 663 | return SI_SM_CALL_WITHOUT_DELAY; |
664 | 664 | ||
diff --git a/drivers/char/ipmi/ipmi_kcs_sm.c b/drivers/char/ipmi/ipmi_kcs_sm.c index e53fc24c6af3..6a4bdc18955a 100644 --- a/drivers/char/ipmi/ipmi_kcs_sm.c +++ b/drivers/char/ipmi/ipmi_kcs_sm.c | |||
@@ -118,8 +118,8 @@ enum kcs_states { | |||
118 | #define MAX_KCS_WRITE_SIZE IPMI_MAX_MSG_LENGTH | 118 | #define MAX_KCS_WRITE_SIZE IPMI_MAX_MSG_LENGTH |
119 | 119 | ||
120 | /* Timeouts in microseconds. */ | 120 | /* Timeouts in microseconds. */ |
121 | #define IBF_RETRY_TIMEOUT 5000000 | 121 | #define IBF_RETRY_TIMEOUT (5*USEC_PER_SEC) |
122 | #define OBF_RETRY_TIMEOUT 5000000 | 122 | #define OBF_RETRY_TIMEOUT (5*USEC_PER_SEC) |
123 | #define MAX_ERROR_RETRIES 10 | 123 | #define MAX_ERROR_RETRIES 10 |
124 | #define ERROR0_OBF_WAIT_JIFFIES (2*HZ) | 124 | #define ERROR0_OBF_WAIT_JIFFIES (2*HZ) |
125 | 125 | ||
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 15e4a6031934..671c3852d359 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -1358,7 +1358,7 @@ static int std_irq_setup(struct smi_info *info) | |||
1358 | if (info->si_type == SI_BT) { | 1358 | if (info->si_type == SI_BT) { |
1359 | rv = request_irq(info->irq, | 1359 | rv = request_irq(info->irq, |
1360 | si_bt_irq_handler, | 1360 | si_bt_irq_handler, |
1361 | IRQF_SHARED | IRQF_DISABLED, | 1361 | IRQF_SHARED, |
1362 | DEVICE_NAME, | 1362 | DEVICE_NAME, |
1363 | info); | 1363 | info); |
1364 | if (!rv) | 1364 | if (!rv) |
@@ -1368,7 +1368,7 @@ static int std_irq_setup(struct smi_info *info) | |||
1368 | } else | 1368 | } else |
1369 | rv = request_irq(info->irq, | 1369 | rv = request_irq(info->irq, |
1370 | si_irq_handler, | 1370 | si_irq_handler, |
1371 | IRQF_SHARED | IRQF_DISABLED, | 1371 | IRQF_SHARED, |
1372 | DEVICE_NAME, | 1372 | DEVICE_NAME, |
1373 | info); | 1373 | info); |
1374 | if (rv) { | 1374 | if (rv) { |
@@ -1849,11 +1849,15 @@ static int hotmod_handler(const char *val, struct kernel_param *kp) | |||
1849 | info->irq_setup = std_irq_setup; | 1849 | info->irq_setup = std_irq_setup; |
1850 | info->slave_addr = ipmb; | 1850 | info->slave_addr = ipmb; |
1851 | 1851 | ||
1852 | if (!add_smi(info)) { | 1852 | rv = add_smi(info); |
1853 | if (try_smi_init(info)) | 1853 | if (rv) { |
1854 | cleanup_one_si(info); | ||
1855 | } else { | ||
1856 | kfree(info); | 1854 | kfree(info); |
1855 | goto out; | ||
1856 | } | ||
1857 | rv = try_smi_init(info); | ||
1858 | if (rv) { | ||
1859 | cleanup_one_si(info); | ||
1860 | goto out; | ||
1857 | } | 1861 | } |
1858 | } else { | 1862 | } else { |
1859 | /* remove */ | 1863 | /* remove */ |
@@ -2067,6 +2071,7 @@ struct SPMITable { | |||
2067 | static int try_init_spmi(struct SPMITable *spmi) | 2071 | static int try_init_spmi(struct SPMITable *spmi) |
2068 | { | 2072 | { |
2069 | struct smi_info *info; | 2073 | struct smi_info *info; |
2074 | int rv; | ||
2070 | 2075 | ||
2071 | if (spmi->IPMIlegacy != 1) { | 2076 | if (spmi->IPMIlegacy != 1) { |
2072 | printk(KERN_INFO PFX "Bad SPMI legacy %d\n", spmi->IPMIlegacy); | 2077 | printk(KERN_INFO PFX "Bad SPMI legacy %d\n", spmi->IPMIlegacy); |
@@ -2141,10 +2146,11 @@ static int try_init_spmi(struct SPMITable *spmi) | |||
2141 | info->io.addr_data, info->io.regsize, info->io.regspacing, | 2146 | info->io.addr_data, info->io.regsize, info->io.regspacing, |
2142 | info->irq); | 2147 | info->irq); |
2143 | 2148 | ||
2144 | if (add_smi(info)) | 2149 | rv = add_smi(info); |
2150 | if (rv) | ||
2145 | kfree(info); | 2151 | kfree(info); |
2146 | 2152 | ||
2147 | return 0; | 2153 | return rv; |
2148 | } | 2154 | } |
2149 | 2155 | ||
2150 | static void spmi_find_bmc(void) | 2156 | static void spmi_find_bmc(void) |
@@ -2178,6 +2184,7 @@ static int ipmi_pnp_probe(struct pnp_dev *dev, | |||
2178 | acpi_handle handle; | 2184 | acpi_handle handle; |
2179 | acpi_status status; | 2185 | acpi_status status; |
2180 | unsigned long long tmp; | 2186 | unsigned long long tmp; |
2187 | int rv; | ||
2181 | 2188 | ||
2182 | acpi_dev = pnp_acpi_device(dev); | 2189 | acpi_dev = pnp_acpi_device(dev); |
2183 | if (!acpi_dev) | 2190 | if (!acpi_dev) |
@@ -2259,10 +2266,11 @@ static int ipmi_pnp_probe(struct pnp_dev *dev, | |||
2259 | res, info->io.regsize, info->io.regspacing, | 2266 | res, info->io.regsize, info->io.regspacing, |
2260 | info->irq); | 2267 | info->irq); |
2261 | 2268 | ||
2262 | if (add_smi(info)) | 2269 | rv = add_smi(info); |
2263 | goto err_free; | 2270 | if (rv) |
2271 | kfree(info); | ||
2264 | 2272 | ||
2265 | return 0; | 2273 | return rv; |
2266 | 2274 | ||
2267 | err_free: | 2275 | err_free: |
2268 | kfree(info); | 2276 | kfree(info); |
@@ -2566,16 +2574,20 @@ static int ipmi_pci_probe(struct pci_dev *pdev, | |||
2566 | &pdev->resource[0], info->io.regsize, info->io.regspacing, | 2574 | &pdev->resource[0], info->io.regsize, info->io.regspacing, |
2567 | info->irq); | 2575 | info->irq); |
2568 | 2576 | ||
2569 | if (add_smi(info)) | 2577 | rv = add_smi(info); |
2578 | if (rv) { | ||
2570 | kfree(info); | 2579 | kfree(info); |
2580 | pci_disable_device(pdev); | ||
2581 | } | ||
2571 | 2582 | ||
2572 | return 0; | 2583 | return rv; |
2573 | } | 2584 | } |
2574 | 2585 | ||
2575 | static void ipmi_pci_remove(struct pci_dev *pdev) | 2586 | static void ipmi_pci_remove(struct pci_dev *pdev) |
2576 | { | 2587 | { |
2577 | struct smi_info *info = pci_get_drvdata(pdev); | 2588 | struct smi_info *info = pci_get_drvdata(pdev); |
2578 | cleanup_one_si(info); | 2589 | cleanup_one_si(info); |
2590 | pci_disable_device(pdev); | ||
2579 | } | 2591 | } |
2580 | 2592 | ||
2581 | static struct pci_device_id ipmi_pci_devices[] = { | 2593 | static struct pci_device_id ipmi_pci_devices[] = { |
@@ -2670,9 +2682,10 @@ static int ipmi_probe(struct platform_device *dev) | |||
2670 | 2682 | ||
2671 | dev_set_drvdata(&dev->dev, info); | 2683 | dev_set_drvdata(&dev->dev, info); |
2672 | 2684 | ||
2673 | if (add_smi(info)) { | 2685 | ret = add_smi(info); |
2686 | if (ret) { | ||
2674 | kfree(info); | 2687 | kfree(info); |
2675 | return -EBUSY; | 2688 | return ret; |
2676 | } | 2689 | } |
2677 | #endif | 2690 | #endif |
2678 | return 0; | 2691 | return 0; |
@@ -2736,9 +2749,10 @@ static int ipmi_parisc_probe(struct parisc_device *dev) | |||
2736 | 2749 | ||
2737 | dev_set_drvdata(&dev->dev, info); | 2750 | dev_set_drvdata(&dev->dev, info); |
2738 | 2751 | ||
2739 | if (add_smi(info)) { | 2752 | rv = add_smi(info); |
2753 | if (rv) { | ||
2740 | kfree(info); | 2754 | kfree(info); |
2741 | return -EBUSY; | 2755 | return rv; |
2742 | } | 2756 | } |
2743 | 2757 | ||
2744 | return 0; | 2758 | return 0; |
@@ -2773,7 +2787,7 @@ static int wait_for_msg_done(struct smi_info *smi_info) | |||
2773 | smi_result == SI_SM_CALL_WITH_TICK_DELAY) { | 2787 | smi_result == SI_SM_CALL_WITH_TICK_DELAY) { |
2774 | schedule_timeout_uninterruptible(1); | 2788 | schedule_timeout_uninterruptible(1); |
2775 | smi_result = smi_info->handlers->event( | 2789 | smi_result = smi_info->handlers->event( |
2776 | smi_info->si_sm, 100); | 2790 | smi_info->si_sm, jiffies_to_usecs(1)); |
2777 | } else if (smi_result == SI_SM_CALL_WITHOUT_DELAY) { | 2791 | } else if (smi_result == SI_SM_CALL_WITHOUT_DELAY) { |
2778 | smi_result = smi_info->handlers->event( | 2792 | smi_result = smi_info->handlers->event( |
2779 | smi_info->si_sm, 0); | 2793 | smi_info->si_sm, 0); |
diff --git a/drivers/char/ipmi/ipmi_smic_sm.c b/drivers/char/ipmi/ipmi_smic_sm.c index faed92971907..c8e77afa8b96 100644 --- a/drivers/char/ipmi/ipmi_smic_sm.c +++ b/drivers/char/ipmi/ipmi_smic_sm.c | |||
@@ -80,7 +80,7 @@ enum smic_states { | |||
80 | #define SMIC_MAX_ERROR_RETRIES 3 | 80 | #define SMIC_MAX_ERROR_RETRIES 3 |
81 | 81 | ||
82 | /* Timeouts in microseconds. */ | 82 | /* Timeouts in microseconds. */ |
83 | #define SMIC_RETRY_TIMEOUT 2000000 | 83 | #define SMIC_RETRY_TIMEOUT (2*USEC_PER_SEC) |
84 | 84 | ||
85 | /* SMIC Flags Register Bits */ | 85 | /* SMIC Flags Register Bits */ |
86 | #define SMIC_RX_DATA_READY 0x80 | 86 | #define SMIC_RX_DATA_READY 0x80 |