Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[sfrench/cifs-2.6.git] / drivers / scsi / be2iscsi / be_main.c
index f8123ad5aef9549ffb7e5dc0bc4ab3f1674859a5..be96aa1e507722da1665f967027b0fb5a16e48e4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 Broadcom. All Rights Reserved.
+ * Copyright 2017 Broadcom. All Rights Reserved.
  * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries.
  *
  * This program is free software; you can redistribute it and/or
@@ -818,15 +818,14 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
 
        if (pcidev->msix_enabled) {
                for (i = 0; i < phba->num_cpus; i++) {
-                       phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME,
-                                                   GFP_KERNEL);
+                       phba->msi_name[i] = kasprintf(GFP_KERNEL,
+                                                     "beiscsi_%02x_%02x",
+                                                     phba->shost->host_no, i);
                        if (!phba->msi_name[i]) {
                                ret = -ENOMEM;
                                goto free_msix_irqs;
                        }
 
-                       sprintf(phba->msi_name[i], "beiscsi_%02x_%02x",
-                               phba->shost->host_no, i);
                        ret = request_irq(pci_irq_vector(pcidev, i),
                                          be_isr_msix, 0, phba->msi_name[i],
                                          &phwi_context->be_eq[i]);
@@ -839,13 +838,12 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
                                goto free_msix_irqs;
                        }
                }
-               phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME, GFP_KERNEL);
+               phba->msi_name[i] = kasprintf(GFP_KERNEL, "beiscsi_mcc_%02x",
+                                             phba->shost->host_no);
                if (!phba->msi_name[i]) {
                        ret = -ENOMEM;
                        goto free_msix_irqs;
                }
-               sprintf(phba->msi_name[i], "beiscsi_mcc_%02x",
-                       phba->shost->host_no);
                ret = request_irq(pci_irq_vector(pcidev, i), be_isr_mcc, 0,
                                  phba->msi_name[i], &phwi_context->be_eq[i]);
                if (ret) {
@@ -5249,12 +5247,11 @@ static void beiscsi_eqd_update_work(struct work_struct *work)
                              msecs_to_jiffies(BEISCSI_EQD_UPDATE_INTERVAL));
 }
 
-static void beiscsi_hw_tpe_check(unsigned long ptr)
+static void beiscsi_hw_tpe_check(struct timer_list *t)
 {
-       struct beiscsi_hba *phba;
+       struct beiscsi_hba *phba = from_timer(phba, t, hw_check);
        u32 wait;
 
-       phba = (struct beiscsi_hba *)ptr;
        /* if not TPE, do nothing */
        if (!beiscsi_detect_tpe(phba))
                return;
@@ -5267,11 +5264,10 @@ static void beiscsi_hw_tpe_check(unsigned long ptr)
                           msecs_to_jiffies(wait));
 }
 
-static void beiscsi_hw_health_check(unsigned long ptr)
+static void beiscsi_hw_health_check(struct timer_list *t)
 {
-       struct beiscsi_hba *phba;
+       struct beiscsi_hba *phba = from_timer(phba, t, hw_check);
 
-       phba = (struct beiscsi_hba *)ptr;
        beiscsi_detect_ue(phba);
        if (beiscsi_detect_ue(phba)) {
                __beiscsi_log(phba, KERN_ERR,
@@ -5283,7 +5279,7 @@ static void beiscsi_hw_health_check(unsigned long ptr)
                if (!test_bit(BEISCSI_HBA_UER_SUPP, &phba->state))
                        return;
                /* modify this timer to check TPE */
-               phba->hw_check.function = beiscsi_hw_tpe_check;
+               phba->hw_check.function = (TIMER_FUNC_TYPE)beiscsi_hw_tpe_check;
        }
 
        mod_timer(&phba->hw_check,
@@ -5371,7 +5367,7 @@ static int beiscsi_enable_port(struct beiscsi_hba *phba)
         * Timer function gets modified for TPE detection.
         * Always reinit to do health check first.
         */
-       phba->hw_check.function = beiscsi_hw_health_check;
+       phba->hw_check.function = (TIMER_FUNC_TYPE)beiscsi_hw_health_check;
        mod_timer(&phba->hw_check,
                  jiffies + msecs_to_jiffies(BEISCSI_UE_DETECT_INTERVAL));
        return 0;
@@ -5721,9 +5717,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
         * Start UE detection here. UE before this will cause stall in probe
         * and eventually fail the probe.
         */
-       init_timer(&phba->hw_check);
-       phba->hw_check.function = beiscsi_hw_health_check;
-       phba->hw_check.data = (unsigned long)phba;
+       timer_setup(&phba->hw_check, beiscsi_hw_health_check, 0);
        mod_timer(&phba->hw_check,
                  jiffies + msecs_to_jiffies(BEISCSI_UE_DETECT_INTERVAL));
        beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,