mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-15 01:01:56 -04:00
qcacmn: Unify hif_bus_get_context_size
Since the open logic needs to allocate the bus context before initializing the bus ops table, we need a single function that is aware of the bus context size for all busses. Change-Id: I681e91ed1a792da7e753b477f869ee415ea8f3c7 CRs-Fixed: 986480
This commit is contained in:
parent
795299c42c
commit
162164c8cd
8 changed files with 66 additions and 22 deletions
|
|
@ -31,6 +31,7 @@
|
|||
#include "hif.h"
|
||||
#include "hif_main.h"
|
||||
#include "multibus.h"
|
||||
#include "ce_main.h"
|
||||
|
||||
/**
|
||||
* hif_intialize_default_ops() - intializes default operations values
|
||||
|
|
@ -74,6 +75,23 @@ static QDF_STATUS hif_verify_basic_ops(struct hif_softc *hif_sc)
|
|||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* hif_bus_get_context_size - API to return size of the bus specific structure
|
||||
*
|
||||
* Return: sizeof of hif_pci_softc
|
||||
*/
|
||||
int hif_bus_get_context_size(enum qdf_bus_type bus_type)
|
||||
{
|
||||
switch (bus_type) {
|
||||
case QDF_BUS_TYPE_PCI:
|
||||
return hif_pci_get_context_size();
|
||||
case QDF_BUS_TYPE_SNOC:
|
||||
return hif_snoc_get_context_size();
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* hif_bus_open() - initialize the bus_ops and call the bus specific open
|
||||
* hif_sc: hif_context
|
||||
|
|
|
|||
|
|
@ -57,22 +57,42 @@ struct hif_bus_ops {
|
|||
|
||||
#ifdef HIF_SNOC
|
||||
QDF_STATUS hif_initialize_snoc_ops(struct hif_bus_ops *hif_sc);
|
||||
int hif_snoc_get_context_size(void);
|
||||
#else
|
||||
static inline QDF_STATUS hif_initialize_snoc_ops(struct hif_bus_ops *hif_sc)
|
||||
{
|
||||
HIF_ERROR("%s: not supported", __func__);
|
||||
return QDF_STATUS_E_NOSUPPORT;
|
||||
}
|
||||
/**
|
||||
* hif_snoc_get_context_size() - dummy when snoc isn't supported
|
||||
*
|
||||
* Return: 0 as an invalid size to indicate no support
|
||||
*/
|
||||
static inline int hif_snoc_get_context_size(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* HIF_SNOC */
|
||||
|
||||
#ifdef HIF_PCI
|
||||
QDF_STATUS hif_initialize_pci_ops(struct hif_softc *hif_sc);
|
||||
int hif_pci_get_context_size(void);
|
||||
#else
|
||||
static inline QDF_STATUS hif_initialize_pci_ops(struct hif_softc *hif_sc)
|
||||
{
|
||||
HIF_ERROR("%s: not supported", __func__);
|
||||
return QDF_STATUS_E_NOSUPPORT;
|
||||
}
|
||||
/**
|
||||
* hif_pci_get_context_size() - dummy when pci isn't supported
|
||||
*
|
||||
* Return: 0 as an invalid size to indicate no support
|
||||
*/
|
||||
static inline int hif_pci_get_context_size(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* HIF_PCI */
|
||||
|
||||
#endif /* _MULTIBUS_H_ */
|
||||
|
|
|
|||
|
|
@ -69,3 +69,13 @@ QDF_STATUS hif_initialize_pci_ops(struct hif_softc *hif_sc)
|
|||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* hif_pci_get_context_size() - return the size of the pci context
|
||||
*
|
||||
* Return the size of the context. (0 for invalid bus)
|
||||
*/
|
||||
int hif_pci_get_context_size(void)
|
||||
{
|
||||
return sizeof(struct hif_pci_softc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "hif.h"
|
||||
#include "hif_main.h"
|
||||
#include "multibus.h"
|
||||
#include "ce_main.h"
|
||||
#include "snoc_api.h"
|
||||
#include "dummy.h"
|
||||
|
||||
|
|
@ -58,3 +59,13 @@ QDF_STATUS hif_initialize_snoc_ops(struct hif_bus_ops *bus_ops)
|
|||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* hif_snoc_get_context_size() - return the size of the snoc context
|
||||
*
|
||||
* Return the size of the context. (0 for invalid bus)
|
||||
*/
|
||||
int hif_snoc_get_context_size(void)
|
||||
{
|
||||
return sizeof(struct HIF_CE_state);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -411,7 +411,12 @@ struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx, uint32_t mode,
|
|||
{
|
||||
struct hif_softc *scn;
|
||||
QDF_STATUS status = QDF_STATUS_SUCCESS;
|
||||
int bus_context_size = hif_bus_get_context_size();
|
||||
int bus_context_size = hif_bus_get_context_size(bus_type);
|
||||
|
||||
if (bus_context_size == 0) {
|
||||
HIF_ERROR("%s: context size 0 not allowed", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
scn = (struct hif_softc *)qdf_mem_malloc(bus_context_size);
|
||||
if (!scn) {
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ QDF_STATUS hif_enable_bus(struct hif_softc *ol_sc, struct device *dev,
|
|||
void *bdev, const hif_bus_id *bid, enum hif_enable_type type);
|
||||
void hif_disable_bus(struct hif_softc *scn);
|
||||
void hif_bus_prevent_linkdown(struct hif_softc *scn, bool flag);
|
||||
int hif_bus_get_context_size(void);
|
||||
int hif_bus_get_context_size(enum qdf_bus_type bus_type);
|
||||
void hif_read_phy_mem_base(struct hif_softc *scn, qdf_dma_addr_t *bar_value);
|
||||
uint32_t hif_get_conparam(struct hif_softc *scn);
|
||||
struct hif_callbacks *hif_get_callbacks_handle(struct hif_softc *scn);
|
||||
|
|
|
|||
|
|
@ -1264,16 +1264,6 @@ void hif_disable_power_management(struct hif_opaque_softc *hif_ctx)
|
|||
}
|
||||
|
||||
#define ATH_PCI_PROBE_RETRY_MAX 3
|
||||
/**
|
||||
* hif_bus_get_context_size - API to return size of the bus specific structure
|
||||
*
|
||||
* Return: sizeof of hif_pci_softc
|
||||
*/
|
||||
int hif_bus_get_context_size(void)
|
||||
{
|
||||
return sizeof(struct hif_pci_softc);
|
||||
}
|
||||
|
||||
/**
|
||||
* hif_bus_open(): hif_bus_open
|
||||
* @scn: scn
|
||||
|
|
|
|||
|
|
@ -100,16 +100,6 @@ void hif_snoc_close(struct hif_softc *scn)
|
|||
hif_ce_close(scn);
|
||||
}
|
||||
|
||||
/**
|
||||
* hif_bus_get_context_size - API to get Bus Context Size
|
||||
*
|
||||
* Return: Sizeof HIF_CE_state
|
||||
*/
|
||||
int hif_bus_get_context_size(void)
|
||||
{
|
||||
return sizeof(struct HIF_CE_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* hif_bus_open(): hif_bus_open
|
||||
* @hif_ctx: hif context
|
||||
|
|
|
|||
Loading…
Reference in a new issue