net: mvpp2: Make mvpp2_prs_hw_read a parser entry init function
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Mon, 26 Mar 2018 13:34:22 +0000 (15:34 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Mar 2018 14:47:23 +0000 (10:47 -0400)
commit47e0e14eb1a688c0868385e02db263093d2df6db
treeadab81de2ba1e9f00825c9d946fe085bf9b63226
parent8daf1a2d7e40685054ebae680733d822ced6df62
net: mvpp2: Make mvpp2_prs_hw_read a parser entry init function

The mvpp2_prs_hw_read function uses the 'index' field of the struct
mvpp2_prs_entry to initialize the rest of the fields. This makes it
unclear from a caller's perspective, who needs to manipulate a struct
that is not entirely initialized.

This commit makes it an init function for prs_entry, by passing it the
index as a parameter. The function now zeroes the entry, and sets the
index field before doing all other init from HW.

The function is renamed 'mvpp2_prs_init_from_hw' to make that clear.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvpp2.c