Commit c7be12fa authored by Alex Elder's avatar Alex Elder Committed by Jakub Kicinski

net: ipa: kill struct ipa_interconnect

The ipa_interconnect structure contains an icc_path pointer, plus an
average and peak bandwidth value.  Other than the interconnect name,
this matches the icc_bulk_data structure exactly.

Use the icc_bulk_data structure in place of the ipa_interconnect
structure, and add an initialization of its name field.  Then get
rid of the now unnecessary ipa_interconnect structure definition.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c17c4059
...@@ -34,18 +34,6 @@ ...@@ -34,18 +34,6 @@
#define IPA_AUTOSUSPEND_DELAY 500 /* milliseconds */ #define IPA_AUTOSUSPEND_DELAY 500 /* milliseconds */
/**
* struct ipa_interconnect - IPA interconnect information
* @path: Interconnect path
* @average_bandwidth: Average interconnect bandwidth (KB/second)
* @peak_bandwidth: Peak interconnect bandwidth (KB/second)
*/
struct ipa_interconnect {
struct icc_path *path;
u32 average_bandwidth;
u32 peak_bandwidth;
};
/** /**
* enum ipa_power_flag - IPA power flags * enum ipa_power_flag - IPA power flags
* @IPA_POWER_FLAG_RESUMED: Whether resume from suspend has been signaled * @IPA_POWER_FLAG_RESUMED: Whether resume from suspend has been signaled
...@@ -79,11 +67,11 @@ struct ipa_power { ...@@ -79,11 +67,11 @@ struct ipa_power {
spinlock_t spinlock; /* used with STOPPED/STARTED power flags */ spinlock_t spinlock; /* used with STOPPED/STARTED power flags */
DECLARE_BITMAP(flags, IPA_POWER_FLAG_COUNT); DECLARE_BITMAP(flags, IPA_POWER_FLAG_COUNT);
u32 interconnect_count; u32 interconnect_count;
struct ipa_interconnect *interconnect; struct icc_bulk_data *interconnect;
}; };
static int ipa_interconnect_init_one(struct device *dev, static int ipa_interconnect_init_one(struct device *dev,
struct ipa_interconnect *interconnect, struct icc_bulk_data *interconnect,
const struct ipa_interconnect_data *data) const struct ipa_interconnect_data *data)
{ {
struct icc_path *path; struct icc_path *path;
...@@ -99,13 +87,14 @@ static int ipa_interconnect_init_one(struct device *dev, ...@@ -99,13 +87,14 @@ static int ipa_interconnect_init_one(struct device *dev,
} }
interconnect->path = path; interconnect->path = path;
interconnect->average_bandwidth = data->average_bandwidth; interconnect->name = data->name;
interconnect->peak_bandwidth = data->peak_bandwidth; interconnect->avg_bw = data->average_bandwidth;
interconnect->peak_bw = data->peak_bandwidth;
return 0; return 0;
} }
static void ipa_interconnect_exit_one(struct ipa_interconnect *interconnect) static void ipa_interconnect_exit_one(struct icc_bulk_data *interconnect)
{ {
icc_put(interconnect->path); icc_put(interconnect->path);
memset(interconnect, 0, sizeof(*interconnect)); memset(interconnect, 0, sizeof(*interconnect));
...@@ -115,7 +104,7 @@ static void ipa_interconnect_exit_one(struct ipa_interconnect *interconnect) ...@@ -115,7 +104,7 @@ static void ipa_interconnect_exit_one(struct ipa_interconnect *interconnect)
static int ipa_interconnect_init(struct ipa_power *power, struct device *dev, static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
const struct ipa_interconnect_data *data) const struct ipa_interconnect_data *data)
{ {
struct ipa_interconnect *interconnect; struct icc_bulk_data *interconnect;
u32 count; u32 count;
int ret; int ret;
...@@ -146,7 +135,7 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev, ...@@ -146,7 +135,7 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
/* Inverse of ipa_interconnect_init() */ /* Inverse of ipa_interconnect_init() */
static void ipa_interconnect_exit(struct ipa_power *power) static void ipa_interconnect_exit(struct ipa_power *power)
{ {
struct ipa_interconnect *interconnect; struct icc_bulk_data *interconnect;
interconnect = power->interconnect + power->interconnect_count; interconnect = power->interconnect + power->interconnect_count;
while (interconnect-- > power->interconnect) while (interconnect-- > power->interconnect)
...@@ -158,7 +147,7 @@ static void ipa_interconnect_exit(struct ipa_power *power) ...@@ -158,7 +147,7 @@ static void ipa_interconnect_exit(struct ipa_power *power)
/* Currently we only use one bandwidth level, so just "enable" interconnects */ /* Currently we only use one bandwidth level, so just "enable" interconnects */
static int ipa_interconnect_enable(struct ipa *ipa) static int ipa_interconnect_enable(struct ipa *ipa)
{ {
struct ipa_interconnect *interconnect; struct icc_bulk_data *interconnect;
struct ipa_power *power = ipa->power; struct ipa_power *power = ipa->power;
int ret; int ret;
u32 i; u32 i;
...@@ -166,12 +155,12 @@ static int ipa_interconnect_enable(struct ipa *ipa) ...@@ -166,12 +155,12 @@ static int ipa_interconnect_enable(struct ipa *ipa)
interconnect = power->interconnect; interconnect = power->interconnect;
for (i = 0; i < power->interconnect_count; i++) { for (i = 0; i < power->interconnect_count; i++) {
ret = icc_set_bw(interconnect->path, ret = icc_set_bw(interconnect->path,
interconnect->average_bandwidth, interconnect->avg_bw,
interconnect->peak_bandwidth); interconnect->peak_bw);
if (ret) { if (ret) {
dev_err(&ipa->pdev->dev, dev_err(&ipa->pdev->dev,
"error %d enabling %s interconnect\n", "error %d enabling %s interconnect\n",
ret, icc_get_name(interconnect->path)); ret, interconnect->name);
goto out_unwind; goto out_unwind;
} }
interconnect++; interconnect++;
...@@ -189,9 +178,9 @@ static int ipa_interconnect_enable(struct ipa *ipa) ...@@ -189,9 +178,9 @@ static int ipa_interconnect_enable(struct ipa *ipa)
/* To disable an interconnect, we just its bandwidth to 0 */ /* To disable an interconnect, we just its bandwidth to 0 */
static int ipa_interconnect_disable(struct ipa *ipa) static int ipa_interconnect_disable(struct ipa *ipa)
{ {
struct ipa_interconnect *interconnect;
struct ipa_power *power = ipa->power; struct ipa_power *power = ipa->power;
struct device *dev = &ipa->pdev->dev; struct device *dev = &ipa->pdev->dev;
struct icc_bulk_data *interconnect;
int result = 0; int result = 0;
u32 count; u32 count;
int ret; int ret;
...@@ -203,7 +192,7 @@ static int ipa_interconnect_disable(struct ipa *ipa) ...@@ -203,7 +192,7 @@ static int ipa_interconnect_disable(struct ipa *ipa)
ret = icc_set_bw(interconnect->path, 0, 0); ret = icc_set_bw(interconnect->path, 0, 0);
if (ret) { if (ret) {
dev_err(dev, "error %d disabling %s interconnect\n", dev_err(dev, "error %d disabling %s interconnect\n",
ret, icc_get_name(interconnect->path)); ret, interconnect->name);
/* Try to disable all; record only the first error */ /* Try to disable all; record only the first error */
if (!result) if (!result)
result = ret; result = ret;
......
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