aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ipa/ipa_resource.c
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2021-03-26 10:11:21 -0500
committerDavid S. Miller <davem@davemloft.net>2021-03-26 15:02:39 -0700
commit4fd704b3608a4c89260ea33895a694bc5385e00f (patch)
treeab2501657eef882472d8bc14d886289ef9ed25b2 /drivers/net/ipa/ipa_resource.c
parentnet: ipa: pass data for source and dest resource config (diff)
downloadlinux-dev-4fd704b3608a4c89260ea33895a694bc5385e00f.tar.xz
linux-dev-4fd704b3608a4c89260ea33895a694bc5385e00f.zip
net: ipa: record number of groups in data
The arrays of source and destination resource limits defined in configuration data are of a fixed size--which is the maximum number of resource groups supported for any platform. Most platforms will use fewer than that many groups. Add new members to the ipa_rsrc_group_id enumerated type to define the number of source and destination resource groups are defined for the platform. (This type is defined for each platform in its data file.) Add a new field to the resource configuration data that indicates how many of the source and destination resource groups are actually used for the platform, and initialize it with the count value. This allows us to determine the number of groups defined for the platform without exposing the ipa_rsrc_group_id enumerated type. As a result, we no longer need ipa_resource_group_src_count() and ipa_resource_group_dst_count(), because each platform now defines its supported number of resource groups. So get rid of those two functions. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ipa/ipa_resource.c')
-rw-r--r--drivers/net/ipa/ipa_resource.c50
1 files changed, 4 insertions, 46 deletions
diff --git a/drivers/net/ipa/ipa_resource.c b/drivers/net/ipa/ipa_resource.c
index 3db4dd3bda9c..578ff070d405 100644
--- a/drivers/net/ipa/ipa_resource.c
+++ b/drivers/net/ipa/ipa_resource.c
@@ -26,48 +26,6 @@
* total resources of each type is assigned for use by each group.
*/
-/* # IPA source resource groups available based on version */
-static u32 ipa_resource_group_src_count(enum ipa_version version)
-{
- switch (version) {
- case IPA_VERSION_3_5_1:
- case IPA_VERSION_4_0:
- case IPA_VERSION_4_1:
- return 4;
-
- case IPA_VERSION_4_2:
- return 1;
-
- case IPA_VERSION_4_5:
- return 5;
-
- default:
- return 0;
- }
-}
-
-/* # IPA destination resource groups available based on version */
-static u32 ipa_resource_group_dst_count(enum ipa_version version)
-{
- switch (version) {
- case IPA_VERSION_3_5_1:
- return 3;
-
- case IPA_VERSION_4_0:
- case IPA_VERSION_4_1:
- return 4;
-
- case IPA_VERSION_4_2:
- return 1;
-
- case IPA_VERSION_4_5:
- return 5;
-
- default:
- return 0;
- }
-}
-
static bool ipa_resource_limits_valid(struct ipa *ipa,
const struct ipa_resource_data *data)
{
@@ -79,7 +37,7 @@ static bool ipa_resource_limits_valid(struct ipa *ipa,
/* We program at most 6 source or destination resource group limits */
BUILD_BUG_ON(IPA_RESOURCE_GROUP_MAX > 6);
- group_count = ipa_resource_group_src_count(ipa->version);
+ group_count = data->rsrc_group_src_count;
if (!group_count || group_count > IPA_RESOURCE_GROUP_MAX)
return false;
@@ -95,7 +53,7 @@ static bool ipa_resource_limits_valid(struct ipa *ipa,
return false;
}
- group_count = ipa_resource_group_dst_count(ipa->version);
+ group_count = data->rsrc_group_src_count;
if (!group_count || group_count > IPA_RESOURCE_GROUP_MAX)
return false;
@@ -131,7 +89,7 @@ ipa_resource_config_common(struct ipa *ipa, u32 offset,
static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type,
const struct ipa_resource_data *data)
{
- u32 group_count = ipa_resource_group_src_count(ipa->version);
+ u32 group_count = data->rsrc_group_src_count;
const struct ipa_resource_limits *ylimits;
const struct ipa_resource *resource;
u32 offset;
@@ -160,7 +118,7 @@ static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type,
static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type,
const struct ipa_resource_data *data)
{
- u32 group_count = ipa_resource_group_dst_count(ipa->version);
+ u32 group_count = data->rsrc_group_dst_count;
const struct ipa_resource_limits *ylimits;
const struct ipa_resource *resource;
u32 offset;