staging: wilc1000: remove use of MAX_NUN_INT_THRPT_ENH2 macro
authorAjay Singh <ajay.kathat@microchip.com>
Fri, 14 Feb 2020 11:52:16 +0000 (11:52 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Feb 2020 16:20:11 +0000 (08:20 -0800)
Make use of MAX_NUM_INT existing macro to handle the maximum supported
interrupts count and removed MAX_NUN_INT_THRPT_ENH2 macro.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Link: https://lore.kernel.org/r/20200214172250.13026-3-ajay.kathat@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/sdio.c
drivers/staging/wilc1000/wlan.h

index ca99335687c471013af5e16e3d0da1bd81554399..77ef84f9cc37bdb376c1f17237e670e541eda5f9 100644 (file)
@@ -27,8 +27,6 @@ struct wilc_sdio {
        bool irq_gpio;
        u32 block_size;
        int nint;
-/* Max num interrupts allowed in registers 0xf7, 0xf8 */
-#define MAX_NUN_INT_THRPT_ENH2 (5)
        int has_thrpt_enh3;
 };
 
@@ -818,8 +816,6 @@ static int wilc_sdio_read_int(struct wilc *wilc, u32 *int_status)
                        tmp |= INT_3;
                if (cmd.data & BIT(5))
                        tmp |= INT_4;
-               if (cmd.data & BIT(6))
-                       tmp |= INT_5;
                for (i = sdio_priv->nint; i < MAX_NUM_INT; i++) {
                        if ((tmp >> (IRG_FLAGS_OFFSET + i)) & 0x1) {
                                dev_err(&func->dev,
@@ -854,16 +850,11 @@ static int wilc_sdio_clear_int_ext(struct wilc *wilc, u32 val)
        int vmm_ctl;
 
        if (sdio_priv->has_thrpt_enh3) {
-               u32 reg;
+               u32 reg = 0;
 
-               if (sdio_priv->irq_gpio) {
-                       u32 flags;
+               if (sdio_priv->irq_gpio)
+                       reg = val & (BIT(MAX_NUM_INT) - 1);
 
-                       flags = val & (BIT(MAX_NUN_INT_THRPT_ENH2) - 1);
-                       reg = flags;
-               } else {
-                       reg = 0;
-               }
                /* select VMM table 0 */
                if (val & SEL_VMM_TBL0)
                        reg |= BIT(5);
@@ -975,11 +966,6 @@ static int wilc_sdio_sync_ext(struct wilc *wilc, int nint)
                dev_err(&func->dev, "Too many interrupts (%d)...\n", nint);
                return -EINVAL;
        }
-       if (nint > MAX_NUN_INT_THRPT_ENH2) {
-               dev_err(&func->dev,
-                       "Cannot support more than 5 interrupts when has_thrpt_enh2=1.\n");
-               return -EINVAL;
-       }
 
        sdio_priv->nint = nint;
 
index d3e822c374eb3ec68eaba898c4b86e03e3656156..876b02e93a813c6a16c0f1533008ec9cf82ec56e 100644 (file)
 #define INT_3                  BIT(IRG_FLAGS_OFFSET + 3)
 #define INT_4                  BIT(IRG_FLAGS_OFFSET + 4)
 #define INT_5                  BIT(IRG_FLAGS_OFFSET + 5)
-#define MAX_NUM_INT            6
+#define MAX_NUM_INT            5
 
 /*******************************************/
 /*        E0 and later Interrupt flags.    */