All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Anderson <dianders@chromium.org>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>,
	Sai Prakash Ranjan <quic_saipraka@quicinc.com>,
	Aniket Randive <quic_arandive@quicinc.com>,
	linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty: serial: qcom_geni: avoid duplicate struct member init
Date: Thu, 15 Dec 2022 12:46:51 -0800	[thread overview]
Message-ID: <CAD=FV=U6pfSk0nY+s-p4f43Gq6-arfr8hQe8d9NC0nS0ckMYKw@mail.gmail.com> (raw)
In-Reply-To: <20221215165453.1864836-1-arnd@kernel.org>

Hi,

On Thu, Dec 15, 2022 at 8:55 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> When -Woverride-init is enabled in a build, gcc points out that
> qcom_geni_serial_pm_ops contains conflicting initializers:
>
> drivers/tty/serial/qcom_geni_serial.c:1586:20: error: initialized field overwritten [-Werror=override-init]
>  1586 |         .restore = qcom_geni_serial_sys_hib_resume,
>       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/tty/serial/qcom_geni_serial.c:1586:20: note: (near initialization for 'qcom_geni_serial_pm_ops.restore')
> drivers/tty/serial/qcom_geni_serial.c:1587:17: error: initialized field overwritten [-Werror=override-init]
>  1587 |         .thaw = qcom_geni_serial_sys_hib_resume,
>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Open-code the initializers with the version that was already used,
> and use the pm_sleep_ptr() method to deal with unused ones,
> in place of the __maybe_unused annotation.
>
> Fixes: 35781d8356a2 ("tty: serial: qcom-geni-serial: Add support for Hibernation feature")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/tty/serial/qcom_geni_serial.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index b487823f0e61..03dda47184d9 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -1516,7 +1516,7 @@ static int qcom_geni_serial_remove(struct platform_device *pdev)
>         return 0;
>  }
>
> -static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev)
> +static int qcom_geni_serial_sys_suspend(struct device *dev)

Officially the removal of "__maybe_unused" could be a totally
different patch, right? SET_SYSTEM_SLEEP_PM_OPS() already eventually
used pm_sleep_ptr() even without your change, so the removal of these
tags is unrelated to the rest of your change, right?


>  {
>         struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
>         struct uart_port *uport = &port->uport;
> @@ -1533,7 +1533,7 @@ static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev)
>         return uart_suspend_port(private_data->drv, uport);
>  }
>
> -static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev)
> +static int qcom_geni_serial_sys_resume(struct device *dev)
>  {
>         int ret;
>         struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
> @@ -1581,10 +1581,12 @@ static int qcom_geni_serial_sys_hib_resume(struct device *dev)
>  }
>
>  static const struct dev_pm_ops qcom_geni_serial_pm_ops = {
> -       SET_SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend,
> -                                       qcom_geni_serial_sys_resume)
> -       .restore = qcom_geni_serial_sys_hib_resume,
> -       .thaw = qcom_geni_serial_sys_hib_resume,
> +       .suspend = pm_sleep_ptr(qcom_geni_serial_sys_suspend),
> +       .resume = pm_sleep_ptr(qcom_geni_serial_sys_resume),
> +       .freeze = pm_sleep_ptr(qcom_geni_serial_sys_suspend),
> +       .poweroff = pm_sleep_ptr(qcom_geni_serial_sys_suspend),
> +       .restore = pm_sleep_ptr(qcom_geni_serial_sys_hib_resume),
> +       .thaw = pm_sleep_ptr(qcom_geni_serial_sys_hib_resume),

Personally, the order you listed them is less intuitive than the order
that SET_SYSTEM_SLEEP_PM_OPS() lists functions. IMO it's better to
consistently alternate matching suspend/resume functions. ;-)

Both of those are nits, so I'm also fine with:

Reviewed-by: Douglas Anderson <dianders@chromium.org>

  reply	other threads:[~2022-12-15 20:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 16:54 [PATCH] tty: serial: qcom_geni: avoid duplicate struct member init Arnd Bergmann
2022-12-15 20:46 ` Doug Anderson [this message]
2022-12-16 10:03   ` Arnd Bergmann
2022-12-16 15:21     ` Doug Anderson

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='CAD=FV=U6pfSk0nY+s-p4f43Gq6-arfr8hQe8d9NC0nS0ckMYKw@mail.gmail.com' \
    --to=dianders@chromium.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=quic_arandive@quicinc.com \
    --cc=quic_saipraka@quicinc.com \
    --cc=quic_vnivarth@quicinc.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.