]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
scsi: ufs: Tidy clocks list head usage
authorSzymon Mielczarek <szymonx.mielczarek@intel.com>
Mon, 5 Jun 2017 08:36:54 +0000 (11:36 +0300)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 13 Jun 2017 00:48:08 +0000 (20:48 -0400)
Move the initialization of clocks list head to ufshcd_alloc_host() so
that every driver doesn't have to do it. Remove checks for the list head
being NULL because that is not possible.

Signed-off-by: Szymon Mielczarek <szymonx.mielczarek@intel.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/tc-dwc-g210-pci.c
drivers/scsi/ufs/ufshcd-pci.c
drivers/scsi/ufs/ufshcd-pltfrm.c
drivers/scsi/ufs/ufshcd.c

index c09a0fef0fe60c0d2bf26e283235aea52317f15c..325d5e14fc0d874f68a1319708d7dd9209cb2b61 100644 (file)
@@ -130,8 +130,6 @@ tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                return err;
        }
 
-       INIT_LIST_HEAD(&hba->clk_list_head);
-
        hba->vops = &tc_dwc_g210_pci_hba_vops;
 
        err = ufshcd_init(hba, mmio_base, pdev->irq);
index 52b546fb509b7a3636b8a9b65ee7f6c03dc10171..5dd4122cbd8591dbef15e8eb7ae2bab2ef8627b9 100644 (file)
@@ -143,8 +143,6 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                return err;
        }
 
-       INIT_LIST_HEAD(&hba->clk_list_head);
-
        err = ufshcd_init(hba, mmio_base, pdev->irq);
        if (err) {
                dev_err(&pdev->dev, "Initialization failed\n");
index 8e5e6c04c035e1e134d84670ff19459597df35b1..e82bde0772963cbbde59a52712984f56921d39d9 100644 (file)
@@ -58,8 +58,6 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba)
        if (!np)
                goto out;
 
-       INIT_LIST_HEAD(&hba->clk_list_head);
-
        cnt = of_property_count_strings(np, "clock-names");
        if (!cnt || (cnt == -EINVAL)) {
                dev_info(dev, "%s: Unable to find clocks, assuming enabled\n",
index ffe8d86088181c7da9c30ad58986418842f7016d..88ccd63f83c1bd1b7ddb319a369217bb2c6ecaa6 100644 (file)
@@ -314,7 +314,7 @@ static void ufshcd_print_clk_freqs(struct ufs_hba *hba)
        struct ufs_clk_info *clki;
        struct list_head *head = &hba->clk_list_head;
 
-       if (!head || list_empty(head))
+       if (list_empty(head))
                return;
 
        list_for_each_entry(clki, head, list) {
@@ -869,7 +869,7 @@ static int ufshcd_scale_clks(struct ufs_hba *hba, bool scale_up)
        ktime_t start = ktime_get();
        bool clk_state_changed = false;
 
-       if (!head || list_empty(head))
+       if (list_empty(head))
                goto out;
 
        ret = ufshcd_vops_clk_scale_notify(hba, scale_up, PRE_CHANGE);
@@ -943,7 +943,7 @@ static bool ufshcd_is_devfreq_scaling_required(struct ufs_hba *hba,
        struct ufs_clk_info *clki;
        struct list_head *head = &hba->clk_list_head;
 
-       if (!head || list_empty(head))
+       if (list_empty(head))
                return false;
 
        list_for_each_entry(clki, head, list) {
@@ -6752,7 +6752,7 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on,
        ktime_t start = ktime_get();
        bool clk_state_changed = false;
 
-       if (!head || list_empty(head))
+       if (list_empty(head))
                goto out;
 
        ret = ufshcd_vops_setup_clocks(hba, on, PRE_CHANGE);
@@ -6818,7 +6818,7 @@ static int ufshcd_init_clocks(struct ufs_hba *hba)
        struct device *dev = hba->dev;
        struct list_head *head = &hba->clk_list_head;
 
-       if (!head || list_empty(head))
+       if (list_empty(head))
                goto out;
 
        list_for_each_entry(clki, head, list) {
@@ -7811,6 +7811,8 @@ int ufshcd_alloc_host(struct device *dev, struct ufs_hba **hba_handle)
        hba->dev = dev;
        *hba_handle = hba;
 
+       INIT_LIST_HEAD(&hba->clk_list_head);
+
 out_error:
        return err;
 }