Re: [PATCH 10/12] docs: kdoc: directly access the always-there KdocItem fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em Wed,  2 Jul 2025 16:35:22 -0600
Jonathan Corbet <corbet@xxxxxxx> escreveu:

> They are part of the interface, so use them directly.  This allows the
> removal of the transitional __dict__ hack in KdocItem.
> 
> Signed-off-by: Jonathan Corbet <corbet@xxxxxxx>

LGTM.
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>

> ---
>  scripts/lib/kdoc/kdoc_item.py   |  5 +----
>  scripts/lib/kdoc/kdoc_output.py | 16 +++++++---------
>  2 files changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/scripts/lib/kdoc/kdoc_item.py b/scripts/lib/kdoc/kdoc_item.py
> index 51e8669b9a6e..807290678984 100644
> --- a/scripts/lib/kdoc/kdoc_item.py
> +++ b/scripts/lib/kdoc/kdoc_item.py
> @@ -20,10 +20,7 @@ class KdocItem:
>          self.other_stuff = other_stuff
>  
>      def get(self, key, default = None):
> -        ret = self.other_stuff.get(key, default)
> -        if ret == default:
> -            return self.__dict__.get(key, default)
> -        return ret
> +        return self.other_stuff.get(key, default)
>  
>      def __getitem__(self, key):
>          return self.get(key)
> diff --git a/scripts/lib/kdoc/kdoc_output.py b/scripts/lib/kdoc/kdoc_output.py
> index 8a31b637ffd2..ea8914537ba0 100644
> --- a/scripts/lib/kdoc/kdoc_output.py
> +++ b/scripts/lib/kdoc/kdoc_output.py
> @@ -124,9 +124,7 @@ class OutputFormat:
>          Output warnings for identifiers that will be displayed.
>          """
>  
> -        warnings = args.get('warnings', [])
> -
> -        for log_msg in warnings:
> +        for log_msg in args.warnings:
>              self.config.warning(log_msg)
>  
>      def check_doc(self, name, args):
> @@ -184,7 +182,7 @@ class OutputFormat:
>  
>          self.data = ""
>  
> -        dtype = args.get('type', "")
> +        dtype = args.type
>  
>          if dtype == "doc":
>              self.out_doc(fname, name, args)
> @@ -373,7 +371,7 @@ class RestFormat(OutputFormat):
>                  signature = args['functiontype'] + " "
>              signature += name + " ("
>  
> -        ln = args.get('declaration_start_line', 0)
> +        ln = args.declaration_start_line
>          count = 0
>          for parameter in args.parameterlist:
>              if count != 0:
> @@ -445,7 +443,7 @@ class RestFormat(OutputFormat):
>      def out_enum(self, fname, name, args):
>  
>          oldprefix = self.lineprefix
> -        ln = args.get('declaration_start_line', 0)
> +        ln = args.declaration_start_line
>  
>          self.data += f"\n\n.. c:enum:: {name}\n\n"
>  
> @@ -474,7 +472,7 @@ class RestFormat(OutputFormat):
>      def out_typedef(self, fname, name, args):
>  
>          oldprefix = self.lineprefix
> -        ln = args.get('declaration_start_line', 0)
> +        ln = args.declaration_start_line
>  
>          self.data += f"\n\n.. c:type:: {name}\n\n"
>  
> @@ -492,8 +490,8 @@ class RestFormat(OutputFormat):
>  
>          purpose = args.get('purpose', "")
>          declaration = args.get('definition', "")
> -        dtype = args.get('type', "struct")
> -        ln = args.get('declaration_start_line', 0)
> +        dtype = args.type
> +        ln = args.declaration_start_line
>  
>          self.data += f"\n\n.. c:{dtype}:: {name}\n\n"
>  



Thanks,
Mauro




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux