On 11/26/20 4:14 AM, Moshe Shemesh wrote:
> @@ -2975,17 +2996,93 @@ static int cmd_dev_param(struct dl *dl)
>       return -ENOENT;
>  }
>  
> -static void pr_out_dev(struct dl *dl, struct nlattr **tb)
> +static void pr_out_action_stats(struct dl *dl, struct nlattr *action_stats)
> +{
> +     struct nlattr *tb_stats_entry[DEVLINK_ATTR_MAX + 1] = {};
> +     struct nlattr *reload_stats_entry;
> +     enum devlink_reload_limit limit;
> +     uint32_t value;
> +     int err;
> +
> +     mnl_attr_for_each_nested(reload_stats_entry, action_stats) {
> +             err = mnl_attr_parse_nested(reload_stats_entry, attr_cb, 
> tb_stats_entry);

wrap lines at 80 columns unless it is a print statement.

> +             if (err != MNL_CB_OK)
> +                     return;
> +             if (!tb_stats_entry[DEVLINK_ATTR_RELOAD_STATS_LIMIT] ||
> +                 !tb_stats_entry[DEVLINK_ATTR_RELOAD_STATS_VALUE])
> +                     return;
> +
> +             check_indent_newline(dl);
> +             limit = 
> mnl_attr_get_u8(tb_stats_entry[DEVLINK_ATTR_RELOAD_STATS_LIMIT]);
> +             value = 
> mnl_attr_get_u32(tb_stats_entry[DEVLINK_ATTR_RELOAD_STATS_VALUE]);

Use temp variables for the attributes to make the code readable.

> +             print_uint_name_value(reload_limit_name(limit), value);
> +     }
> +}
> +

that applies to all of the patches.

Reply via email to