Skip to contentSkip to conversation

sdio: Use bus type function for shutdown

PATCH In review Uwe Kleine-König 5 participants 15 messages Jan 12 – Jan 20

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover sdio: Use bus type function for shutdown

Hello,

this series is part of an effort to get rid of the .shutdown() callback (and .probe() and .remove()) in struct device_driver. Preparing that, all sdio drivers that up to now use this callback are converted to a new sdio specific shutdown callback.

v1 is available at https://lore.kernel.org/all/[email protected].

Changes since v1:
- Drop patch 2/4 which resulted in a build failure with CONFIG_PM=n

Patches #2 and #3 depend on the first patch, and with just the first patch applied there is a runtime warning (emitted by the driver core in driver_register()) for each unconverted driver. So it would be nice to get the whole series in during a single merge window to not let users face the warning.

Given that all drivers are in drivers/net/wireless I suggest to apply the whole series via the wireless tree.

Best regards
Uwe

Uwe Kleine-König (3):
sdio: Provide a bustype shutdown function
wifi: rsi: sdio: Migrate to use sdio specific shutdown function
wifi: rtw88: sdio: Migrate to use sdio specific shutdown function

 drivers/mmc/core/sdio_bus.c                   | 25 +++++++++++++++++++
 .../net/wireless/realtek/rtw88/rtw8723cs.c    |  2 +-
 .../net/wireless/realtek/rtw88/rtw8723ds.c    |  2 +-
 .../net/wireless/realtek/rtw88/rtw8821cs.c    |  2 +-
 .../net/wireless/realtek/rtw88/rtw8822bs.c    |  2 +-
 .../net/wireless/realtek/rtw88/rtw8822cs.c    |  2 +-
 drivers/net/wireless/realtek/rtw88/sdio.c     |  3 +--
 drivers/net/wireless/realtek/rtw88/sdio.h     |  2 +-
 drivers/net/wireless/rsi/rsi_91x_sdio.c       |  5 ++--
 include/linux/mmc/sdio_func.h                 |  1 +
 10 files changed, 35 insertions(+), 11 deletions(-)

base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8

Signature · 1 line
2.47.3
#1 lore raw

PATCH v2 1/3 sdio: Provide a bustype shutdown function

To prepare sdio drivers 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 that isn't converted yet to that callback at register time.

---
 drivers/mmc/core/sdio_bus.c   | 25 +++++++++++++++++++++++++
 include/linux/mmc/sdio_func.h |  1 +
 2 files changed, 26 insertions(+)
drivers/mmc/core/sdio_bus.c +25 -0
index 10799772494a..6e5bdc2f0cc8 100644
@@ -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);
+}
+
 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);
include/linux/mmc/sdio_func.h +1 -0
index fed1f5f4a8d3..4534bf462aac 100644
@@ -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;
 };
Signature · 1 line
2.47.3
#2 lore raw

Re: [PATCH v2 1/3] sdio: Provide a bustype shutdown function

Quoted 2 lines · 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 ?

Quoted 16 lines

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.

---
  drivers/mmc/core/sdio_bus.c   | 25 +++++++++++++++++++++++++
  include/linux/mmc/sdio_func.h |  1 +
  2 files changed, 26 insertions(+)
drivers/mmc/core/sdio_bus.c +0 -0
index 10799772494a..6e5bdc2f0cc8 100644
@@ -232,6 +232,15 @@ static void sdio_bus_remove(struct device *dev)
  		pm_runtime_put_sync(dev);

drivers/mmc/core/sdio_bus.c static void sdio_bus_remove(struct device *dev) · line 242

Quoted 10 lines
drivers/mmc/core/sdio_bus.c +8 -0
  }
 
+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.

Quoted 53 lines
drivers/mmc/core/sdio_bus.c +17 -0
+
  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);
include/linux/mmc/sdio_func.h +1 -0
index fed1f5f4a8d3..4534bf462aac 100644
@@ -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;
  };
