Merge "usb: pd: Fix memory leak in usbpd_create()"
diff --git a/arch/arm64/boot/dts/qcom/kona-ion.dtsi b/arch/arm64/boot/dts/qcom/kona-ion.dtsi
index f3be668..2becfa4 100644
--- a/arch/arm64/boot/dts/qcom/kona-ion.dtsi
+++ b/arch/arm64/boot/dts/qcom/kona-ion.dtsi
@@ -14,6 +14,12 @@
qcom,ion-heap-type = "SYSTEM";
};
+ adsp_heap: qcom,ion-heap@22 {
+ reg = <22>;
+ memory-region = <&adsp_mem>;
+ qcom,ion-heap-type = "DMA";
+ };
+
system_secure_heap: qcom,ion-heap@9 {
reg = <9>;
qcom,ion-heap-type = "SYSTEM_SECURE";
diff --git a/arch/arm64/boot/dts/qcom/kona.dtsi b/arch/arm64/boot/dts/qcom/kona.dtsi
index a832f84..bf23646 100644
--- a/arch/arm64/boot/dts/qcom/kona.dtsi
+++ b/arch/arm64/boot/dts/qcom/kona.dtsi
@@ -364,6 +364,14 @@
reg = <0x0 0x8ac00000 0x0 0x100000>;
};
+ adsp_mem: adsp_region {
+ compatible = "shared-dma-pool";
+ alloc-ranges = <0x0 0x00000000 0x0 0xffffffff>;
+ reusable;
+ alignment = <0x0 0x400000>;
+ size = <0x0 0x1000000>;
+ };
+
/* global autoconfigured region for contiguous allocations */
linux,cma {
compatible = "shared-dma-pool";
@@ -1134,6 +1142,12 @@
0x4400 2>;
};
+ qcom,msm_fastrpc_rpmsg {
+ compatible = "qcom,msm-fastrpc-rpmsg";
+ qcom,glink-channels = "fastrpcglink-apps-dsp";
+ qcom,intents = <0x64 64>;
+ };
+
qcom,adsp_glink_ssr {
qcom,glink-channels = "glink_ssr";
qcom,notify-edges = <&glink_slpi>,
@@ -1162,6 +1176,12 @@
0x4400 2>;
};
+ qcom,msm_fastrpc_rpmsg {
+ compatible = "qcom,msm-fastrpc-rpmsg";
+ qcom,glink-channels = "fastrpcglink-apps-dsp";
+ qcom,intents = <0x64 64>;
+ };
+
qcom,slpi_glink_ssr {
qcom,glink-channels = "glink_ssr";
qcom,notify-edges = <&glink_adsp>,
@@ -1190,6 +1210,12 @@
0x4400 2>;
};
+ qcom,msm_fastrpc_rpmsg {
+ compatible = "qcom,msm-fastrpc-rpmsg";
+ qcom,glink-channels = "fastrpcglink-apps-dsp";
+ qcom,intents = <0x64 64>;
+ };
+
qcom,cdsp_glink_ssr {
qcom,glink-channels = "glink_ssr";
qcom,notify-edges = <&glink_adsp>,
@@ -1320,6 +1346,124 @@
compatible = "qcom,cdsp-loader";
qcom,proc-img-to-load = "cdsp";
};
+
+ qcom,msm-adsprpc-mem {
+ compatible = "qcom,msm-adsprpc-mem-region";
+ memory-region = <&adsp_mem>;
+ };
+
+ msm_fastrpc: qcom,msm_fastrpc {
+ compatible = "qcom,msm-fastrpc-compute";
+ qcom,fastrpc-adsp-audio-pdr;
+ qcom,rpc-latency-us = <235>;
+
+ qcom,msm_fastrpc_compute_cb1 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "cdsprpc-smd";
+ iommus = <&apps_smmu 0x1001 0x0460>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb2 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "cdsprpc-smd";
+ iommus = <&apps_smmu 0x1002 0x0460>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb3 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "cdsprpc-smd";
+ iommus = <&apps_smmu 0x1003 0x0460>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb4 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "cdsprpc-smd";
+ iommus = <&apps_smmu 0x1004 0x0460>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb5 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "cdsprpc-smd";
+ iommus = <&apps_smmu 0x1005 0x0460>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb6 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "cdsprpc-smd";
+ iommus = <&apps_smmu 0x1006 0x0460>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb7 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "cdsprpc-smd";
+ iommus = <&apps_smmu 0x1007 0x0460>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb8 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "cdsprpc-smd";
+ iommus = <&apps_smmu 0x1008 0x0460>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb9 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "cdsprpc-smd";
+ qcom,secure-context-bank;
+ iommus = <&apps_smmu 0x1009 0x0460>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb10 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "adsprpc-smd";
+ iommus = <&apps_smmu 0x1803 0x0>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb11 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "adsprpc-smd";
+ iommus = <&apps_smmu 0x1804 0x0>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb12 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "adsprpc-smd";
+ iommus = <&apps_smmu 0x1805 0x0>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb13 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "sdsprpc-smd";
+ iommus = <&apps_smmu 0x0541 0x0>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb14 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "sdsprpc-smd";
+ iommus = <&apps_smmu 0x0542 0x0>;
+ dma-coherent;
+ };
+
+ qcom,msm_fastrpc_compute_cb15 {
+ compatible = "qcom,msm-fastrpc-compute-cb";
+ label = "sdsprpc-smd";
+ iommus = <&apps_smmu 0x0543 0x0>;
+ shared-cb = <4>;
+ dma-coherent;
+ };
+ };
};
#include "kona-bus.dtsi"
diff --git a/arch/arm64/configs/vendor/kona-perf_defconfig b/arch/arm64/configs/vendor/kona-perf_defconfig
index d6c0985..d42bdaa 100644
--- a/arch/arm64/configs/vendor/kona-perf_defconfig
+++ b/arch/arm64/configs/vendor/kona-perf_defconfig
@@ -214,6 +214,10 @@
CONFIG_FW_LOADER_USER_HELPER=y
CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
CONFIG_DMA_CMA=y
+CONFIG_MHI_BUS=y
+CONFIG_MHI_QCOM=y
+CONFIG_MHI_NETDEV=y
+CONFIG_MHI_UCI=y
CONFIG_ZRAM=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_RAM=y
diff --git a/arch/arm64/configs/vendor/kona_defconfig b/arch/arm64/configs/vendor/kona_defconfig
index b6eeb9d..0f45eb51 100644
--- a/arch/arm64/configs/vendor/kona_defconfig
+++ b/arch/arm64/configs/vendor/kona_defconfig
@@ -221,6 +221,11 @@
CONFIG_FW_LOADER_USER_HELPER=y
CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
CONFIG_DMA_CMA=y
+CONFIG_MHI_BUS=y
+CONFIG_MHI_DEBUG=y
+CONFIG_MHI_QCOM=y
+CONFIG_MHI_NETDEV=y
+CONFIG_MHI_UCI=y
CONFIG_ZRAM=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_RAM=y
diff --git a/drivers/bus/mhi/controllers/mhi_arch_qcom.c b/drivers/bus/mhi/controllers/mhi_arch_qcom.c
index b3d8ede..d3bb69a 100644
--- a/drivers/bus/mhi/controllers/mhi_arch_qcom.c
+++ b/drivers/bus/mhi/controllers/mhi_arch_qcom.c
@@ -354,7 +354,7 @@ static struct dma_iommu_mapping *mhi_arch_create_iommu_mapping(
MHI_LOG("Create iommu mapping of base:%pad size:%zu\n",
&base, size);
- return arm_iommu_create_mapping(&pci_bus_type, base, size);
+ return __depr_arm_iommu_create_mapping(&pci_bus_type, base, size);
}
static int mhi_arch_dma_mask(struct mhi_controller *mhi_cntrl)
@@ -438,8 +438,8 @@ int mhi_arch_iommu_init(struct mhi_controller *mhi_cntrl)
}
if (smmu_config) {
- ret = arm_iommu_attach_device(&mhi_dev->pci_dev->dev, mapping);
-
+ ret = __depr_arm_iommu_attach_device(&mhi_dev->pci_dev->dev,
+ mapping);
if (ret) {
MHI_ERR("Error attach device, ret:%d\n", ret);
goto release_mapping;
@@ -458,10 +458,10 @@ int mhi_arch_iommu_init(struct mhi_controller *mhi_cntrl)
return 0;
release_device:
- arm_iommu_detach_device(mhi_cntrl->dev);
+ __depr_arm_iommu_detach_device(mhi_cntrl->dev);
release_mapping:
- arm_iommu_release_mapping(mapping);
+ __depr_arm_iommu_release_mapping(mapping);
return ret;
}
@@ -473,8 +473,8 @@ void mhi_arch_iommu_deinit(struct mhi_controller *mhi_cntrl)
struct dma_iommu_mapping *mapping = arch_info->mapping;
if (mapping) {
- arm_iommu_detach_device(mhi_cntrl->dev);
- arm_iommu_release_mapping(mapping);
+ __depr_arm_iommu_detach_device(mhi_cntrl->dev);
+ __depr_arm_iommu_release_mapping(mapping);
}
arch_info->mapping = NULL;
mhi_cntrl->dev = NULL;
diff --git a/drivers/bus/mhi/core/mhi_init.c b/drivers/bus/mhi/core/mhi_init.c
index e22e6c6..08e38c0 100644
--- a/drivers/bus/mhi/core/mhi_init.c
+++ b/drivers/bus/mhi/core/mhi_init.c
@@ -773,6 +773,10 @@ static int of_parse_ev_cfg(struct mhi_controller *mhi_cntrl,
struct mhi_event *mhi_event;
struct device_node *child;
+ of_node = of_find_node_by_name(of_node, "mhi_events");
+ if (!of_node)
+ return -EINVAL;
+
for_each_available_child_of_node(of_node, child) {
if (!strcmp(child->name, "mhi_event"))
num++;
@@ -888,6 +892,10 @@ static int of_parse_ch_cfg(struct mhi_controller *mhi_cntrl,
if (ret)
return ret;
+ of_node = of_find_node_by_name(of_node, "mhi_channels");
+ if (!of_node)
+ return -EINVAL;
+
mhi_cntrl->mhi_chan = kcalloc(mhi_cntrl->max_chan,
sizeof(*mhi_cntrl->mhi_chan), GFP_KERNEL);
if (!mhi_cntrl->mhi_chan)
diff --git a/drivers/bus/mhi/core/mhi_main.c b/drivers/bus/mhi/core/mhi_main.c
index 4b009f2..af41b31 100644
--- a/drivers/bus/mhi/core/mhi_main.c
+++ b/drivers/bus/mhi/core/mhi_main.c
@@ -583,7 +583,10 @@ static void mhi_assign_of_node(struct mhi_controller *mhi_cntrl,
const char *dt_name;
int ret;
- controller = mhi_cntrl->of_node;
+ controller = of_find_node_by_name(mhi_cntrl->of_node, "mhi_devices");
+ if (!controller)
+ return;
+
for_each_available_child_of_node(controller, node) {
ret = of_property_read_string(node, "mhi,chan", &dt_name);
if (ret)
diff --git a/drivers/cpuidle/lpm-levels-of.c b/drivers/cpuidle/lpm-levels-of.c
index 97bf753..20f6250 100644
--- a/drivers/cpuidle/lpm-levels-of.c
+++ b/drivers/cpuidle/lpm-levels-of.c
@@ -21,7 +21,7 @@ enum lpm_type {
IDLE = 0,
SUSPEND,
LATENCY,
- LPM_TYPE_NR
+ LPM_TYPE_NR,
};
struct lpm_type_str {
@@ -38,6 +38,18 @@ static const struct lpm_type_str lpm_types[] = {
static struct lpm_level_avail *cpu_level_available[NR_CPUS];
static struct platform_device *lpm_pdev;
+static int lpm_of_read_u32(struct device_node *dn, const char *key,
+ u32 *val, bool is_err)
+{
+ int ret;
+
+ ret = of_property_read_u32(dn, key, val);
+ if (is_err && ret)
+ pr_err("%s:failed to read key:%s ret:%d\n", dn->name, key, ret);
+
+ return ret;
+}
+
static void *get_enabled_ptr(struct kobj_attribute *attr,
struct lpm_level_avail *avail)
{
@@ -143,15 +155,15 @@ static int create_lvl_avail_nodes(const char *name,
if (!kobj)
return -ENOMEM;
- attr_group = devm_kzalloc(&lpm_pdev->dev, sizeof(*attr_group),
- GFP_KERNEL);
+ attr_group = devm_kcalloc(&lpm_pdev->dev, 1, sizeof(*attr_group),
+ GFP_KERNEL);
if (!attr_group) {
ret = -ENOMEM;
goto failed;
}
- attr = devm_kzalloc(&lpm_pdev->dev,
- sizeof(*attr) * (LPM_TYPE_NR + 1), GFP_KERNEL);
+ attr = devm_kcalloc(&lpm_pdev->dev, LPM_TYPE_NR + 1, sizeof(*attr),
+ GFP_KERNEL);
if (!attr) {
ret = -ENOMEM;
goto failed;
@@ -182,10 +194,8 @@ static int create_lvl_avail_nodes(const char *name,
attr_group->attrs = attr;
ret = sysfs_create_group(kobj, attr_group);
- if (ret) {
- ret = -ENOMEM;
+ if (ret)
goto failed;
- }
avail->idle_enabled = true;
avail->suspend_enabled = true;
@@ -194,7 +204,7 @@ static int create_lvl_avail_nodes(const char *name,
avail->idx = index;
avail->cpu_node = cpu_node;
- return ret;
+ return 0;
failed:
kobject_put(kobj);
@@ -211,8 +221,8 @@ static int create_cpu_lvl_nodes(struct lpm_cluster *p, struct kobject *parent)
int ret = 0;
struct list_head *pos;
- cpu_kobj = devm_kzalloc(&lpm_pdev->dev, sizeof(*cpu_kobj) *
- cpumask_weight(&p->child_cpus), GFP_KERNEL);
+ cpu_kobj = devm_kcalloc(&lpm_pdev->dev, cpumask_weight(&p->child_cpus),
+ sizeof(*cpu_kobj), GFP_KERNEL);
if (!cpu_kobj)
return -ENOMEM;
@@ -229,9 +239,10 @@ static int create_cpu_lvl_nodes(struct lpm_cluster *p, struct kobject *parent)
goto release_kobj;
}
- level_list = devm_kzalloc(&lpm_pdev->dev,
- lpm_cpu->nlevels * sizeof(*level_list),
- GFP_KERNEL);
+ level_list = devm_kcalloc(&lpm_pdev->dev,
+ lpm_cpu->nlevels,
+ sizeof(*level_list),
+ GFP_KERNEL);
if (!level_list) {
ret = -ENOMEM;
goto release_kobj;
@@ -297,11 +308,8 @@ int create_cluster_lvl_nodes(struct lpm_cluster *p, struct kobject *kobj)
return ret;
}
- if (!list_empty(&p->cpu)) {
+ if (!list_empty(&p->cpu))
ret = create_cpu_lvl_nodes(p, cluster_kobj);
- if (ret)
- return ret;
- }
return ret;
}
@@ -333,148 +341,124 @@ bool lpm_cluster_mode_allow(struct lpm_cluster *cluster,
avail->suspend_enabled);
}
-static int parse_cluster_params(struct device_node *node,
- struct lpm_cluster *c)
+static int parse_cluster_params(struct device_node *dn, struct lpm_cluster *c)
{
- char *key;
int ret;
- key = "label";
- ret = of_property_read_string(node, key, &c->cluster_name);
- if (ret)
- goto fail;
+ ret = of_property_read_string(dn, "label", &c->cluster_name);
+ if (ret) {
+ pr_err("Failed to read label ret: %d\n", ret);
+ return ret;
+ }
- key = "qcom,psci-mode-shift";
- ret = of_property_read_u32(node, key, &c->psci_mode_shift);
+ ret = lpm_of_read_u32(dn, "qcom,psci-mode-shift",
+ &c->psci_mode_shift, true);
if (ret)
- goto fail;
+ return ret;
- key = "qcom,psci-mode-mask";
- ret = of_property_read_u32(node, key, &c->psci_mode_mask);
+ ret = lpm_of_read_u32(dn, "qcom,psci-mode-mask",
+ &c->psci_mode_mask, true);
if (ret)
- goto fail;
+ return ret;
- key = "qcom,disable-prediction";
- c->lpm_prediction = !(of_property_read_bool(node, key));
+ c->lpm_prediction = !(of_property_read_bool(dn,
+ "qcom,disable-prediction"));
if (c->lpm_prediction) {
- key = "qcom,clstr-tmr-add";
- ret = of_property_read_u32(node, key, &c->tmr_add);
+ ret = lpm_of_read_u32(dn, "qcom,clstr-tmr-add", &c->tmr_add,
+ false);
if (ret || c->tmr_add < TIMER_ADD_LOW ||
- c->tmr_add > TIMER_ADD_HIGH)
+ c->tmr_add > TIMER_ADD_HIGH) {
c->tmr_add = DEFAULT_TIMER_ADD;
+ ret = 0;
+ }
}
/* Set default_level to 0 as default */
c->default_level = 0;
- return 0;
-fail:
- pr_err("Failed to read key: %s ret: %d\n", key, ret);
-
return ret;
}
-static int parse_power_params(struct device_node *node,
- struct power_params *pwr)
+static int parse_power_params(struct device_node *dn, struct power_params *pwr)
{
- char *key;
int ret;
- key = "qcom,entry-latency-us";
- ret = of_property_read_u32(node, key, &pwr->entry_latency);
+ ret = lpm_of_read_u32(dn, "qcom,entry-latency-us",
+ &pwr->entry_latency, true);
if (ret)
- goto fail;
+ return ret;
- key = "qcom,exit-latency-us";
- ret = of_property_read_u32(node, key, &pwr->exit_latency);
+ ret = lpm_of_read_u32(dn, "qcom,exit-latency-us",
+ &pwr->exit_latency, true);
if (ret)
- goto fail;
+ return ret;
- key = "qcom,min-residency-us";
- ret = of_property_read_u32(node, key, &pwr->min_residency);
- if (ret)
- goto fail;
-
- return ret;
-fail:
- pr_err("Failed to read key: %s node: %s\n", key, node->name);
+ ret = lpm_of_read_u32(dn, "qcom,min-residency-us",
+ &pwr->min_residency, true);
return ret;
}
-static int parse_cluster_level(struct device_node *node,
- struct lpm_cluster *cluster)
+static int parse_cluster_level(struct device_node *dn,
+ struct lpm_cluster *cluster)
{
struct lpm_cluster_level *level = &cluster->levels[cluster->nlevels];
int ret = -ENOMEM;
- char *key;
- key = "label";
- ret = of_property_read_string(node, key, &level->level_name);
+ ret = of_property_read_string(dn, "label", &level->level_name);
+ if (ret) {
+ pr_err("Failed to read label ret: %d\n", ret);
+ return ret;
+ }
+
+ ret = lpm_of_read_u32(dn, "qcom,psci-mode", &level->psci_id, true);
if (ret)
- goto failed;
+ return ret;
- key = "qcom,psci-mode";
- ret = of_property_read_u32(node, key, &level->psci_id);
- if (ret)
- goto failed;
-
- level->is_reset = of_property_read_bool(node, "qcom,is-reset");
+ level->is_reset = of_property_read_bool(dn, "qcom,is-reset");
if (cluster->nlevels != cluster->default_level) {
- key = "qcom,min-child-idx";
- ret = of_property_read_u32(node, key, &level->min_child_level);
+ ret = lpm_of_read_u32(dn, "qcom,min-child-idx",
+ &level->min_child_level, true);
if (ret)
- goto failed;
+ return ret;
if (cluster->min_child_level > level->min_child_level)
cluster->min_child_level = level->min_child_level;
}
- level->notify_rpm = of_property_read_bool(node, "qcom,notify-rpm");
+ level->notify_rpm = of_property_read_bool(dn, "qcom,notify-rpm");
- key = "parse_power_params";
- ret = parse_power_params(node, &level->pwr);
- if (ret)
- goto failed;
+ ret = parse_power_params(dn, &level->pwr);
+ if (ret) {
+ pr_err("Failed to parse power params ret:%d\n", ret);
+ return ret;
+ }
- key = "qcom,reset-level";
- ret = of_property_read_u32(node, key, &level->reset_level);
+ ret = lpm_of_read_u32(dn, "qcom,reset-level",
+ &level->reset_level, false);
if (ret == -EINVAL)
level->reset_level = LPM_RESET_LVL_NONE;
else if (ret)
- goto failed;
+ return ret;
cluster->nlevels++;
return 0;
-failed:
- pr_err("Failed to read key: %s ret: %d\n", key, ret);
-
- return ret;
}
static int parse_cpu_mode(struct device_node *n, struct lpm_cpu_level *l)
{
- char *key;
int ret;
- key = "label";
- ret = of_property_read_string(n, key, &l->name);
- if (ret)
- goto fail;
+ ret = of_property_read_string(n, "label", &l->name);
+ if (ret) {
+ pr_err("Failed to read label level: %s\n", l->name);
+ return ret;
+ }
- key = "qcom,psci-cpu-mode";
- ret = of_property_read_u32(n, key, &l->psci_id);
- if (ret)
- goto fail;
-
- return ret;
-fail:
- pr_err("Failed to read key: %s level: %s\n", key, l->name);
-
- return ret;
+ return lpm_of_read_u32(n, "qcom,psci-cpu-mode", &l->psci_id, true);
}
static int get_cpumask_for_node(struct device_node *node, struct cpumask *mask)
@@ -515,7 +499,6 @@ static int parse_cpu(struct device_node *node, struct lpm_cpu *cpu)
struct device_node *n;
int ret, i;
- const char *key;
for_each_child_of_node(node, n) {
struct lpm_cpu_level *l = &cpu->levels[cpu->nlevels];
@@ -534,14 +517,13 @@ static int parse_cpu(struct device_node *node, struct lpm_cpu *cpu)
return ret;
}
- key = "qcom,use-broadcast-timer";
- l->use_bc_timer = of_property_read_bool(n, key);
+ l->use_bc_timer = of_property_read_bool(n,
+ "qcom,use-broadcast-timer");
- key = "qcom,is-reset";
- l->is_reset = of_property_read_bool(n, key);
+ l->is_reset = of_property_read_bool(n, "qcom,is-reset");
- key = "qcom,reset-level";
- ret = of_property_read_u32(n, key, &l->reset_level);
+ ret = lpm_of_read_u32(n, "qcom,reset-level", &l->reset_level,
+ false);
of_node_put(n);
if (ret == -EINVAL)
@@ -559,67 +541,63 @@ static int parse_cpu(struct device_node *node, struct lpm_cpu *cpu)
return 0;
}
-static int parse_cpu_levels(struct device_node *node, struct lpm_cluster *c)
+static int parse_cpu_levels(struct device_node *dn, struct lpm_cluster *c)
{
int ret;
- char *key;
struct lpm_cpu *cpu;
- cpu = devm_kzalloc(&lpm_pdev->dev, sizeof(*cpu), GFP_KERNEL);
+ cpu = devm_kcalloc(&lpm_pdev->dev, 1, sizeof(*cpu), GFP_KERNEL);
if (!cpu)
return -ENOMEM;
- if (get_cpumask_for_node(node, &cpu->related_cpus))
+ if (get_cpumask_for_node(dn, &cpu->related_cpus))
return -EINVAL;
cpu->parent = c;
- key = "qcom,psci-mode-shift";
- ret = of_property_read_u32(node, key, &cpu->psci_mode_shift);
+ ret = lpm_of_read_u32(dn, "qcom,psci-mode-shift",
+ &cpu->psci_mode_shift, true);
if (ret)
- goto failed;
+ return ret;
- key = "qcom,psci-mode-mask";
- ret = of_property_read_u32(node, key, &cpu->psci_mode_mask);
+ ret = lpm_of_read_u32(dn, "qcom,psci-mode-mask",
+ &cpu->psci_mode_mask, true);
if (ret)
- goto failed;
+ return ret;
- key = "qcom,disable-prediction";
- cpu->lpm_prediction = !(of_property_read_bool(node, key));
+ cpu->lpm_prediction = !(of_property_read_bool(dn,
+ "qcom,disable-prediction"));
if (cpu->lpm_prediction) {
- key = "qcom,ref-stddev";
- ret = of_property_read_u32(node, key, &cpu->ref_stddev);
+ ret = lpm_of_read_u32(dn, "qcom,ref-stddev",
+ &cpu->ref_stddev, false);
if (ret || cpu->ref_stddev < STDDEV_LOW ||
cpu->ref_stddev > STDDEV_HIGH)
cpu->ref_stddev = DEFAULT_STDDEV;
- key = "qcom,tmr-add";
- ret = of_property_read_u32(node, key, &cpu->tmr_add);
+ ret = lpm_of_read_u32(dn, "qcom,tmr-add",
+ &cpu->tmr_add, false);
if (ret || cpu->tmr_add < TIMER_ADD_LOW ||
cpu->tmr_add > TIMER_ADD_HIGH)
cpu->tmr_add = DEFAULT_TIMER_ADD;
- key = "qcom,ref-premature-cnt";
- ret = of_property_read_u32(node, key, &cpu->ref_premature_cnt);
+ ret = lpm_of_read_u32(dn, "qcom,ref-premature-cnt",
+ &cpu->ref_premature_cnt, false);
if (ret || cpu->ref_premature_cnt < PREMATURE_CNT_LOW ||
cpu->ref_premature_cnt > PREMATURE_CNT_HIGH)
cpu->ref_premature_cnt = DEFAULT_PREMATURE_CNT;
}
- key = "parse_cpu";
- ret = parse_cpu(node, cpu);
- if (ret)
- goto failed;
+ ret = parse_cpu(dn, cpu);
+ if (ret) {
+ pr_err("Failed to parse cpu %s\n", dn->name);
+ return ret;
+ }
cpumask_or(&c->child_cpus, &c->child_cpus, &cpu->related_cpus);
list_add(&cpu->list, &c->cpu);
return ret;
-
-failed:
- pr_err("Failed to read key: %s node: %s\n", key, node->name);
- return ret;
}
void free_cluster_node(struct lpm_cluster *cluster)
@@ -643,14 +621,13 @@ void free_cluster_node(struct lpm_cluster *cluster)
* child nodes.
*/
struct lpm_cluster *parse_cluster(struct device_node *node,
- struct lpm_cluster *parent)
+ struct lpm_cluster *parent)
{
struct lpm_cluster *c;
struct device_node *n;
- char *key;
int ret = 0, i;
- c = devm_kzalloc(&lpm_pdev->dev, sizeof(*c), GFP_KERNEL);
+ c = devm_kcalloc(&lpm_pdev->dev, 1, sizeof(*c), GFP_KERNEL);
if (!c)
return ERR_PTR(-ENOMEM);
@@ -671,25 +648,28 @@ struct lpm_cluster *parse_cluster(struct device_node *node,
}
if (!of_node_cmp(n->name, "qcom,pm-cluster-level")) {
- key = "qcom,pm-cluster-level";
- if (parse_cluster_level(n, c))
+ if (parse_cluster_level(n, c)) {
+ pr_err("Failed parse pm-cluster-level\n");
goto failed_parse_cluster;
+ }
} else if (!of_node_cmp(n->name, "qcom,pm-cluster")) {
struct lpm_cluster *child;
- key = "qcom,pm-cluster";
child = parse_cluster(n, c);
- if (!child)
+ if (!child) {
+ pr_err("Failed parse pm-cluster\n");
goto failed_parse_cluster;
+ }
list_add(&child->list, &c->child);
cpumask_or(&c->child_cpus, &c->child_cpus,
&child->child_cpus);
c->aff_level = child->aff_level + 1;
} else if (!of_node_cmp(n->name, "qcom,pm-cpu")) {
- key = "qcom,pm-cpu";
- if (parse_cpu_levels(n, c))
+ if (parse_cpu_levels(n, c)) {
+ pr_err("Failed parse pm-cpu\n");
goto failed_parse_cluster;
+ }
c->aff_level = 1;
}
@@ -711,7 +691,6 @@ struct lpm_cluster *parse_cluster(struct device_node *node,
return c;
failed_parse_cluster:
- pr_err("Failed parse cluster:%s\n", key);
of_node_put(n);
if (parent)
list_del(&c->list);
@@ -749,7 +728,6 @@ void cluster_dt_walkthrough(struct lpm_cluster *cluster)
for (i = 0; i < id; i++)
snprintf(str+i, 10 - i, "\t");
- pr_info("%d\n", __LINE__);
for (i = 0; i < cluster->nlevels; i++) {
struct lpm_cluster_level *l = &cluster->levels[i];
@@ -759,7 +737,6 @@ void cluster_dt_walkthrough(struct lpm_cluster *cluster)
}
list_for_each_entry(cpu, &cluster->cpu, list) {
- pr_info("%d\n", __LINE__);
for (j = 0; j < cpu->nlevels; j++)
pr_info("%s\tCPU level name: %s\n", str,
cpu->levels[j].name);
@@ -770,7 +747,6 @@ void cluster_dt_walkthrough(struct lpm_cluster *cluster)
list_for_each(list, &cluster->child) {
struct lpm_cluster *n;
- pr_info("%d\n", __LINE__);
n = list_entry(list, typeof(*n), list);
cluster_dt_walkthrough(n);
}
diff --git a/drivers/cpuidle/lpm-levels.c b/drivers/cpuidle/lpm-levels.c
index ba3cb9a..9ae8de6 100644
--- a/drivers/cpuidle/lpm-levels.c
+++ b/drivers/cpuidle/lpm-levels.c
@@ -1413,7 +1413,6 @@ static int cpuidle_register_cpu(struct cpuidle_driver *drv,
struct cpuidle_device *device;
int cpu, ret;
-
if (!mask || !drv)
return -EINVAL;
@@ -1485,8 +1484,8 @@ static int cluster_cpuidle_register(struct lpm_cluster *cl)
struct lpm_cpu_level *cpu_level = &lpm_cpu->levels[i];
snprintf(st->name, CPUIDLE_NAME_LEN, "C%u\n", i);
- snprintf(st->desc, CPUIDLE_DESC_LEN, "%s",
- cpu_level->name);
+ strlcpy(st->desc, cpu_level->name, CPUIDLE_DESC_LEN);
+
st->flags = 0;
st->exit_latency = cpu_level->pwr.exit_latency;
st->target_residency = 0;
@@ -1584,7 +1583,6 @@ static void register_cluster_lpm_stats(struct lpm_cluster *cl,
kfree(level_name);
list_for_each_entry(cpu, &cl->cpu, list) {
- pr_err("%s()\n", __func__);
register_cpu_lpm_stats(cpu, cl);
}
if (!list_empty(&cl->cpu))
diff --git a/drivers/soc/qcom/event_timer.c b/drivers/soc/qcom/event_timer.c
index 250c2e9..31a25e1 100644
--- a/drivers/soc/qcom/event_timer.c
+++ b/drivers/soc/qcom/event_timer.c
@@ -78,7 +78,7 @@ struct event_timer_info *add_event_timer(uint32_t irq,
void (*function)(void *), void *data)
{
struct event_timer_info *event_info =
- kzalloc(sizeof(struct event_timer_info), GFP_KERNEL);
+ kcalloc(1, sizeof(*event_info), GFP_KERNEL);
if (!event_info)
return NULL;
@@ -103,7 +103,7 @@ struct event_timer_info *add_event_timer(uint32_t irq,
/* Init rb node and hr timer */
timerqueue_init(&event_info->node);
- pr_debug("New Event Added. Event %pK(on cpu%d). irq %d.\n",
+ pr_debug("New Event Added. Event %pK(on cpu%d). irq %d\n",
event_info, event_info->cpu, irq);
return event_info;
@@ -126,8 +126,6 @@ static bool is_event_next(struct event_timer_info *event)
goto exit_is_next_event;
next_event = container_of(next, struct event_timer_info, node);
- if (!next_event)
- goto exit_is_next_event;
if (next_event == event)
ret = true;
@@ -200,8 +198,6 @@ static enum hrtimer_restart event_hrtimer_cb(struct hrtimer *hrtimer)
while (next && (ktime_to_ns(next->expires)
<= ktime_to_ns(hrtimer->node.expires))) {
event = container_of(next, struct event_timer_info, node);
- if (!event)
- goto hrtimer_cb_exit;
WARN_ON_ONCE(event->cpu != cpu);
@@ -221,7 +217,7 @@ static enum hrtimer_restart event_hrtimer_cb(struct hrtimer *hrtimer)
event = container_of(next, struct event_timer_info, node);
create_hrtimer(event);
}
-hrtimer_cb_exit:
+
spin_unlock_irqrestore(&event_timer_lock, flags);
return HRTIMER_NORESTART;
}
@@ -307,7 +303,7 @@ static void irq_affinity_change_notifier(struct irq_affinity_notify *notify,
old_cpu = event->cpu;
if (msm_event_debug_mask && MSM_EVENT_TIMER_DEBUG)
- pr_debug("irq %d, event %pK, old_cpu(%d)->new_cpu(%d).\n",
+ pr_debug("irq %d, event %pK, old_cpu(%d)->new_cpu(%d)\n",
irq, event, old_cpu, new_cpu);
/* No change in IRQ affinity */
diff --git a/drivers/soc/qcom/lpm-stats.c b/drivers/soc/qcom/lpm-stats.c
index 4591798f..b94c7c0 100644
--- a/drivers/soc/qcom/lpm-stats.c
+++ b/drivers/soc/qcom/lpm-stats.c
@@ -46,6 +46,19 @@ static struct level_stats suspend_time_stats;
static DEFINE_PER_CPU_SHARED_ALIGNED(struct lpm_stats, cpu_stats);
+bool str_is_reset(const char __user *in, size_t count)
+{
+ loff_t ppos = 0;
+ char buffer[64] = { 0 };
+ int ret = simple_write_to_buffer(buffer, sizeof(buffer) - 1,
+ &ppos, in, count - 1);
+
+ if (ret > 0)
+ return strcmp(buffer, lpm_stats_reset) ? false : true;
+
+ return false;
+}
+
static uint64_t get_total_sleep_time(unsigned int cpu_id)
{
struct lpm_stats *stats = &per_cpu(cpu_stats, cpu_id);
@@ -96,25 +109,15 @@ static void level_stats_print(struct seq_file *m, struct level_stats *stats)
{
int i = 0;
int64_t bucket_time = 0;
- char seqs[MAX_STR_LEN] = {0};
uint64_t s = stats->total_time;
uint32_t ns = do_div(s, NSEC_PER_SEC);
- snprintf(seqs, MAX_STR_LEN,
- "[%s] %s:\n"
- " success count: %7d\n"
- " total success time: %lld.%09u\n",
- stats->owner->name,
- stats->name,
- stats->success_count,
- s, ns);
- seq_puts(m, seqs);
+ seq_printf(m, "[%s] %s:\n success count: %7d\n"
+ "total success time: %lld.%09u\n",
+ stats->owner->name, stats->name, stats->success_count, s, ns);
- if (stats->failed_count) {
- snprintf(seqs, MAX_STR_LEN, " failed count: %7d\n",
- stats->failed_count);
- seq_puts(m, seqs);
- }
+ if (stats->failed_count)
+ seq_printf(m, " failed count: %7d\n", stats->failed_count);
bucket_time = stats->first_bucket_time;
for (i = 0;
@@ -122,30 +125,21 @@ static void level_stats_print(struct seq_file *m, struct level_stats *stats)
i++) {
s = bucket_time;
ns = do_div(s, NSEC_PER_SEC);
- snprintf(seqs, MAX_STR_LEN,
- "\t<%6lld.%09u: %7d (%lld-%lld)\n",
+ seq_printf(m, "\t<%6lld.%09u: %7d (%lld-%lld)\n",
s, ns, stats->bucket[i],
- stats->min_time[i],
- stats->max_time[i]);
- seq_puts(m, seqs);
+ stats->min_time[i],
+ stats->max_time[i]);
bucket_time <<= CONFIG_MSM_IDLE_STATS_BUCKET_SHIFT;
}
- snprintf(seqs, MAX_STR_LEN,
- "\t>=%5lld.%09u:%8d (%lld-%lld)\n",
+ seq_printf(m, "\t>=%5lld.%09u:%8d (%lld-%lld)\n",
s, ns, stats->bucket[i],
stats->min_time[i],
stats->max_time[i]);
- seq_puts(m, seqs);
}
static int level_stats_file_show(struct seq_file *m, void *v)
{
- struct level_stats *stats = NULL;
-
- if (!m->private)
- return -EINVAL;
-
- stats = (struct level_stats *) m->private;
+ struct level_stats *stats = (struct level_stats *) m->private;
level_stats_print(m, stats);
@@ -207,11 +201,6 @@ static int lpm_stats_file_show(struct seq_file *m, void *v)
{
struct lpm_stats *stats = (struct lpm_stats *)m->private;
- if (!m->private) {
- pr_err("%s: Invalid pdata, Cannot print stats\n", __func__);
- return -EINVAL;
- }
-
level_stats_print_all(m, stats);
level_stats_print(m, &suspend_time_stats);
@@ -226,25 +215,13 @@ static int lpm_stats_file_open(struct inode *inode, struct file *file)
static ssize_t level_stats_file_write(struct file *file,
const char __user *buffer, size_t count, loff_t *off)
{
- char buf[MAX_STR_LEN] = {0};
struct inode *in = file->f_inode;
struct level_stats *stats = (struct level_stats *)in->i_private;
- size_t len = strnlen(lpm_stats_reset, MAX_STR_LEN);
- if (!stats)
- return -EINVAL;
-
- if (count != len+1)
- return -EINVAL;
-
- if (copy_from_user(buf, buffer, len))
- return -EFAULT;
-
- if (strcmp(buf, lpm_stats_reset))
+ if (!str_is_reset(buffer, count))
return -EINVAL;
level_stats_reset(stats);
-
return count;
}
@@ -260,21 +237,10 @@ static void reset_cpu_stats(void *info)
static ssize_t lpm_stats_file_write(struct file *file,
const char __user *buffer, size_t count, loff_t *off)
{
- char buf[MAX_STR_LEN] = {0};
struct inode *in = file->f_inode;
struct lpm_stats *stats = (struct lpm_stats *)in->i_private;
- size_t len = strnlen(lpm_stats_reset, MAX_STR_LEN);
- if (!stats)
- return -EINVAL;
-
- if (count != len+1)
- return -EINVAL;
-
- if (copy_from_user(buf, buffer, len))
- return -EFAULT;
-
- if (strcmp(buf, lpm_stats_reset))
+ if (!str_is_reset(buffer, count))
return -EINVAL;
level_stats_reset_all(stats);
@@ -290,32 +256,22 @@ static ssize_t lpm_stats_file_write(struct file *file,
int lifo_stats_file_show(struct seq_file *m, void *v)
{
- struct lpm_stats *stats = NULL;
+ struct lpm_stats *stats = (struct lpm_stats *)m->private;
struct list_head *centry = NULL;
struct lpm_stats *pos = NULL;
- char seqs[MAX_STR_LEN] = {0};
-
- if (!m->private)
- return -EINVAL;
-
- stats = (struct lpm_stats *)m->private;
if (list_empty(&stats->child)) {
- pr_err("%s: ERROR: Lifo level with no children.\n",
+ pr_err("%s: ERROR: Lifo level with no children\n",
__func__);
return -EINVAL;
}
centry = &stats->child;
list_for_each_entry(pos, centry, sibling) {
- snprintf(seqs, MAX_STR_LEN,
- "%s:\n"
- "\tLast-In:%u\n"
- "\tFirst-Out:%u\n",
+ seq_printf(m, "%s:\n\tLast-In:%u\n\tFirst-Out:%u\n",
pos->name,
pos->lifo.last_in,
pos->lifo.first_out);
- seq_puts(m, seqs);
}
return 0;
}
@@ -342,21 +298,10 @@ static void lifo_stats_reset_all(struct lpm_stats *stats)
static ssize_t lifo_stats_file_write(struct file *file,
const char __user *buffer, size_t count, loff_t *off)
{
- char buf[MAX_STR_LEN] = {0};
struct inode *in = file->f_inode;
struct lpm_stats *stats = (struct lpm_stats *)in->i_private;
- size_t len = strnlen(lpm_stats_reset, MAX_STR_LEN);
- if (!stats)
- return -EINVAL;
-
- if (count != len+1)
- return -EINVAL;
-
- if (copy_from_user(buf, buffer, len))
- return -EFAULT;
-
- if (strcmp(buf, lpm_stats_reset))
+ if (!str_is_reset(buffer, count))
return -EINVAL;
lifo_stats_reset_all(stats);
@@ -406,7 +351,6 @@ static void update_last_in_stats(struct lpm_stats *stats)
return;
}
}
- WARN(1, "Should not reach here\n");
}
static void update_first_out_stats(struct lpm_stats *stats)
@@ -424,7 +368,6 @@ static void update_first_out_stats(struct lpm_stats *stats)
return;
}
}
- WARN(1, "Should not reach here\n");
}
static inline void update_exit_stats(struct lpm_stats *stats, uint32_t index,
@@ -455,7 +398,7 @@ static int config_level(const char *name, const char **levels,
INIT_LIST_HEAD(&stats->sibling);
INIT_LIST_HEAD(&stats->child);
- stats->time_stats = kcalloc(num_levels, sizeof(struct level_stats),
+ stats->time_stats = kcalloc(num_levels, sizeof(*stats->time_stats),
GFP_KERNEL);
if (!stats->time_stats)
return -ENOMEM;
@@ -511,7 +454,7 @@ static ssize_t total_sleep_time_show(struct kobject *kobj,
unsigned int cpu = cpu_sleep_time->cpu;
uint64_t total_time = get_total_sleep_time(cpu);
- return snprintf(buf, MAX_TIME_LEN, "%llu.%09u\n", total_time,
+ return scnprintf(buf, MAX_TIME_LEN, "%llu.%09u\n", total_time,
do_div(total_time, NSEC_PER_SEC));
}
@@ -525,7 +468,7 @@ static struct kobject *local_module_kobject(void)
int err;
struct module_kobject *mk;
- mk = kzalloc(sizeof(*mk), GFP_KERNEL);
+ mk = kcalloc(1, sizeof(*mk), GFP_KERNEL);
if (!mk)
return ERR_PTR(-ENOMEM);
@@ -555,7 +498,7 @@ static int create_sysfs_node(unsigned int cpu, struct lpm_stats *stats)
struct kobject *cpu_kobj = NULL;
struct lpm_sleep_time *ts = NULL;
struct kobject *stats_kobj;
- char cpu_name[] = "cpuXX";
+ char cpu_name[10] = { 0 };
int ret = -ENOMEM;
stats_kobj = local_module_kobject();
@@ -568,7 +511,7 @@ static int create_sysfs_node(unsigned int cpu, struct lpm_stats *stats)
if (!cpu_kobj)
return -ENOMEM;
- ts = kzalloc(sizeof(*ts), GFP_KERNEL);
+ ts = kcalloc(1, sizeof(*ts), GFP_KERNEL);
if (!ts)
goto failed;
@@ -604,10 +547,10 @@ static struct lpm_stats *config_cpu_level(const char *name,
for_each_cpu(cpu, mask) {
int ret = 0;
- char cpu_name[MAX_STR_LEN] = {0};
+ char cpu_name[16] = { 0 };
stats = &per_cpu(cpu_stats, cpu);
- snprintf(cpu_name, MAX_STR_LEN, "%s%d", name, cpu);
+ snprintf(cpu_name, sizeof(cpu_name), "%s%d", name, cpu);
cpumask_set_cpu(cpu, &stats->mask);
stats->is_cpu = true;
@@ -654,7 +597,7 @@ static struct lpm_stats *config_cluster_level(const char *name,
struct lpm_stats *stats = NULL;
int ret = 0;
- stats = kzalloc(sizeof(struct lpm_stats), GFP_KERNEL);
+ stats = kcalloc(1, sizeof(*stats), GFP_KERNEL);
if (!stats)
return ERR_PTR(-ENOMEM);
@@ -741,9 +684,7 @@ struct lpm_stats *lpm_stats_config_level(const char *name,
struct lpm_stats *stats = NULL;
if (!levels || num_levels <= 0 || IS_ERR(parent)) {
- pr_err("%s: Invalid input\n\t\tlevels = %p\n\t\t"
- "num_levels = %d\n\t\tparent = %ld\n",
- __func__, levels, num_levels, PTR_ERR(parent));
+ pr_err("%s: Invalid input\n", __func__);
return ERR_PTR(-EINVAL);
}
diff --git a/drivers/soc/qcom/rpm_stats.c b/drivers/soc/qcom/rpm_stats.c
index 2f64d1f..1586543 100644
--- a/drivers/soc/qcom/rpm_stats.c
+++ b/drivers/soc/qcom/rpm_stats.c
@@ -95,7 +95,7 @@ static inline int msm_rpmstats_append_data_to_buf(char *buf,
actual_last_sleep = get_time_in_msec(data->accumulated);
#if defined(CONFIG_MSM_RPM_SMD)
- return snprintf(buf, buflength,
+ return scnprintf(buf, buflength,
"RPM Mode:%s\n\t count:%d\ntime in last mode(msec):%llu\n"
"time since last mode(sec):%llu\nactual last sleep(msec):%llu\n"
"client votes: %#010x\n\n",
@@ -103,7 +103,7 @@ static inline int msm_rpmstats_append_data_to_buf(char *buf,
time_since_last_mode, actual_last_sleep,
data->client_votes);
#else
- return snprintf(buf, buflength,
+ return scnprintf(buf, buflength,
"RPM Mode:%s\n\t count:%d\ntime in last mode(msec):%llu\n"
"time since last mode(sec):%llu\nactual last sleep(msec):%llu\n\n",
stat_type, data->count, time_in_last_mode,
diff --git a/drivers/soc/qcom/rpmh_master_stat.c b/drivers/soc/qcom/rpmh_master_stat.c
index 86694f3..795291f 100644
--- a/drivers/soc/qcom/rpmh_master_stat.c
+++ b/drivers/soc/qcom/rpmh_master_stat.c
@@ -108,7 +108,7 @@ static ssize_t msm_rpmh_master_stats_print_data(char *prvbuf, ssize_t length,
(arch_counter_get_cntvct()
- record->last_entered);
- return snprintf(prvbuf, length, "%s\n\tVersion:0x%x\n"
+ return scnprintf(prvbuf, length, "%s\n\tVersion:0x%x\n"
"\tSleep Count:0x%x\n"
"\tSleep Last Entered At:0x%llx\n"
"\tSleep Last Exited At:0x%llx\n"
@@ -199,9 +199,6 @@ static int msm_rpmh_master_stats_probe(struct platform_device *pdev)
struct kobject *rpmh_master_stats_kobj = NULL;
int ret = -ENOMEM;
- if (!pdev)
- return -EINVAL;
-
prvdata = devm_kzalloc(&pdev->dev, sizeof(*prvdata), GFP_KERNEL);
if (!prvdata)
return ret;
@@ -248,9 +245,6 @@ static int msm_rpmh_master_stats_remove(struct platform_device *pdev)
{
struct rpmh_master_stats_prv_data *prvdata;
- if (!pdev)
- return -EINVAL;
-
prvdata = (struct rpmh_master_stats_prv_data *)
platform_get_drvdata(pdev);