[PATCH 6/7] Point tail_blk_ctl to the first node

YanBo dreamfly281 at gmail.com
Tue May 28 12:38:12 EDT 2013


On Tue, May 28, 2013 at 10:59 PM, Pontus Fuchs <pontus.fuchs at gmail.com> wrote:
> Commit d8d5445d moved assignment of tail_blk_ctl to point to the last
> allocated node. This is incorrect as it should point to the first
> unused node.
>
> wcn36xx_dxe_free_ctl_block needs to be updated to reflect this change.
> Simplify it while at it.
>
> Signed-off-by: Pontus Fuchs <pontus.fuchs at gmail.com>
> ---
>  dxe.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/dxe.c b/dxe.c
> index a4780fe..0da108e 100644
> --- a/dxe.c
> +++ b/dxe.c
> @@ -53,9 +53,9 @@ static int wcn36xx_dxe_allocate_ctl_block(struct wcn36xx_dxe_ch *ch)
>                 }
>                 cur_dxe_ctl->ctl_blk_order = i;
>
> -               ch->tail_blk_ctl = cur_dxe_ctl;
>                 if (i == 0) {
>                         ch->head_blk_ctl = cur_dxe_ctl;
> +                       ch->tail_blk_ctl = cur_dxe_ctl;
>                 } else if (ch->desc_num - 1 == i){
>                         prev_dxe_ctl->next = cur_dxe_ctl;
>                         cur_dxe_ctl->next = ch->head_blk_ctl;
> @@ -69,13 +69,13 @@ static int wcn36xx_dxe_allocate_ctl_block(struct wcn36xx_dxe_ch *ch)
>
>  static void wcn36xx_dxe_free_ctl_block(struct wcn36xx_dxe_ch *ch)
>  {
> -       struct wcn36xx_dxe_ctl *cur_dxe_ctl = ch->head_blk_ctl, *next;
> -       while (1) {
> -               next = cur_dxe_ctl->next;
> -               kfree(cur_dxe_ctl);
> -               if (ch->tail_blk_ctl == cur_dxe_ctl)
> -                       break;
> -               cur_dxe_ctl = next;
> +       struct wcn36xx_dxe_ctl *cur = ch->head_blk_ctl, *next;
> +       int i;
> +
> +       for (i = 0; i < ch->desc_num; i++) {
> +               next = cur->next;

@keugene, there is a question about currently list implantation in the code,
s kernel has standard list implementation which is compatible and very
flexible, why we implement the wcn36xx_dxe_ctl
list again?

BR /Yanbo
> +               kfree(cur);
> +               cur = next;
>         }
>  }
>
> --
> 1.8.1.2
>
>
> _______________________________________________
> wcn36xx mailing list
> wcn36xx at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/wcn36xx



More information about the wcn36xx mailing list