lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 27 Apr 2023 15:16:23 -0700
From:   Doug Berger <opendmb@...il.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:     Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>,
        Gergo Koteles <soyer@....hu>,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Hans de Goede <hdegoede@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Kees Cook <keescook@...omium.org>,
        Kishon Vijay Abraham I <kishon@...com>,
        Saravana Kannan <saravanak@...gle.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        linux-kernel@...r.kernel.org, linux-input@...r.kernel.org,
        Doug Berger <opendmb@...il.com>
Subject: [RFC PATCH 1/3] input: gpio-keys - use device_pm_move_to_tail

The gpio-keys device driver implements the functionality of its
child nodes which do not receive dedicated drivers. This means
it should inherit the dependencies of these child nodes and
their effects on suspend/resume and shutdown order.

This commit exposes the device_pm_move_to_tail function to
allow the driver to move itself to the end of the lists upon a
successful probe to allow proper sequencing when other methods
are not available.

Fixes: 722e5f2b1eec ("driver core: Partially revert "driver core: correct device's shutdown order"")
Signed-off-by: Doug Berger <opendmb@...il.com>
---
 drivers/base/core.c                | 1 +
 drivers/input/keyboard/gpio_keys.c | 2 ++
 include/linux/device.h             | 1 +
 3 files changed, 4 insertions(+)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 6878dfcbf0d6..8385df4d9677 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -428,6 +428,7 @@ void device_pm_move_to_tail(struct device *dev)
 	device_pm_unlock();
 	device_links_read_unlock(idx);
 }
+EXPORT_SYMBOL_GPL(device_pm_move_to_tail);
 
 #define to_devlink(dev)	container_of((dev), struct device_link, link_dev)
 
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index c42f86ad0766..0516c6279d8a 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -810,6 +810,8 @@ static int gpio_keys_probe(struct platform_device *pdev)
 	int i, error;
 	int wakeup = 0;
 
+	device_pm_move_to_tail(dev);
+
 	if (!pdata) {
 		pdata = gpio_keys_get_devtree_pdata(dev);
 		if (IS_ERR(pdata))
diff --git a/include/linux/device.h b/include/linux/device.h
index 1508e637bb26..dad40bd45509 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1082,6 +1082,7 @@ void device_link_del(struct device_link *link);
 void device_link_remove(void *consumer, struct device *supplier);
 void device_links_supplier_sync_state_pause(void);
 void device_links_supplier_sync_state_resume(void);
+void device_pm_move_to_tail(struct device *dev);
 
 extern __printf(3, 4)
 int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