[PATCH 09/11] hw/sd: Remove unused 'enable' method from SDCardClass

Peter Maydell posted 11 patches 2 months ago
[PATCH 09/11] hw/sd: Remove unused 'enable' method from SDCardClass
Posted by Peter Maydell 2 months ago
The SDCardClass has an 'enable' method, but nothing actually invokes it.
The underlying implementation is sd_enable(), which is documented
in sdcard_legacy.h as something that should not be used and was only
present for the benefit of the now-removed nseries boards. Unlike
all the other method pointers in SDCardClass, this one doesn't have
an sdbus_foo() function wrapper in hw/sd/core.c.

Remove the unused method.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/hw/sd/sd.h | 1 -
 hw/sd/sd.c         | 1 -
 2 files changed, 2 deletions(-)

diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h
index f2458f37b3c..d6bad175131 100644
--- a/include/hw/sd/sd.h
+++ b/include/hw/sd/sd.h
@@ -119,7 +119,6 @@ struct SDCardClass {
     void (*set_voltage)(SDState *sd, uint16_t millivolts);
     uint8_t (*get_dat_lines)(SDState *sd);
     bool (*get_cmd_line)(SDState *sd);
-    void (*enable)(SDState *sd, bool enable);
     bool (*get_inserted)(SDState *sd);
     bool (*get_readonly)(SDState *sd);
     void (*set_cid)(SDState *sd);
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 0330d432fd0..f781fd1641d 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -2831,7 +2831,6 @@ static void sdmmc_common_class_init(ObjectClass *klass, void *data)
     sc->read_byte = sd_read_byte;
     sc->receive_ready = sd_receive_ready;
     sc->data_ready = sd_data_ready;
-    sc->enable = sd_enable;
     sc->get_inserted = sd_get_inserted;
     sc->get_readonly = sd_get_readonly;
 }
-- 
2.34.1
Re: [PATCH 09/11] hw/sd: Remove unused 'enable' method from SDCardClass
Posted by Philippe Mathieu-Daudé 2 months ago
On 28/1/25 11:45, Peter Maydell wrote:
> The SDCardClass has an 'enable' method, but nothing actually invokes it.
> The underlying implementation is sd_enable(), which is documented
> in sdcard_legacy.h as something that should not be used and was only
> present for the benefit of the now-removed nseries boards. Unlike
> all the other method pointers in SDCardClass, this one doesn't have
> an sdbus_foo() function wrapper in hw/sd/core.c.

See commit c759a790b67 :)

commit c759a790b672b0c5bfc50520dcc93565b55732b3
Author: Peter Maydell <peter.maydell@linaro.org>
Date:   Thu Feb 18 14:16:18 2016 +0000

     hw/sd: Add QOM bus which SD cards plug in to

     Add a QOM bus for SD cards to plug in to.

     Note that since sd_enable() is used only by one board and there
     only as part of a broken implementation, we do not provide it in
     the SDBus API (but instead add a warning comment about the old
     function). Whoever converts OMAP and the nseries boards to QOM
     will need to either implement the card switch properly or move
     the enable hack into the OMAP MMC controller model.

> 
> Remove the unused method.

Never used, indeed.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   include/hw/sd/sd.h | 1 -
>   hw/sd/sd.c         | 1 -
>   2 files changed, 2 deletions(-)


Re: [PATCH 09/11] hw/sd: Remove unused 'enable' method from SDCardClass
Posted by Richard Henderson 2 months ago
On 1/28/25 02:45, Peter Maydell wrote:
> The SDCardClass has an 'enable' method, but nothing actually invokes it.
> The underlying implementation is sd_enable(), which is documented
> in sdcard_legacy.h as something that should not be used and was only
> present for the benefit of the now-removed nseries boards. Unlike
> all the other method pointers in SDCardClass, this one doesn't have
> an sdbus_foo() function wrapper in hw/sd/core.c.
> 
> Remove the unused method.
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   include/hw/sd/sd.h | 1 -
>   hw/sd/sd.c         | 1 -
>   2 files changed, 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~