mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: julian schroeder <julianmarcusschroeder@gmail.com>
To: robh@kernel.org
Cc: bhanumaiya@google.com,
	julian schroeder <julianmarcusschroeder@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] fix serdev bind/unbind
Date: Tue, 18 Jan 2022 13:48:57 -0600	[thread overview]
Message-ID: <20220118194857.26546-1-julianmarcusschroeder@gmail.com> (raw)

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


             reply	other threads:[~2022-01-18 19:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18 19:48 julian schroeder [this message]
2022-01-19 17:05 ` Rob Herring
2022-02-09  6:52   ` Dmitry Torokhov
2022-01-21 17:22 ` Andy Shevchenko

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=20220118194857.26546-1-julianmarcusschroeder@gmail.com \
    --to=julianmarcusschroeder@gmail.com \
    --cc=bhanumaiya@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=robh@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®