[PATCH net-next 3/3] pds_core: init viftype default in declaration

Shannon Nelson posted 3 patches 9 months, 2 weeks ago
[PATCH net-next 3/3] pds_core: init viftype default in declaration
Posted by Shannon Nelson 9 months, 2 weeks ago
Initialize the .enabled field of the FWCTL viftype default in
the declaration rather than as a bit of code as it is always
to be enabled and needs no logic around it.

Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
---
 drivers/net/ethernet/amd/pds_core/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/amd/pds_core/core.c b/drivers/net/ethernet/amd/pds_core/core.c
index 9512aa4083f0..223547e4077f 100644
--- a/drivers/net/ethernet/amd/pds_core/core.c
+++ b/drivers/net/ethernet/amd/pds_core/core.c
@@ -402,6 +402,7 @@ static int pdsc_core_init(struct pdsc *pdsc)
 
 static struct pdsc_viftype pdsc_viftype_defaults[] = {
 	[PDS_DEV_TYPE_FWCTL] = { .name = PDS_DEV_TYPE_FWCTL_STR,
+				 .enabled = true,
 				 .vif_id = PDS_DEV_TYPE_FWCTL,
 				 .dl_id = -1 },
 	[PDS_DEV_TYPE_VDPA] = { .name = PDS_DEV_TYPE_VDPA_STR,
@@ -431,9 +432,6 @@ static int pdsc_viftypes_init(struct pdsc *pdsc)
 		/* See what the Core device has for support */
 		vt_support = !!le16_to_cpu(pdsc->dev_ident.vif_types[vt]);
 
-		if (vt == PDS_DEV_TYPE_FWCTL)
-			pdsc->viftype_status[vt].enabled = true;
-
 		dev_dbg(pdsc->dev, "VIF %s is %ssupported\n",
 			pdsc->viftype_status[vt].name,
 			vt_support ? "" : "not ");
-- 
2.17.1
Re: [PATCH net-next 3/3] pds_core: init viftype default in declaration
Posted by Simon Horman 9 months, 2 weeks ago
On Fri, Apr 25, 2025 at 01:46:18PM -0700, Shannon Nelson wrote:
> Initialize the .enabled field of the FWCTL viftype default in
> the declaration rather than as a bit of code as it is always
> to be enabled and needs no logic around it.
> 
> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>

Thanks, this looks like a nice clean-up to me.

Reviewed-by: Simon Horman <horms@kernel.org>