LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Maximilian Luz <luzmaximilian@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Lee Jones <lee.jones@linaro.org>,
	Platform Driver <platform-driver-x86@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:SERIAL DRIVERS" <linux-serial@vger.kernel.org>,
	Mark Gross <mgross@linux.intel.com>,
	Rob Herring <robh@kernel.org>
Subject: Re: [PATCH v2 1/2] serdev: Split and export serdev_acpi_get_uart_resource()
Date: Thu, 5 Aug 2021 11:21:01 +0300	[thread overview]
Message-ID: <CAHp75VfSt=vibmiSEVP68UkAHmkDJ3tXt0W7yxmQ8UH-CTYCAA@mail.gmail.com> (raw)
In-Reply-To: <e34fdf56-4fdb-b422-17d6-0b35779e37b7@kernel.org>

On Thu, Aug 5, 2021 at 10:36 AM Jiri Slaby <jirislaby@kernel.org> wrote:
> On 04. 08. 21, 16:29, Andy Shevchenko wrote:

...

> > +/**
> > + * serdev_acpi_get_uart_resource - Gets UARTSerialBus resource if type matches
> > + * @ares:    ACPI resource
> > + * @uart:    Pointer to UARTSerialBus resource will be returned here
> > + *
> > + * Checks if the given ACPI resource is of type UARTSerialBus.
> > + * In this case, returns a pointer to it to the caller.
> > + *
> > + * Returns true if resource type is of UARTSerialBus, otherwise false.
>
> Better to write:
>   * Return: True if resource type is of UARTSerialBus, otherwise false.
> which is recognized by sphinx.

Will fix it in v3.

> > + */

...

> Why don't you return NULL, or sb, thus eliminating the parameter?

1. That's how other similar APIs are done.
2. It will save a line of code in the callers. Usual pattern
  if (...get_res(..., &sb))
   return ERR_or_so;

With your proposal

  sb = get_res(...);
  if (!sb)
    return ERR_or_so;

> > +}

-- 
With Best Regards,
Andy Shevchenko

      reply	other threads:[~2021-08-05  8:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04 14:29 Andy Shevchenko
2021-08-04 14:29 ` [PATCH v2 2/2] platform/surface: aggregator: Use serdev_acpi_get_uart_resource() helper Andy Shevchenko
2021-08-05  7:33 ` [PATCH v2 1/2] serdev: Split and export serdev_acpi_get_uart_resource() Jiri Slaby
2021-08-05  8:21   ` Andy Shevchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHp75VfSt=vibmiSEVP68UkAHmkDJ3tXt0W7yxmQ8UH-CTYCAA@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=jirislaby@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=luzmaximilian@gmail.com \
    --cc=mgross@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=robh@kernel.org \
    --subject='Re: [PATCH v2 1/2] serdev: Split and export serdev_acpi_get_uart_resource()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).