Commit 8b3cb084 authored by Alex Elder's avatar Alex Elder Committed by Jakub Kicinski

net: ipa: move and redefine ipa_version_valid()

Move the definition of ipa_version_valid(), making it a static
inline function defined together with the enumerated type in
"ipa_version.h".  Define a new count value in the type.

Rename the function to be ipa_version_supported(), and have it
return true only if the IPA version supplied is explicitly supported
by the driver.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent bb788de3
...@@ -616,27 +616,6 @@ static void ipa_validate_build(void) ...@@ -616,27 +616,6 @@ static void ipa_validate_build(void)
field_max(AGGR_GRANULARITY_FMASK)); field_max(AGGR_GRANULARITY_FMASK));
} }
static bool ipa_version_valid(enum ipa_version version)
{
switch (version) {
case IPA_VERSION_3_0:
case IPA_VERSION_3_1:
case IPA_VERSION_3_5:
case IPA_VERSION_3_5_1:
case IPA_VERSION_4_0:
case IPA_VERSION_4_1:
case IPA_VERSION_4_2:
case IPA_VERSION_4_5:
case IPA_VERSION_4_7:
case IPA_VERSION_4_9:
case IPA_VERSION_4_11:
return true;
default:
return false;
}
}
/** /**
* ipa_probe() - IPA platform driver probe function * ipa_probe() - IPA platform driver probe function
* @pdev: Platform device pointer * @pdev: Platform device pointer
...@@ -678,8 +657,8 @@ static int ipa_probe(struct platform_device *pdev) ...@@ -678,8 +657,8 @@ static int ipa_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
if (!ipa_version_valid(data->version)) { if (!ipa_version_supported(data->version)) {
dev_err(dev, "invalid IPA version\n"); dev_err(dev, "unsupported IPA version %u\n", data->version);
return -EINVAL; return -EINVAL;
} }
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
* @IPA_VERSION_4_7: IPA version 4.7/GSI version 2.7 * @IPA_VERSION_4_7: IPA version 4.7/GSI version 2.7
* @IPA_VERSION_4_9: IPA version 4.9/GSI version 2.9 * @IPA_VERSION_4_9: IPA version 4.9/GSI version 2.9
* @IPA_VERSION_4_11: IPA version 4.11/GSI version 2.11 (2.1.1) * @IPA_VERSION_4_11: IPA version 4.11/GSI version 2.11 (2.1.1)
* @IPA_VERSION_COUNT: Number of defined IPA versions
* *
* Defines the version of IPA (and GSI) hardware present on the platform. * Defines the version of IPA (and GSI) hardware present on the platform.
* Please update ipa_version_valid() and ipa_version_string() whenever a * Please update ipa_version_string() whenever a new version is added.
* new version is added.
*/ */
enum ipa_version { enum ipa_version {
IPA_VERSION_3_0, IPA_VERSION_3_0,
...@@ -36,8 +36,24 @@ enum ipa_version { ...@@ -36,8 +36,24 @@ enum ipa_version {
IPA_VERSION_4_7, IPA_VERSION_4_7,
IPA_VERSION_4_9, IPA_VERSION_4_9,
IPA_VERSION_4_11, IPA_VERSION_4_11,
IPA_VERSION_COUNT, /* Last; not a version */
}; };
static inline bool ipa_version_supported(enum ipa_version version)
{
switch (version) {
case IPA_VERSION_3_1:
case IPA_VERSION_3_5_1:
case IPA_VERSION_4_2:
case IPA_VERSION_4_5:
case IPA_VERSION_4_9:
case IPA_VERSION_4_11:
return true;
default:
return false;
}
}
/* Execution environment IDs */ /* Execution environment IDs */
enum gsi_ee_id { enum gsi_ee_id {
GSI_EE_AP = 0x0, GSI_EE_AP = 0x0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment