ipmi: Some minor fixes
Just some collected fixes for 3.14. Nothing huge.
PATCH 1/4 ipmi: remove deprecated IRQF_DISABLED
From: Michael Opdenacker <[email protected]>
This patch proposes to remove the use of the IRQF_DISABLED flag
It's a NOOP since 2.6.35 and it will be removed one day.
--- drivers/char/ipmi/ipmi_si_intf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_si_intf.c +2 -2
@@ -1358,7 +1358,7 @@ static int std_irq_setup(struct smi_info *info)if (info->si_type ==SI_BT ) { rv =request_irq (info->irq, si_bt_irq_handler, -IRQF_SHARED |IRQF_DISABLED , +IRQF_SHARED ,DEVICE_NAME , info);if (!rv)
@@ -1368,7 +1368,7 @@ static int std_irq_setup(struct smi_info *info) }else rv =request_irq (info->irq, si_irq_handler, -IRQF_SHARED |IRQF_DISABLED , +IRQF_SHARED ,DEVICE_NAME , info);if (rv) {
Signature · 1 line
1.8.3.1
PATCH 2/4 ipmi: use USEC_PER_SEC instead of 1000000 for more meaningful
In reply to [email protected]From: Xie XiuQi <[email protected]>
Use USEC_PER_SEC instead of 1000000, that making the later bugfix more clearly.
--- drivers/char/ipmi/ipmi_bt_sm.c | 8 ++++---- drivers/char/ipmi/ipmi_kcs_sm.c | 4 ++-- drivers/char/ipmi/ipmi_smic_sm.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/char/ipmi/ipmi_bt_sm.c +4 -4
@@ -201,7 +201,7 @@ static unsigned int bt_init_data(struct si_sm_data *bt, struct si_sm_io *io) } bt->state =BT_STATE_IDLE ;/* start here */ bt->complete =BT_STATE_IDLE ;/* end here */ - bt->BT_CAP_req2rsp =BT_NORMAL_TIMEOUT *1000000 ; + bt->BT_CAP_req2rsp =BT_NORMAL_TIMEOUT *USEC_PER_SEC ; bt->BT_CAP_retries =BT_NORMAL_RETRY_LIMIT ;/* BT_CAP_outreqs == zero is a flag to read BT Capabilities */ 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)HOST2BMC (42 );/* Sequence number */ HOST2BMC (3 );/* Cmd == Soft reset */ BT_CONTROL (BT_H2B_ATN ); - bt->timeout =BT_RESET_DELAY *1000000 ; + bt->timeout =BT_RESET_DELAY *USEC_PER_SEC ;BT_STATE_CHANGE (BT_STATE_RESET3 ,SI_SM_CALL_WITH_DELAY );
@@ -651,14 +651,14 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time)bt_init_data (bt, bt->io);if ((i ==8 ) && !BT_CAP [2 ]) { bt->BT_CAP_outreqs =BT_CAP [3 ]; - bt->BT_CAP_req2rsp =BT_CAP [6 ] *1000000 ; + bt->BT_CAP_req2rsp =BT_CAP [6 ] *USEC_PER_SEC ; bt->BT_CAP_retries =BT_CAP [7 ]; }else printk (KERN_WARNING "IPMI BT: using default values\n" );if (!bt->BT_CAP_outreqs) bt->BT_CAP_outreqs =1 ;printk (KERN_WARNING "IPMI BT: req2rsp=%ld secs retries=%d\n" , - bt->BT_CAP_req2rsp /1000000L , bt->BT_CAP_retries); + bt->BT_CAP_req2rsp /USEC_PER_SEC , bt->BT_CAP_retries); bt->timeout = bt->BT_CAP_req2rsp;return SI_SM_CALL_WITHOUT_DELAY ;
drivers/char/ipmi/ipmi_kcs_sm.c +2 -2
@@ -118,8 +118,8 @@ enum kcs_states {#define MAX_KCS_WRITE_SIZE IPMI_MAX_MSG_LENGTH/* Timeouts in microseconds. */ -#define IBF_RETRY_TIMEOUT 5000000 -#define OBF_RETRY_TIMEOUT 5000000 +#define IBF_RETRY_TIMEOUT (5*USEC_PER_SEC) +#define OBF_RETRY_TIMEOUT (5*USEC_PER_SEC)#define MAX_ERROR_RETRIES 10#define ERROR0_OBF_WAIT_JIFFIES (2*HZ)
drivers/char/ipmi/ipmi_smic_sm.c +1 -1
@@ -80,7 +80,7 @@ enum smic_states {#define SMIC_MAX_ERROR_RETRIES 3/* Timeouts in microseconds. */ -#define SMIC_RETRY_TIMEOUT 2000000 +#define SMIC_RETRY_TIMEOUT (2*USEC_PER_SEC)/* SMIC Flags Register Bits */ #define SMIC_RX_DATA_READY 0x80
Signature · 1 line
1.8.3.1
PATCH 3/4 ipmi: fix timeout calculation when bmc is disconnected
In reply to [email protected]From: Xie XiuQi <[email protected]>
Loading ipmi_si module while bmc is disconnected, we found the timeout is longer than 5 secs. Actually it takes about 3 mins and 20 secs.(HZ=250)
error message as below:
Dec 12 19:08:59 linux kernel: IPMI BT: timeout in RD_WAIT [ ] 1 retries left Dec 12 19:08:59 linux kernel: BT: write 4 bytes seq=0x01 03 18 00 01 [...] Dec 12 19:12:19 linux kernel: IPMI BT: timeout in RD_WAIT [ ] Dec 12 19:12:19 linux kernel: failed 2 retries, sending error response Dec 12 19:12:19 linux kernel: IPMI: BT reset (takes 5 secs) Dec 12 19:12:19 linux kernel: IPMI BT: flag reset [ ]
Function wait_for_msg_done() use schedule_timeout_uninterruptible(1) to sleep 1 tick, so we should subtract jiffies_to_usecs(1) instead of 100 usecs from timeout.
--- drivers/char/ipmi/ipmi_si_intf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/ipmi/ipmi_si_intf.c +1 -1
@@ -2773,7 +2773,7 @@ static int wait_for_msg_done(struct smi_info *smi_info) smi_result == SI_SM_CALL_WITH_TICK_DELAY) {schedule_timeout_uninterruptible (1 ); smi_result = smi_info->handlers->event ( - smi_info->si_sm,100 ); + smi_info->si_sm,jiffies_to_usecs (1 )); } else if (smi_result == SI_SM_CALL_WITHOUT_DELAY) { smi_result = smi_info->handlers->event ( smi_info->si_sm,0 );
Signature · 1 line
1.8.3.1
PATCH 4/4 ipmi: Cleanup error return
In reply to [email protected]From: Corey Minyard <[email protected]>
Return proper errors for a lot of IPMI failure cases. Also call pci_disable_device when IPMI PCI devices are removed.
--- drivers/char/ipmi/ipmi_si_intf.c | 44 ++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-)
drivers/char/ipmi/ipmi_si_intf.c +29 -15
@@ -1849,11 +1849,15 @@ static int hotmod_handler(const char *val, struct kernel_param *kp) info->irq_setup = std_irq_setup; info->slave_addr = ipmb; -if (!add_smi (info)) { -if (try_smi_init (info)) -cleanup_one_si (info); - }else { + rv =add_smi (info); +if (rv) {kfree (info); + goto out; + } + rv =try_smi_init (info); +if (rv) { +cleanup_one_si (info); + goto out; } }else {/* remove */
@@ -2067,6 +2071,7 @@ struct SPMITable {static int try_init_spmi (struct SPMITable *spmi) {struct smi_info *info; +int rv;if (spmi->IPMIlegacy !=1 ) { printk(KERN_INFO PFX "Bad SPMI legacy %d\n", spmi->IPMIlegacy);
@@ -2141,10 +2146,11 @@ static int try_init_spmi(struct SPMITable *spmi) info->io.addr_data, info->io.regsize, info->io.regspacing, info->irq); -if (add_smi (info)) + rv =add_smi (info); +if (rv)kfree (info); -return 0 ; +return rv; }static void spmi_find_bmc (void )
@@ -2178,6 +2184,7 @@ static int ipmi_pnp_probe(struct pnp_dev *dev,acpi_handle handle;acpi_status status;unsigned long long tmp; +int rv; acpi_dev =pnp_acpi_device (dev);if (!acpi_dev)
@@ -2259,10 +2266,11 @@ static int ipmi_pnp_probe(struct pnp_dev *dev, res, info->io.regsize, info->io.regspacing, info->irq); -if (add_smi (info)) - goto err_free; + rv =add_smi (info); +if (rv) +kfree (info); -return 0 ; +return rv; err_free:kfree (info);
@@ -2566,16 +2574,20 @@ static int ipmi_pci_probe(struct pci_dev *pdev, &pdev->resource[0 ], info->io.regsize, info->io.regspacing, info->irq); -if (add_smi (info)) + rv =add_smi (info); +if (rv) {kfree (info); +pci_disable_device (pdev); + } -return 0 ; +return rv; }static void ipmi_pci_remove (struct pci_dev *pdev) {struct smi_info *info =pci_get_drvdata (pdev);cleanup_one_si (info); +pci_disable_device (pdev); }static struct pci_device_id ipmi_pci_devices[] = {
@@ -2670,9 +2682,10 @@ static int ipmi_probe(struct platform_device *dev)dev_set_drvdata (&dev->dev, info); -if (add_smi (info)) { + ret =add_smi (info); +if (ret) {kfree (info); -return -EBUSY ; +return ret; }#endif return 0 ;
@@ -2736,9 +2749,10 @@ static int ipmi_parisc_probe(struct parisc_device *dev)dev_set_drvdata (&dev->dev, info); -if (add_smi (info)) { + rv =add_smi (info); +if (rv) {kfree (info); -return -EBUSY ; +return rv; }return 0 ;
Signature · 1 line
1.8.3.1