#3 lore raw

Re: [PATCH v2 1/3] sdio: Provide a bustype shutdown function

Quoted 5 lines · Shawn Lin
Quoted 2 lines · 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 ?

Oh, indeed. Thanks for catching that.

Quoted 20 lines
Quoted 20 lines

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.

---
  drivers/mmc/core/sdio_bus.c   | 25 +++++++++++++++++++++++++
  include/linux/mmc/sdio_func.h |  1 +
  2 files changed, 26 insertions(+)
drivers/mmc/core/sdio_bus.c +3 -0
index 10799772494a..6e5bdc2f0cc8 100644
@@ -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);
Quoted 8 lines

drivers/mmc/core/sdio_bus.c static void sdio_bus_remove(struct device *dev) · line 242

Quoted 5 lines
drivers/mmc/core/sdio_bus.c +5 -0
+	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.

to_sdio_driver(dev->driver) however is only pointer arithmetic and doesn't dereference the pointer. So this is not a bug in the class check-for-NULL-after-dereference. TTBOMY the code if fine as is.

Should I resend for the typo, or can this be fixed up while applying?

Best regards
Uwe

#4 lore raw

Re: [PATCH v2 1/3] sdio: Provide a bustype shutdown function

In reply to Uwe Kleine-König
Quoted 7 lines · 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 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.

Ulf, could you send an ACK for taking this through wireless?

Thanks,
johannes

#5 lore raw

Re: [PATCH v2 1/3] sdio: Provide a bustype shutdown function

In reply to Uwe Kleine-König
Quoted 57 lines · 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 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.

---
 drivers/mmc/core/sdio_bus.c   | 25 +++++++++++++++++++++++++
 include/linux/mmc/sdio_func.h |  1 +
 2 files changed, 26 insertions(+)
drivers/mmc/core/sdio_bus.c +18 -0
index 10799772494a..6e5bdc2f0cc8 100644
@@ -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);
+}
+
 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

drivers/mmc/core/sdio_bus.c int __sdio_register_driver(struct sdio_driver *drv, struct module *owner) · line 299

Quoted 10 lines
drivers/mmc/core/sdio_bus.c +7 -0
@@ -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;
+

Is this added only to keep the series bisectable or are there other (except those you fix in the series) sdio func drivers that make use of the shutdown callback?

In any case, when are you planning to remove this?

Quoted 16 lines
drivers/mmc/core/sdio_bus.c +0 -0
        return driver_register(&drv->drv);
 }
 EXPORT_SYMBOL_GPL(__sdio_register_driver);
include/linux/mmc/sdio_func.h +1 -1
index fed1f5f4a8d3..4534bf462aac 100644
@@ -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;
 };
--
Quoted 2 lines

2.47.3

Kind regards
Uffe

#6 lore raw

Re: [PATCH v2 1/3] sdio: Provide a bustype shutdown function

Hello Ulf,

Quoted 6 lines · Ulf Hansson
Quoted 4 lines · Uwe Kleine-König
drivers/mmc/core/sdio_bus.c +0 -0
@@ -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;
 
Quoted 11 lines

drivers/mmc/core/sdio_bus.c int __sdio_register_driver(struct sdio_driver *drv, struct module *owner) · line 299

