Skip to content

Commit 5342ab0

Browse files
arndbgregkh
authored andcommitted
tty: serial: qcom_geni: avoid duplicate struct member init
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: 35781d8 ("tty: serial: qcom-geni-serial: Add support for Hibernation feature") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Douglas Anderson <dianders@chromium.org> Link: https://lore.kernel.org/r/20221215165453.1864836-1-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5bfdd3c commit 5342ab0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/tty/serial/qcom_geni_serial.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,7 @@ static int qcom_geni_serial_remove(struct platform_device *pdev)
15301530
return 0;
15311531
}
15321532

1533-
static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev)
1533+
static int qcom_geni_serial_sys_suspend(struct device *dev)
15341534
{
15351535
struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
15361536
struct uart_port *uport = &port->uport;
@@ -1547,7 +1547,7 @@ static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev)
15471547
return uart_suspend_port(private_data->drv, uport);
15481548
}
15491549

1550-
static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev)
1550+
static int qcom_geni_serial_sys_resume(struct device *dev)
15511551
{
15521552
int ret;
15531553
struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
@@ -1595,10 +1595,12 @@ static int qcom_geni_serial_sys_hib_resume(struct device *dev)
15951595
}
15961596

15971597
static const struct dev_pm_ops qcom_geni_serial_pm_ops = {
1598-
SET_SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend,
1599-
qcom_geni_serial_sys_resume)
1600-
.restore = qcom_geni_serial_sys_hib_resume,
1601-
.thaw = qcom_geni_serial_sys_hib_resume,
1598+
.suspend = pm_sleep_ptr(qcom_geni_serial_sys_suspend),
1599+
.resume = pm_sleep_ptr(qcom_geni_serial_sys_resume),
1600+
.freeze = pm_sleep_ptr(qcom_geni_serial_sys_suspend),
1601+
.poweroff = pm_sleep_ptr(qcom_geni_serial_sys_suspend),
1602+
.restore = pm_sleep_ptr(qcom_geni_serial_sys_hib_resume),
1603+
.thaw = pm_sleep_ptr(qcom_geni_serial_sys_hib_resume),
16021604
};
16031605

16041606
static const struct of_device_id qcom_geni_serial_match_table[] = {

0 commit comments

Comments
 (0)