crypto: ccree - split overloaded usage of irq field
authorGilad Ben-Yossef <gilad@benyossef.com>
Thu, 16 Jan 2020 10:14:44 +0000 (12:14 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 22 Jan 2020 08:21:10 +0000 (16:21 +0800)
We were using the irq field of the drvdata struct in
an overloaded fahsion - saving the IRQ number during init
and then storing the pending itnerrupt sources during
interrupt in the same field.

This worked because these usage are mutually exclusive but
are confusing. So simplify the code and change the init use
case to use a simple local variable.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccree/cc_driver.c
drivers/crypto/ccree/cc_driver.h

index 1bbe82f..532bc95 100644 (file)
@@ -271,6 +271,7 @@ static int init_cc_resources(struct platform_device *plat_dev)
        const struct cc_hw_data *hw_rev;
        const struct of_device_id *dev_id;
        struct clk *clk;
+       int irq;
        int rc = 0;
 
        new_drvdata = devm_kzalloc(dev, sizeof(*new_drvdata), GFP_KERNEL);
@@ -337,9 +338,9 @@ static int init_cc_resources(struct platform_device *plat_dev)
                &req_mem_cc_regs->start, new_drvdata->cc_base);
 
        /* Then IRQ */
-       new_drvdata->irq = platform_get_irq(plat_dev, 0);
-       if (new_drvdata->irq < 0)
-               return new_drvdata->irq;
+       irq = platform_get_irq(plat_dev, 0);
+       if (irq < 0)
+               return irq;
 
        init_completion(&new_drvdata->hw_queue_avail);
 
@@ -442,14 +443,13 @@ static int init_cc_resources(struct platform_device *plat_dev)
        dev_info(dev, "ARM CryptoCell %s Driver: HW version 0x%08X/0x%8X, Driver version %s\n",
                 hw_rev->name, hw_rev_pidr, sig_cidr, DRV_MODULE_VERSION);
        /* register the driver isr function */
-       rc = devm_request_irq(dev, new_drvdata->irq, cc_isr,
-                             IRQF_SHARED, "ccree", new_drvdata);
+       rc = devm_request_irq(dev, irq, cc_isr, IRQF_SHARED, "ccree",
+                             new_drvdata);
        if (rc) {
-               dev_err(dev, "Could not register to interrupt %d\n",
-                       new_drvdata->irq);
+               dev_err(dev, "Could not register to interrupt %d\n", irq);
                goto post_clk_err;
        }
-       dev_dbg(dev, "Registered to IRQ: %d\n", new_drvdata->irq);
+       dev_dbg(dev, "Registered to IRQ: %d\n", irq);
 
        rc = init_cc_regs(new_drvdata, true);
        if (rc) {
index 9d77cfd..c227718 100644 (file)
@@ -132,13 +132,11 @@ struct cc_crypto_req {
 /**
  * struct cc_drvdata - driver private data context
  * @cc_base:   virt address of the CC registers
- * @irq:       device IRQ number
- * @irq_mask:  Interrupt mask shadow (1 for masked interrupts)
+ * @irq:       bitmap indicating source of last interrupt
  */
 struct cc_drvdata {
        void __iomem *cc_base;
        int irq;
-       u32 irq_mask;
        struct completion hw_queue_avail; /* wait for HW queue availability */
        struct platform_device *plat_dev;
        cc_sram_addr_t mlli_sram_addr;