Explorar el Código

qcacld-3.0: Pass valid arguments to hdd_wmm_is_acm_allowed

Currently pointer of the vdev object is sent to the callback
hdd_wmm_is_acm_allowed to get the adapter. But this can't
be used to get the adapter. Instead pass the vdev id to get the
adapter.

Change-Id: I3cb2f58d09a263c77a3696a36e863cc4137c7821
CRs-Fixed: 2341804
Bala Venkatesh hace 6 años
padre
commit
c725a06d80
Se han modificado 2 ficheros con 15 adiciones y 7 borrados
  1. 4 3
      core/hdd/inc/wlan_hdd_wmm.h
  2. 11 4
      core/hdd/src/wlan_hdd_wmm.c

+ 4 - 3
core/hdd/inc/wlan_hdd_wmm.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2012,2016-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2012,2016-2018 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -351,11 +351,12 @@ bool hdd_wmm_is_active(struct hdd_adapter *adapter);
  * hdd_wmm_is_acm_allowed() - Function which will determine if WMM is
  * active on the current connection
  *
- * @vdev: vdev object
+ * @vdev_id: vdev id
  *
  * Return: true if WMM is enabled, false if WMM is not enabled
  */
-bool hdd_wmm_is_acm_allowed(struct wlan_objmgr_vdev **vdev);
+bool hdd_wmm_is_acm_allowed(uint8_t vdev_id);
+
 
 /**
  * hdd_wmm_addts() - Function which will add a traffic spec at the

+ 11 - 4
core/hdd/src/wlan_hdd_wmm.c

@@ -2347,17 +2347,24 @@ bool hdd_wmm_is_active(struct hdd_adapter *adapter)
 	}
 }
 
-bool hdd_wmm_is_acm_allowed(struct wlan_objmgr_vdev **vdev)
+bool hdd_wmm_is_acm_allowed(uint8_t vdev_id)
 {
 	struct hdd_adapter *adapter;
 	struct hdd_wmm_ac_status *wmm_ac_status;
+	struct hdd_context *hdd_ctx;
 
+	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	if (!hdd_ctx) {
+		hdd_err("Unable to fetch the hdd context");
+		return false;
+	}
 
-	adapter = container_of(vdev, struct hdd_adapter, vdev);
-	if (NULL == adapter) {
-		hdd_err("failed, hdd adapter is NULL");
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (hdd_validate_adapter(adapter)) {
+		hdd_err("Invalid adapter");
 		return false;
 	}
+
 	wmm_ac_status = adapter->hdd_wmm_status.wmmAcStatus;
 
 	if (hdd_wmm_is_active(adapter) &&