From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73CF337104F for ; Fri, 29 May 2026 19:23:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780082634; cv=none; b=OJSsLpioBR7RQBaXoxkxFlOJ3+zZA2NCCmwcLpB/suIVtkTWop7SYkHrZLUldf3v4uODqV0dkXJslnNaxPYNNswrOJfZAov/Qv/+nRlnbt8z+7x6eTyuvwzHQ4mS40Zgpf+oK5CEbWRHuw0TGrp7vJs1HbaNoOJ5NrR3TEujkt4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780082634; c=relaxed/simple; bh=qKiWLUiY9hyW79UMpoIG4yKu6MkLxE7WYrxGUs9yjEo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U5Vr2mlrE1cAPIL8FVQKLWf6p4ocE106KUFSoSgmVX02mJmR9OlDfVqdONM4XcoRbK6uQjwWJCW4XXHSg25J7dtvvZT65Qp1Vll71md/2Om/MyR4y1ZD1xuyVqtF7FWZeZRbHGK0TJm/dwjeKpls0hhnD3Z5B72kZpTnH+K1SsY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WqUkAmX1; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WqUkAmX1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A30A1F00893; Fri, 29 May 2026 19:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780082633; bh=PbO5waKmPcH3GF37iu8JxWd2ifbWqV/4TThc8yZAL44=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WqUkAmX1IDOvsVf9pqmkwZDTUj1/DV/fTwQ7SFFx3sNH+fOWz62b3KofyPXyV8zw3 A3YnF38U0fw4bUQjBmvFHMy2xmg3Ke7MfZLPxzg2krgHHhpiMVICSOFF7Zq8rHoAve 32H/7drIQFL/Ovg9LBuBAfK13hGHEI9lpjI1lTcmg1C8ezzkKyDoJMRhUReKcBZWvs 9POBU12LpjauYfRQocAnTmyZ6q7d7MEwlwlNOkx1ZJeVCWA8kdR4JBeOyM9kEP3QWi QeP1wi/pnIH1Of8XiNBS54cpFnaOsMa75Qvzr4bE6JbCxvZUyamhqhidZ9MWqYPdGT K3pZnlk/Qp5wg== From: Sasha Levin To: stable@vger.kernel.org Cc: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 6.18.y 1/3] serdev: Provide a bustype shutdown function Date: Fri, 29 May 2026 15:23:48 -0400 Message-ID: <20260529192351.1696591-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026052858-skies-gills-0f98@gregkh> References: <2026052858-skies-gills-0f98@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Uwe Kleine-König [ Upstream commit 6d71c62b13c33ea858ab298fe20beaec5736edc7 ] To prepare serdev driver to migrate away from struct device_driver::shutdown (and then eventually remove that callback) create a serdev driver shutdown callback and migration code to keep the existing behaviour. Note this introduces a warning for each driver at register time that isn't converted yet to that callback. Signed-off-by: Uwe Kleine-König Link: https://patch.msgid.link/ab518883e3ed0976a19cb5b5b5faf42bd3a655b7.1765526117.git.u.kleine-koenig@baylibre.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 375ba7484132 ("Bluetooth: hci_qca: Convert timeout from jiffies to ms") Signed-off-by: Sasha Levin --- drivers/tty/serdev/core.c | 21 +++++++++++++++++++++ include/linux/serdev.h | 1 + 2 files changed, 22 insertions(+) diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index b33e708cb2455..40eedc15277c3 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c @@ -414,11 +414,21 @@ static void serdev_drv_remove(struct device *dev) sdrv->remove(to_serdev_device(dev)); } +static void serdev_drv_shutdown(struct device *dev) +{ + const struct serdev_device_driver *sdrv = + to_serdev_device_driver(dev->driver); + + if (dev->driver && sdrv->shutdown) + sdrv->shutdown(to_serdev_device(dev)); +} + static const struct bus_type serdev_bus_type = { .name = "serial", .match = serdev_device_match, .probe = serdev_drv_probe, .remove = serdev_drv_remove, + .shutdown = serdev_drv_shutdown, }; /** @@ -814,6 +824,14 @@ void serdev_controller_remove(struct serdev_controller *ctrl) } EXPORT_SYMBOL_GPL(serdev_controller_remove); +static void serdev_legacy_shutdown(struct serdev_device *serdev) +{ + struct device *dev = &serdev->dev; + struct device_driver *driver = dev->driver; + + driver->shutdown(dev); +} + /** * __serdev_device_driver_register() - Register client driver with serdev core * @sdrv: client driver to be associated with client-device. @@ -830,6 +848,9 @@ int __serdev_device_driver_register(struct serdev_device_driver *sdrv, struct mo /* force drivers to async probe so I/O is possible in probe */ sdrv->driver.probe_type = PROBE_PREFER_ASYNCHRONOUS; + if (!sdrv->shutdown && sdrv->driver.shutdown) + sdrv->shutdown = serdev_legacy_shutdown; + return driver_register(&sdrv->driver); } EXPORT_SYMBOL_GPL(__serdev_device_driver_register); diff --git a/include/linux/serdev.h b/include/linux/serdev.h index 34562eb99931d..5654c58eb73c0 100644 --- a/include/linux/serdev.h +++ b/include/linux/serdev.h @@ -65,6 +65,7 @@ struct serdev_device_driver { struct device_driver driver; int (*probe)(struct serdev_device *); void (*remove)(struct serdev_device *); + void (*shutdown)(struct serdev_device *); }; static inline struct serdev_device_driver *to_serdev_device_driver(struct device_driver *d) -- 2.53.0