Skip to content

Commit 4a4ba48

Browse files
Alex Elderdavem330
authored andcommitted
net: ipa: move version check for channel suspend/resume
Change the Boolean flags passed to __gsi_channel_start() and __gsi_channel_stop() so they represent whether the request is being made to implement suspend (versus stop) or resume (versus start). Then stop or start the channel for suspend/resume requests only if the hardware version indicates it should be done. Signed-off-by: Alex Elder <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent decfef0 commit 4a4ba48

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/net/ipa/gsi.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -920,12 +920,13 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell)
920920
/* All done! */
921921
}
922922

923-
static int __gsi_channel_start(struct gsi_channel *channel, bool start)
923+
static int __gsi_channel_start(struct gsi_channel *channel, bool resume)
924924
{
925925
struct gsi *gsi = channel->gsi;
926926
int ret;
927927

928-
if (!start)
928+
/* Prior to IPA v4.0 suspend/resume is not implemented by GSI */
929+
if (resume && gsi->version < IPA_VERSION_4_0)
929930
return 0;
930931

931932
mutex_lock(&gsi->mutex);
@@ -947,7 +948,7 @@ int gsi_channel_start(struct gsi *gsi, u32 channel_id)
947948
napi_enable(&channel->napi);
948949
gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id);
949950

950-
ret = __gsi_channel_start(channel, true);
951+
ret = __gsi_channel_start(channel, false);
951952
if (ret) {
952953
gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
953954
napi_disable(&channel->napi);
@@ -971,15 +972,16 @@ static int gsi_channel_stop_retry(struct gsi_channel *channel)
971972
return ret;
972973
}
973974

974-
static int __gsi_channel_stop(struct gsi_channel *channel, bool stop)
975+
static int __gsi_channel_stop(struct gsi_channel *channel, bool suspend)
975976
{
976977
struct gsi *gsi = channel->gsi;
977978
int ret;
978979

979980
/* Wait for any underway transactions to complete before stopping. */
980981
gsi_channel_trans_quiesce(channel);
981982

982-
if (!stop)
983+
/* Prior to IPA v4.0 suspend/resume is not implemented by GSI */
984+
if (suspend && gsi->version < IPA_VERSION_4_0)
983985
return 0;
984986

985987
mutex_lock(&gsi->mutex);
@@ -997,7 +999,7 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id)
997999
struct gsi_channel *channel = &gsi->channel[channel_id];
9981000
int ret;
9991001

1000-
ret = __gsi_channel_stop(channel, true);
1002+
ret = __gsi_channel_stop(channel, false);
10011003
if (ret)
10021004
return ret;
10031005

@@ -1032,8 +1034,7 @@ int gsi_channel_suspend(struct gsi *gsi, u32 channel_id)
10321034
struct gsi_channel *channel = &gsi->channel[channel_id];
10331035
int ret;
10341036

1035-
/* Prior to IPA v4.0 suspend/resume is not implemented by GSI */
1036-
ret = __gsi_channel_stop(channel, gsi->version >= IPA_VERSION_4_0);
1037+
ret = __gsi_channel_stop(channel, true);
10371038
if (ret)
10381039
return ret;
10391040

@@ -1048,8 +1049,7 @@ int gsi_channel_resume(struct gsi *gsi, u32 channel_id)
10481049
{
10491050
struct gsi_channel *channel = &gsi->channel[channel_id];
10501051

1051-
/* Prior to IPA v4.0 suspend/resume is not implemented by GSI */
1052-
return __gsi_channel_start(channel, gsi->version >= IPA_VERSION_4_0);
1052+
return __gsi_channel_start(channel, true);
10531053
}
10541054

10551055
/**

0 commit comments

Comments
 (0)