diff mbox series

[v5,03/14] hw/sd/sdhci: Redefine SDHCI_QUIRK_NO_BUSY_IRQ bitmask as bit

Message ID 20250310000620.70120-4-philmd@linaro.org
State New
Headers show
Series hw/sd/sdhci: Set reset value of interrupt registers | expand

Commit Message

Philippe Mathieu-Daudé March 10, 2025, 12:06 a.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/sd/sdhci.h | 8 ++++----
 hw/sd/sdhci.c         | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

BALATON Zoltan March 10, 2025, 1:31 p.m. UTC | #1
On Mon, 10 Mar 2025, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/hw/sd/sdhci.h | 8 ++++----
> hw/sd/sdhci.c         | 4 ++--
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h
> index 48247e9a20f..096d607f4b7 100644
> --- a/include/hw/sd/sdhci.h
> +++ b/include/hw/sd/sdhci.h
> @@ -108,13 +108,13 @@ struct SDHCIState {
> typedef struct SDHCIState SDHCIState;
>
> /*
> - * Controller does not provide transfer-complete interrupt when not
> - * busy.
> - *
>  * NOTE: This definition is taken out of Linux kernel and so the
>  * original bit number is preserved
>  */
> -#define SDHCI_QUIRK_NO_BUSY_IRQ    BIT(14)
> +enum {
> +    /* Controller does not provide transfer-complete interrupt when not busy. */
> +    SDHCI_QUIRK_NO_BUSY_IRQ                     = 14,
> +};

I think this is better as a define, then you don't have to remember to add 
BIT() on usage and prevent this churn. I'd say drop this patch and adjust 
the comment in next patch but if you're attached to it I don't mind that 
much.

Regards,
BALATON Zoltan

> #define TYPE_PCI_SDHCI "sdhci-pci"
> DECLARE_INSTANCE_CHECKER(SDHCIState, PCI_SDHCI,
> diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
> index 149b748cbee..1dc942a0e06 100644
> --- a/hw/sd/sdhci.c
> +++ b/hw/sd/sdhci.c
> @@ -366,7 +366,7 @@ static void sdhci_send_command(SDHCIState *s)
>             }
>         }
>
> -        if (!(s->quirks & SDHCI_QUIRK_NO_BUSY_IRQ) &&
> +        if (!(s->quirks & BIT(SDHCI_QUIRK_NO_BUSY_IRQ)) &&
>             (s->norintstsen & SDHC_NISEN_TRSCMP) &&
>             (s->cmdreg & SDHC_CMD_RESPONSE) == SDHC_CMD_RSP_WITH_BUSY) {
>             s->norintsts |= SDHC_NIS_TRSCMP;
> @@ -1886,7 +1886,7 @@ static void imx_usdhc_init(Object *obj)
>     SDHCIState *s = SYSBUS_SDHCI(obj);
>
>     s->io_ops = &usdhc_mmio_ops;
> -    s->quirks = SDHCI_QUIRK_NO_BUSY_IRQ;
> +    s->quirks = BIT(SDHCI_QUIRK_NO_BUSY_IRQ);
> }
>
> /* --- qdev Samsung s3c --- */
>
diff mbox series

Patch

diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h
index 48247e9a20f..096d607f4b7 100644
--- a/include/hw/sd/sdhci.h
+++ b/include/hw/sd/sdhci.h
@@ -108,13 +108,13 @@  struct SDHCIState {
 typedef struct SDHCIState SDHCIState;
 
 /*
- * Controller does not provide transfer-complete interrupt when not
- * busy.
- *
  * NOTE: This definition is taken out of Linux kernel and so the
  * original bit number is preserved
  */
-#define SDHCI_QUIRK_NO_BUSY_IRQ    BIT(14)
+enum {
+    /* Controller does not provide transfer-complete interrupt when not busy. */
+    SDHCI_QUIRK_NO_BUSY_IRQ                     = 14,
+};
 
 #define TYPE_PCI_SDHCI "sdhci-pci"
 DECLARE_INSTANCE_CHECKER(SDHCIState, PCI_SDHCI,
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 149b748cbee..1dc942a0e06 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -366,7 +366,7 @@  static void sdhci_send_command(SDHCIState *s)
             }
         }
 
-        if (!(s->quirks & SDHCI_QUIRK_NO_BUSY_IRQ) &&
+        if (!(s->quirks & BIT(SDHCI_QUIRK_NO_BUSY_IRQ)) &&
             (s->norintstsen & SDHC_NISEN_TRSCMP) &&
             (s->cmdreg & SDHC_CMD_RESPONSE) == SDHC_CMD_RSP_WITH_BUSY) {
             s->norintsts |= SDHC_NIS_TRSCMP;
@@ -1886,7 +1886,7 @@  static void imx_usdhc_init(Object *obj)
     SDHCIState *s = SYSBUS_SDHCI(obj);
 
     s->io_ops = &usdhc_mmio_ops;
-    s->quirks = SDHCI_QUIRK_NO_BUSY_IRQ;
+    s->quirks = BIT(SDHCI_QUIRK_NO_BUSY_IRQ);
 }
 
 /* --- qdev Samsung s3c --- */