summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/cnss/cnss.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/drivers/net/wireless/cnss/cnss.c b/drivers/net/wireless/cnss/cnss.c
index 715abf2c66dc..6c72d644fc38 100644
--- a/drivers/net/wireless/cnss/cnss.c
+++ b/drivers/net/wireless/cnss/cnss.c
@@ -546,7 +546,8 @@ void cnss_wlan_unregister_driver(struct cnss_wlan_driver *driver)
return;
}
- msm_bus_scale_client_update_request(penv->bus_client, 0);
+ if (penv->bus_client)
+ msm_bus_scale_client_update_request(penv->bus_client, 0);
if (!pdev) {
pr_err("%d: invalid pdev\n", __LINE__);
@@ -969,22 +970,25 @@ static int cnss_probe(struct platform_device *pdev)
if (ret)
goto err_pci_reg;
+ penv->bus_scale_table = 0;
penv->bus_scale_table = msm_bus_cl_get_pdata(pdev);
- if (!penv->bus_scale_table)
- goto err_bus_scale;
- penv->bus_client = msm_bus_scale_register_client
- (penv->bus_scale_table);
- if (!penv->bus_client)
- goto err_bus_reg;
+ if (penv->bus_scale_table) {
+ penv->bus_client =
+ msm_bus_scale_register_client(penv->bus_scale_table);
+
+ if (!penv->bus_client) {
+ pr_err("Failed to register with bus_scale client\n");
+ goto err_bus_reg;
+ }
+ }
pr_info("cnss: Platform driver probed successfully.\n");
return ret;
err_bus_reg:
- msm_bus_cl_clear_pdata(penv->bus_scale_table);
-
-err_bus_scale:
+ if (penv->bus_scale_table)
+ msm_bus_cl_clear_pdata(penv->bus_scale_table);
pci_unregister_driver(&cnss_wlan_pci_driver);
err_pci_reg:
@@ -1010,6 +1014,12 @@ static int cnss_remove(struct platform_device *pdev)
struct cnss_wlan_vreg_info *vreg_info = &penv->vreg_info;
struct cnss_wlan_gpio_info *gpio_info = &penv->gpio_info;
+ if (penv->bus_client)
+ msm_bus_scale_unregister_client(penv->bus_client);
+
+ if (penv->bus_scale_table)
+ msm_bus_cl_clear_pdata(penv->bus_scale_table);
+
cnss_wlan_gpio_set(gpio_info, WLAN_EN_LOW);
if (cnss_wlan_vreg_set(vreg_info, VREG_OFF))
pr_err("Failed to turn OFF wlan vreg\n");
@@ -1065,16 +1075,19 @@ int cnss_request_bus_bandwidth(int bandwidth)
{
int ret = 0;
- if (!penv || !penv->bus_client)
+ if (!penv)
return -ENODEV;
+ if (!penv->bus_client)
+ return -ENOSYS;
+
switch (bandwidth) {
case CNSS_BUS_WIDTH_NONE:
case CNSS_BUS_WIDTH_LOW:
case CNSS_BUS_WIDTH_MEDIUM:
case CNSS_BUS_WIDTH_HIGH:
ret = msm_bus_scale_client_update_request(penv->bus_client,
- bandwidth);
+ bandwidth);
if (ret)
pr_err("%s: could not set bus bandwidth %d, ret = %d\n",
__func__, bandwidth, ret);