Re: [PATCH v4 1/4] kdb: Rename struct defcmd_set to struct kdb_macro_t
From: Doug Anderson
Date: Fri Jul 09 2021 - 17:37:16 EST
Hi,
On Fri, Jul 9, 2021 at 3:43 AM Sumit Garg <sumit.garg@xxxxxxxxxx> wrote:
>
> as that sounds more appropriate given its purpose.
nit: Personally I prefer this to be a whole sentence that isn't just a
continuation of the patch subject.
> Signed-off-by: Sumit Garg <sumit.garg@xxxxxxxxxx>
> ---
> kernel/debug/kdb/kdb_main.c | 38 ++++++++++++++++++-------------------
> 1 file changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> index d8ee5647b732..d4897fbc9d2e 100644
> --- a/kernel/debug/kdb/kdb_main.c
> +++ b/kernel/debug/kdb/kdb_main.c
> @@ -654,7 +654,7 @@ static void kdb_cmderror(int diag)
> * Returns:
> * zero for success, a kdb diagnostic if error
> */
> -struct defcmd_set {
> +struct kdb_macro_t {
Why the "_t" at the end? To me that implies that this is a typedef, so
you'd declare a variable of this as:
kdb_macro_t my_macro;
...instead of:
struct kdb_macro_t my_macro;
Not that I'm suggesting adding a typedef for this structure. It seems
kernel convention is not to do typedefs for structures unless there's
a strong reason to. Rather, I'm just suggesting removing the "_t" from
the end.
> @@ -671,7 +671,7 @@ static int kdb_exec_defcmd(int argc, const char **argv);
>
> static int kdb_defcmd2(const char *cmdstr, const char *argv0)
> {
> - struct defcmd_set *s = defcmd_set + defcmd_set_count - 1;
> + struct kdb_macro_t *s = kdb_macro + kdb_macro_count - 1;
I guess the variable "s" was short for "set". Should it change to "m"
? Here and in other places below.
> @@ -727,13 +727,13 @@ static int kdb_defcmd(int argc, const char **argv)
> kdb_printf("Command only available during kdb_init()\n");
> return KDB_NOTIMP;
> }
> - defcmd_set = kmalloc_array(defcmd_set_count + 1, sizeof(*defcmd_set),
> + kdb_macro = kmalloc_array(kdb_macro_count + 1, sizeof(*kdb_macro),
> GFP_KDB);
nit: the indentation is now off for the GFP_KDB since you changed the
length of the previous line.
Sorry for not noticing those things in the previous version. I guess
having this part of the change split out really did make it easier to
review! ;-) Those are all pretty much just nits, so if they're fixed
feel free to add my Reviewed-by tag.