linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix serdev bind/unbind
@ 2022-01-18 19:48 julian schroeder
  2022-01-19 17:05 ` Rob Herring
  2022-01-21 17:22 ` Andy Shevchenko
  0 siblings, 2 replies; 4+ messages in thread
From: julian schroeder @ 2022-01-18 19:48 UTC (permalink / raw)
  To: robh
  Cc: bhanumaiya, julian schroeder, Greg Kroah-Hartman, Jiri Slaby,
	linux-serial, linux-kernel

On some chromebooks, the serdev is used to communicate with
an embedded controller. When the controller is updated, the
regular ttyS* is needed. Therefore unbind/bind needs to work
to be able to switch between the two modes without having to
reboot. In the case of ACPI enabled platforms, the underlying
serial device is marked as enumerated but this is not cleared
upon remove (unbind). In this state it can not be bound as
serdev.

Signed-off-by: julian schroeder <julianmarcusschroeder@gmail.com>
---
 drivers/tty/serdev/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
index 92e3433276f8..668fa570bc07 100644
--- a/drivers/tty/serdev/core.c
+++ b/drivers/tty/serdev/core.c
@@ -138,7 +138,11 @@ EXPORT_SYMBOL_GPL(serdev_device_add);
 void serdev_device_remove(struct serdev_device *serdev)
 {
 	struct serdev_controller *ctrl = serdev->ctrl;
+	struct acpi_device *adev;
 
+	adev = ACPI_COMPANION(&serdev->dev);
+	if (adev)
+		acpi_device_clear_enumerated(adev);
 	device_unregister(&serdev->dev);
 	ctrl->serdev = NULL;
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-09  6:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-18 19:48 [PATCH] fix serdev bind/unbind julian schroeder
2022-01-19 17:05 ` Rob Herring
2022-02-09  6:52   ` Dmitry Torokhov
2022-01-21 17:22 ` Andy Shevchenko

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).