[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7a1e8afa-5b01-4081-9961-18c6e4b00be4@redhat.com>
Date: Wed, 6 Sep 2023 12:50:07 +0200
From: Michal Schmidt <mschmidt@...hat.com>
To: Junfeng Guo <junfeng.guo@...el.com>, intel-wired-lan@...ts.osuosl.org
Cc: ivecera@...hat.com, netdev@...r.kernel.org, qi.z.zhang@...el.com,
jesse.brandeburg@...el.com, edumazet@...gle.com, anthony.l.nguyen@...el.com,
horms@...nel.org, kuba@...nel.org, pabeni@...hat.com, davem@...emloft.net
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v9 02/15] ice: init imem table
for parser
Dne 04. 09. 23 v 4:14 Junfeng Guo napsal(a):
> diff --git a/drivers/net/ethernet/intel/ice/ice_imem.c b/drivers/net/ethernet/intel/ice/ice_imem.c
> new file mode 100644
> index 000000000000..005e04947626
> --- /dev/null
> +++ b/drivers/net/ethernet/intel/ice/ice_imem.c
> @@ -0,0 +1,324 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (C) 2023 Intel Corporation */
> +
> +#include "ice_common.h"
> +#include "ice_parser_util.h"
> +
> +static void _ice_imem_bst_bm_dump(struct ice_hw *hw, struct ice_bst_main *bm)
You have a lot of functions whose names start with an underscore. It's
unusual. If it's to indicate that they're only to be used from the
current source file, it's already implied by them being defined as static.
[...]
> diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c b/drivers/net/ethernet/intel/ice/ice_parser.c
> index 747dfad66db2..dd089c859616 100644
> --- a/drivers/net/ethernet/intel/ice/ice_parser.c
> +++ b/drivers/net/ethernet/intel/ice/ice_parser.c
[...]
> +/**
> + * ice_parser_create_table - create a item table from a section
> + * @hw: pointer to the hardware structure
> + * @sect_type: section type
> + * @item_size: item size in byte
> + * @length: number of items in the table to create
> + * @item_get: the function will be parsed to ice_pkg_enum_entry
> + * @parse_item: the function to parse the item
> + */
> +void *ice_parser_create_table(struct ice_hw *hw, u32 sect_type,
> + u32 item_size, u32 length,
> + void *(*item_get)(u32 sect_type, void *section,
> + u32 index, u32 *offset),
> + void (*parse_item)(struct ice_hw *hw, u16 idx,
> + void *item, void *data,
> + int size))
> +{
> + struct ice_seg *seg = hw->seg;
> + struct ice_pkg_enum state;
> + u16 idx = U16_MAX;
> + void *table;
> + void *data;
> +
> + if (!seg)
> + return NULL;
> +
> + table = devm_kzalloc(ice_hw_to_dev(hw), item_size * length,
> + GFP_KERNEL);
Use devm_kcalloc.
Michal
Powered by blists - more mailing lists