Re: [PATCH net-next v2 3/6] bnxt_en: Make a lookup table for supported aux bus devices
From: Jonathan Cameron <jonathan.cameron@huawei.com>
Date: 2025-09-23 10:49:39
On Tue, 23 Sep 2025 02:58:22 -0700 Pavan Chebbi [off-list ref] wrote:
We could maintain a look up table of aux bus devices supported by bnxt. This way, the aux bus init/add/uninit/del could have generic code to work on any of bnxt's aux devices. Reviewed-by: Andy Gospodarek <redacted> Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Ah. Ok. This does make it more generic. Smash this and patch 2 together so we don't have the intermediate state where stuff is partly generic. Key is perhaps to remember that reviewers almost always end up looking at patches in isolation before they look at the overall result. Jonathan
quoted hunk ↗ jump to hunk
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 105 ++++++++++++++++-- 1 file changed, 93 insertions(+), 12 deletions(-)diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c index 665850753f90..ecad1947ccb5 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c@@ -29,6 +29,70 @@ static DEFINE_IDA(bnxt_rdma_aux_dev_ids); +struct bnxt_aux_device { + const char *name; + const u32 id; + u32 (*alloc_ida)(void); + void (*free_ida)(struct bnxt_aux_priv *priv); + void (*release)(struct device *dev); + void (*set_priv)(struct bnxt *bp, struct bnxt_aux_priv *priv); + struct bnxt_aux_priv *(*get_priv)(struct bnxt *bp); + void (*set_edev)(struct bnxt *bp, struct bnxt_en_dev *edev); + struct bnxt_en_dev *(*get_edev)(struct bnxt *bp); + struct auxiliary_device *(*get_auxdev)(struct bnxt *bp); +};