diff mbox series

[net-next,3/5] net: ipa: have gsi_channel_update() return a value

Message ID 20210120220401.10713-4-elder@linaro.org (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: ipa: NAPI poll updates | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 37 lines checked
netdev/build_allmodconfig_warn fail Errors and warnings before: 2 this patch: 4
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Alex Elder Jan. 20, 2021, 10:03 p.m. UTC
Have gsi_channel_update() return the first transaction in the
updated completed transaction list, or NULL if no new transactions
have been added.

Signed-off-by: Alex Elder <elder@linaro.org>
---
 drivers/net/ipa/gsi.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Jakub Kicinski Jan. 21, 2021, 5:35 a.m. UTC | #1
On Wed, 20 Jan 2021 16:03:59 -0600 Alex Elder wrote:
> Have gsi_channel_update() return the first transaction in the
> updated completed transaction list, or NULL if no new transactions
> have been added.
> 
> Signed-off-by: Alex Elder <elder@linaro.org>

> @@ -1452,7 +1452,7 @@ void gsi_channel_doorbell(struct gsi_channel *channel)
>  }
>  
>  /* Consult hardware, move any newly completed transactions to completed list */
> -static void gsi_channel_update(struct gsi_channel *channel)
> +struct gsi_trans *gsi_channel_update(struct gsi_channel *channel)

Why did it lose the 'static'?

drivers/net/ipa/gsi.c:1455:19: warning: no previous prototype for ‘gsi_channel_update’ [-Wmissing-prototypes]
 1455 | struct gsi_trans *gsi_channel_update(struct gsi_channel *channel)
      |                   ^~~~~~~~~~~~~~~~~~
Alex Elder Jan. 21, 2021, 11:34 a.m. UTC | #2
On 1/20/21 11:35 PM, Jakub Kicinski wrote:
> On Wed, 20 Jan 2021 16:03:59 -0600 Alex Elder wrote:
>> Have gsi_channel_update() return the first transaction in the
>> updated completed transaction list, or NULL if no new transactions
>> have been added.
>>
>> Signed-off-by: Alex Elder <elder@linaro.org>
> 
>> @@ -1452,7 +1452,7 @@ void gsi_channel_doorbell(struct gsi_channel *channel)
>>   }
>>   
>>   /* Consult hardware, move any newly completed transactions to completed list */
>> -static void gsi_channel_update(struct gsi_channel *channel)
>> +struct gsi_trans *gsi_channel_update(struct gsi_channel *channel)
> 
> Why did it lose the 'static'?

It should not have.

My aarch64 build environment did not flag that, but I now built
for x86 and it does.  I guess I should make a habit of checking
with that, though it's a bit time-consuming.

I'll send v2 out shortly.  Thank you.

					-Alex

> drivers/net/ipa/gsi.c:1455:19: warning: no previous prototype for ‘gsi_channel_update’ [-Wmissing-prototypes]
>   1455 | struct gsi_trans *gsi_channel_update(struct gsi_channel *channel)
>        |                   ^~~~~~~~~~~~~~~~~~
>
diff mbox series

Patch

diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c
index 634f514e861e7..5b98003263710 100644
--- a/drivers/net/ipa/gsi.c
+++ b/drivers/net/ipa/gsi.c
@@ -1452,7 +1452,7 @@  void gsi_channel_doorbell(struct gsi_channel *channel)
 }
 
 /* Consult hardware, move any newly completed transactions to completed list */
-static void gsi_channel_update(struct gsi_channel *channel)
+struct gsi_trans *gsi_channel_update(struct gsi_channel *channel)
 {
 	u32 evt_ring_id = channel->evt_ring_id;
 	struct gsi *gsi = channel->gsi;
@@ -1471,7 +1471,7 @@  static void gsi_channel_update(struct gsi_channel *channel)
 	offset = GSI_EV_CH_E_CNTXT_4_OFFSET(evt_ring_id);
 	index = gsi_ring_index(ring, ioread32(gsi->virt + offset));
 	if (index == ring->index % ring->count)
-		return;
+		return NULL;
 
 	/* Get the transaction for the latest completed event.  Take a
 	 * reference to keep it from completing before we give the events
@@ -1496,6 +1496,8 @@  static void gsi_channel_update(struct gsi_channel *channel)
 	gsi_evt_ring_doorbell(channel->gsi, channel->evt_ring_id, index);
 
 	gsi_trans_free(trans);
+
+	return gsi_channel_trans_complete(channel);
 }
 
 /**
@@ -1516,11 +1518,8 @@  static struct gsi_trans *gsi_channel_poll_one(struct gsi_channel *channel)
 
 	/* Get the first transaction from the completed list */
 	trans = gsi_channel_trans_complete(channel);
-	if (!trans) {
-		/* List is empty; see if there's more to do */
-		gsi_channel_update(channel);
-		trans = gsi_channel_trans_complete(channel);
-	}
+	if (!trans)	/* List is empty; see if there's more to do */
+		trans = gsi_channel_update(channel);
 
 	if (trans)
 		gsi_trans_move_polled(trans);