From: Shawn Lin <shawn.lin@rock-chips.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: shawn.lin@rock-chips.com, linux-wireless@vger.kernel.org,
linux-mmc@vger.kernel.org, Ulf Hansson <ulf.hansson@linaro.org>,
Ping-Ke Shih <pkshih@realtek.com>,
Johannes Berg <johannes@sipsolutions.net>
Subject: Re: [PATCH v2 1/3] sdio: Provide a bustype shutdown function
Date: Thu, 15 Jan 2026 09:26:21 +0800 [thread overview]
Message-ID: <ee62632a-34cb-494a-ad87-bd18a58d6a7c@rock-chips.com> (raw)
In-Reply-To: <397f45c2818f6632151f92b70e547262f373c3b6.1768232321.git.u.kleine-koenig@baylibre.com>
在 2026/01/12 星期一 23:46, Uwe Kleine-König 写道:
> To prepare sdio drivers to migrate away from struct device_driver::shutdown
> (and then eventually remove that callback) create a serdev driver shutdown
/s/serdev driver/sdio driver ?
> callback and migration code to keep the existing behaviour. Note this
> introduces a warning for each driver that isn't converted yet to that
> callback at register time.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/mmc/core/sdio_bus.c | 25 +++++++++++++++++++++++++
> include/linux/mmc/sdio_func.h | 1 +
> 2 files changed, 26 insertions(+)
>
> diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
> index 10799772494a..6e5bdc2f0cc8 100644
> --- a/drivers/mmc/core/sdio_bus.c
> +++ b/drivers/mmc/core/sdio_bus.c
> @@ -232,6 +232,15 @@ static void sdio_bus_remove(struct device *dev)
> pm_runtime_put_sync(dev);
> }
>
> +static void sdio_bus_shutdown(struct device *dev)
> +{
> + struct sdio_driver *drv = to_sdio_driver(dev->driver);
> + struct sdio_func *func = dev_to_sdio_func(dev);
> +
> + if (dev->driver && drv->shutdown)
> + drv->shutdown(func);
> +}
Seem bogus check as a few line ahead, you used dev->driver to get
sdio_driver already. Otherwise the reset looks good.
> +
> static const struct dev_pm_ops sdio_bus_pm_ops = {
> SET_SYSTEM_SLEEP_PM_OPS(pm_generic_suspend, pm_generic_resume)
> SET_RUNTIME_PM_OPS(
> @@ -248,6 +257,7 @@ static const struct bus_type sdio_bus_type = {
> .uevent = sdio_bus_uevent,
> .probe = sdio_bus_probe,
> .remove = sdio_bus_remove,
> + .shutdown = sdio_bus_shutdown,
> .pm = &sdio_bus_pm_ops,
> };
>
> @@ -261,6 +271,14 @@ void sdio_unregister_bus(void)
> bus_unregister(&sdio_bus_type);
> }
>
> +static void sdio_legacy_shutdown(struct sdio_func *func)
> +{
> + struct device *dev = &func->dev;
> + struct device_driver *driver = dev->driver;
> +
> + driver->shutdown(dev);
> +}
> +
> /**
> * __sdio_register_driver - register a function driver
> * @drv: SDIO function driver
> @@ -272,6 +290,13 @@ int __sdio_register_driver(struct sdio_driver *drv, struct module *owner)
> drv->drv.bus = &sdio_bus_type;
> drv->drv.owner = owner;
>
> + /*
> + * This driver needs updating. Note that driver_register() warns about
> + * this, so we're not adding another warning here.
> + */
> + if (!drv->shutdown && drv->drv.shutdown)
> + drv->shutdown = sdio_legacy_shutdown;
> +
> return driver_register(&drv->drv);
> }
> EXPORT_SYMBOL_GPL(__sdio_register_driver);
> diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
> index fed1f5f4a8d3..4534bf462aac 100644
> --- a/include/linux/mmc/sdio_func.h
> +++ b/include/linux/mmc/sdio_func.h
> @@ -78,6 +78,7 @@ struct sdio_driver {
>
> int (*probe)(struct sdio_func *, const struct sdio_device_id *);
> void (*remove)(struct sdio_func *);
> + void (*shutdown)(struct sdio_func *);
>
> struct device_driver drv;
> };
next prev parent reply other threads:[~2026-01-15 1:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 15:46 [PATCH v2 0/3] sdio: Use bus type function for shutdown Uwe Kleine-König
2026-01-12 15:46 ` [PATCH v2 1/3] sdio: Provide a bustype shutdown function Uwe Kleine-König
2026-01-15 1:26 ` Shawn Lin [this message]
2026-01-15 8:23 ` Uwe Kleine-König
2026-01-19 9:16 ` Johannes Berg
2026-01-19 15:00 ` Ulf Hansson
2026-01-19 18:25 ` Uwe Kleine-König
2026-01-20 10:25 ` Ulf Hansson
2026-01-20 10:27 ` Ulf Hansson
2026-01-20 10:29 ` Johannes Berg
2026-01-12 15:51 ` [PATCH v2 0/3] sdio: Use bus type function for shutdown Johannes Berg
2026-01-13 0:31 ` Ping-Ke Shih
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=ee62632a-34cb-494a-ad87-bd18a58d6a7c@rock-chips.com \
--to=shawn.lin@rock-chips.com \
--cc=johannes@sipsolutions.net \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=ulf.hansson@linaro.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