Quoted 7 lines
drivers/mmc/core/sdio_bus.c +7 -0
+       /*
+        * 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;
+

Is this added only to keep the series bisectable or are there other (except those you fix in the series) sdio func drivers that make use of the shutdown callback?

It's kept because I don't know if there are any other sdio driver in flight and these would break silently when they are applied between this series and the removal of the callbacks from struct device_driver.

Quoted 1 line

In any case, when are you planning to remove this?

So my plan is to remove this in a series where the last patch is the modification to struct driver.

Best regards
Uwe

#7 lore raw

Re: [PATCH v2 1/3] sdio: Provide a bustype shutdown function

Quoted 22 lines · Uwe Kleine-König

Hello Ulf,

Quoted 6 lines · Ulf Hansson
Quoted 4 lines · Uwe Kleine-König
drivers/mmc/core/sdio_bus.c +0 -0
@@ -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;
 
Quoted 11 lines

drivers/mmc/core/sdio_bus.c int __sdio_register_driver(struct sdio_driver *drv, struct module *owner) · line 299

Quoted 7 lines
drivers/mmc/core/sdio_bus.c +7 -0
+       /*
+        * 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;
+

Is this added only to keep the series bisectable or are there other (except those you fix in the series) sdio func drivers that make use of the shutdown callback?

Quoted 8 lines

It's kept because I don't know if there are any other sdio driver in flight and these would break silently when they are applied between this series and the removal of the callbacks from struct device_driver.

Quoted 1 line

In any case, when are you planning to remove this?

So my plan is to remove this in a series where the last patch is the modification to struct driver.

Okay, thanks for clarifying!

Kind regards
Uffe

Reviewed-by on v2 1/3
#8 lore raw

Re: [PATCH v2 1/3] sdio: Provide a bustype shutdown function

In reply to Uwe Kleine-König
Quoted 8 lines · 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 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.

Johannes, please pick this via your tree. And sorry for the delay in reviewing this!

Kind regards
Uffe

Quoted 77 lines
---
 drivers/mmc/core/sdio_bus.c   | 25 +++++++++++++++++++++++++
 include/linux/mmc/sdio_func.h |  1 +
 2 files changed, 26 insertions(+)
drivers/mmc/core/sdio_bus.c +25 -0
index 10799772494a..6e5bdc2f0cc8 100644
@@ -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);
+}
+
 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);
include/linux/mmc/sdio_func.h +1 -1
index fed1f5f4a8d3..4534bf462aac 100644
@@ -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;
 };
--

2.47.3

#9 lore raw

Re: [PATCH v2 1/3] sdio: Provide a bustype shutdown function

Quoted 9 lines · Ulf Hansson
Quoted 7 lines · 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 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.

Quoted 6 lines
Quoted 1 line

Johannes, please pick this via your tree. And sorry for the delay in reviewing this!

Will do, no worries at all, thanks!

johannes

#10 lore raw

PATCH v2 2/3 wifi: rsi: sdio: Migrate to use sdio specific shutdown function

In reply to Uwe Kleine-König

This saves a cast in the driver. The motivation is stop using the callback .shutdown in rsi_driver.drv to make it possible to drop that.

---
 drivers/net/wireless/rsi/rsi_91x_sdio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/rsi/rsi_91x_sdio.c +2 -3
index 1e578533e473..ee7ad81c858d 100644
@@ -1443,9 +1443,8 @@ static int rsi_thaw(struct device *dev)
 	return 0;
 }
 
-static void rsi_shutdown(struct device *dev)
+static void rsi_shutdown(struct sdio_func *pfunction)
 {
-	struct sdio_func *pfunction = dev_to_sdio_func(dev);
 	struct rsi_hw *adapter = sdio_get_drvdata(pfunction);
 	struct rsi_91x_sdiodev *sdev = adapter->rsi_dev;
 	struct ieee80211_hw *hw = adapter->hw;
@@ -1513,9 +1512,9 @@ static struct sdio_driver rsi_driver = {
 	.remove     = rsi_disconnect,
 	.id_table   = rsi_dev_table,
 #ifdef CONFIG_PM
+	.shutdown   = rsi_shutdown,
 	.drv = {
 		.pm = &rsi_pm_ops,
-		.shutdown   = rsi_shutdown,
 	}
 #endif
 };
Signature · 1 line
2.47.3
#11 lore raw

PATCH v2 3/3 wifi: rtw88: sdio: Migrate to use sdio specific shutdown function

In reply to Uwe Kleine-König

This saves a cast in the driver. The motivation is stop using the callback .shutdown in rsi_driver.drv to make it possible to drop that.

---
 drivers/net/wireless/realtek/rtw88/rtw8723cs.c | 2 +-
 drivers/net/wireless/realtek/rtw88/rtw8723ds.c | 2 +-
 drivers/net/wireless/realtek/rtw88/rtw8821cs.c | 2 +-
 drivers/net/wireless/realtek/rtw88/rtw8822bs.c | 2 +-
 drivers/net/wireless/realtek/rtw88/rtw8822cs.c | 2 +-
 drivers/net/wireless/realtek/rtw88/sdio.c      | 3 +--
 drivers/net/wireless/realtek/rtw88/sdio.h      | 2 +-
 7 files changed, 7 insertions(+), 8 deletions(-)
drivers/net/wireless/realtek/rtw88/rtw8723cs.c +1 -1
index 1f98d35a8dd1..2018c9d76dd1 100644
@@ -23,9 +23,9 @@ static struct sdio_driver rtw_8723cs_driver = {
 	.id_table = rtw_8723cs_id_table,
 	.probe = rtw_sdio_probe,
 	.remove = rtw_sdio_remove,
+	.shutdown = rtw_sdio_shutdown,
 	.drv = {
 		.pm = &rtw_sdio_pm_ops,
-		.shutdown = rtw_sdio_shutdown
 	}};
 module_sdio_driver(rtw_8723cs_driver);
 
drivers/net/wireless/realtek/rtw88/rtw8723ds.c +1 -1
index 206b77e5b98e..e38c90b769a2 100644
@@ -28,10 +28,10 @@ static struct sdio_driver rtw_8723ds_driver = {
 	.name = KBUILD_MODNAME,
 	.probe = rtw_sdio_probe,
 	.remove = rtw_sdio_remove,
+	.shutdown = rtw_sdio_shutdown,
 	.id_table = rtw_8723ds_id_table,
 	.drv = {
 		.pm = &rtw_sdio_pm_ops,
-		.shutdown = rtw_sdio_shutdown,
 	}
 };
 module_sdio_driver(rtw_8723ds_driver);
drivers/net/wireless/realtek/rtw88/rtw8821cs.c +1 -1
index 6d94162213c6..58e0ef219cdc 100644
@@ -23,10 +23,10 @@ static struct sdio_driver rtw_8821cs_driver = {
 	.name = KBUILD_MODNAME,
 	.probe = rtw_sdio_probe,
 	.remove = rtw_sdio_remove,
+	.shutdown = rtw_sdio_shutdown,
 	.id_table = rtw_8821cs_id_table,
 	.drv = {
 		.pm = &rtw_sdio_pm_ops,
-		.shutdown = rtw_sdio_shutdown,
 	}
 };
 module_sdio_driver(rtw_8821cs_driver);
drivers/net/wireless/realtek/rtw88/rtw8822bs.c +1 -1
index 744781dcb419..2de9b11540c5 100644
@@ -23,10 +23,10 @@ static struct sdio_driver rtw_8822bs_driver = {
 	.name = KBUILD_MODNAME,
 	.probe = rtw_sdio_probe,
 	.remove = rtw_sdio_remove,
+	.shutdown = rtw_sdio_shutdown,
 	.id_table = rtw_8822bs_id_table,
 	.drv = {
 		.pm = &rtw_sdio_pm_ops,
-		.shutdown = rtw_sdio_shutdown,
 	}
 };
 module_sdio_driver(rtw_8822bs_driver);
drivers/net/wireless/realtek/rtw88/rtw8822cs.c +1 -1
index 322281e07eb8..b00ef4173962 100644
@@ -23,10 +23,10 @@ static struct sdio_driver rtw_8822cs_driver = {
 	.name = KBUILD_MODNAME,
 	.probe = rtw_sdio_probe,
 	.remove = rtw_sdio_remove,
+	.shutdown = rtw_sdio_shutdown,
 	.id_table = rtw_8822cs_id_table,
 	.drv = {
 		.pm = &rtw_sdio_pm_ops,
-		.shutdown = rtw_sdio_shutdown,
 	}
 };
 module_sdio_driver(rtw_8822cs_driver);
drivers/net/wireless/realtek/rtw88/sdio.c +1 -2
index 99d7c629eac6..ebd7636e2408 100644
@@ -1412,9 +1412,8 @@ void rtw_sdio_remove(struct sdio_func *sdio_func)
 }
 EXPORT_SYMBOL(rtw_sdio_remove);
 
-void rtw_sdio_shutdown(struct device *dev)
+void rtw_sdio_shutdown(struct sdio_func *sdio_func)
 {
-	struct sdio_func *sdio_func = dev_to_sdio_func(dev);
 	const struct rtw_chip_info *chip;
 	struct ieee80211_hw *hw;
 	struct rtw_dev *rtwdev;
drivers/net/wireless/realtek/rtw88/sdio.h +1 -1
index 3c659ed180f0..457e8b02380e 100644
@@ -166,7 +166,7 @@ extern const struct dev_pm_ops rtw_sdio_pm_ops;
 int rtw_sdio_probe(struct sdio_func *sdio_func,
 		   const struct sdio_device_id *id);
 void rtw_sdio_remove(struct sdio_func *sdio_func);
-void rtw_sdio_shutdown(struct device *dev);
+void rtw_sdio_shutdown(struct sdio_func *sdio_func);
 
 static inline bool rtw_sdio_is_sdio30_supported(struct rtw_dev *rtwdev)
 {
Signature · 1 line
2.47.3
#13 lore raw
In reply to Uwe Kleine-König
Quoted 12 lines · Uwe Kleine-König

Hello,

this series is part of an effort to get rid of the .shutdown() callback (and .probe() and .remove()) in struct device_driver. Preparing that, all sdio drivers that up to now use this callback are converted to a new sdio specific shutdown callback.

v1 is available at https://lore.kernel.org/all/[email protected].

Changes since v1:
- Drop patch 2/4 which resulted in a build failure with CONFIG_PM=n

Quoted 9 lines

Patches #2 and #3 depend on the first patch, and with just the first patch applied there is a runtime warning (emitted by the driver core in driver_register()) for each unconverted driver. So it would be nice to get the whole series in during a single merge window to not let users face the warning.

Given that all drivers are in drivers/net/wireless I suggest to apply the whole series via the wireless tree.

Sounds good, thanks for the heads-up.

I guess I should get Ulf's ack for the MMC part, and Ping-Ke's for the rtw part, and nobody cares about rsi :)

johannes

maintainer
#14 lore raw
Quoted 19 lines · Johannes Berg
Quoted 18 lines · Uwe Kleine-König

Hello,

this series is part of an effort to get rid of the .shutdown() callback (and .probe() and .remove()) in struct device_driver. Preparing that, all sdio drivers that up to now use this callback are converted to a new sdio specific shutdown callback.

v1 is available at https://lore.kernel.org/all/[email protected].

Changes since v1:
- Drop patch 2/4 which resulted in a build failure with CONFIG_PM=n

Patches #2 and #3 depend on the first patch, and with just the first patch applied there is a runtime warning (emitted by the driver core in driver_register()) for each unconverted driver. So it would be nice to get the whole series in during a single merge window to not let users face the warning.

Quoted 8 lines
Quoted 3 lines

Given that all drivers are in drivers/net/wireless I suggest to apply the whole series via the wireless tree.

Sounds good, thanks for the heads-up.

I guess I should get Ulf's ack for the MMC part, and Ping-Ke's for the rtw part, and nobody cares about rsi :)

Acked. And assigned this patch to you in patchwork. Thanks.