Commit 33c4b310 authored by Gilad Ben-Yossef's avatar Gilad Ben-Yossef Committed by Herbert Xu

crypto: ccree - split overloaded usage of irq field

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: default avatarGilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 15fd2566
...@@ -271,6 +271,7 @@ static int init_cc_resources(struct platform_device *plat_dev) ...@@ -271,6 +271,7 @@ static int init_cc_resources(struct platform_device *plat_dev)
const struct cc_hw_data *hw_rev; const struct cc_hw_data *hw_rev;
const struct of_device_id *dev_id; const struct of_device_id *dev_id;
struct clk *clk; struct clk *clk;
int irq;
int rc = 0; int rc = 0;
new_drvdata = devm_kzalloc(dev, sizeof(*new_drvdata), GFP_KERNEL); new_drvdata = devm_kzalloc(dev, sizeof(*new_drvdata), GFP_KERNEL);
...@@ -337,9 +338,9 @@ static int init_cc_resources(struct platform_device *plat_dev) ...@@ -337,9 +338,9 @@ static int init_cc_resources(struct platform_device *plat_dev)
&req_mem_cc_regs->start, new_drvdata->cc_base); &req_mem_cc_regs->start, new_drvdata->cc_base);
/* Then IRQ */ /* Then IRQ */
new_drvdata->irq = platform_get_irq(plat_dev, 0); irq = platform_get_irq(plat_dev, 0);
if (new_drvdata->irq < 0) if (irq < 0)
return new_drvdata->irq; return irq;
init_completion(&new_drvdata->hw_queue_avail); init_completion(&new_drvdata->hw_queue_avail);
...@@ -442,14 +443,13 @@ static int init_cc_resources(struct platform_device *plat_dev) ...@@ -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", 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); hw_rev->name, hw_rev_pidr, sig_cidr, DRV_MODULE_VERSION);
/* register the driver isr function */ /* register the driver isr function */
rc = devm_request_irq(dev, new_drvdata->irq, cc_isr, rc = devm_request_irq(dev, irq, cc_isr, IRQF_SHARED, "ccree",
IRQF_SHARED, "ccree", new_drvdata); new_drvdata);
if (rc) { if (rc) {
dev_err(dev, "Could not register to interrupt %d\n", dev_err(dev, "Could not register to interrupt %d\n", irq);
new_drvdata->irq);
goto post_clk_err; 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); rc = init_cc_regs(new_drvdata, true);
if (rc) { if (rc) {
......
...@@ -132,13 +132,11 @@ struct cc_crypto_req { ...@@ -132,13 +132,11 @@ struct cc_crypto_req {
/** /**
* struct cc_drvdata - driver private data context * struct cc_drvdata - driver private data context
* @cc_base: virt address of the CC registers * @cc_base: virt address of the CC registers
* @irq: device IRQ number * @irq: bitmap indicating source of last interrupt
* @irq_mask: Interrupt mask shadow (1 for masked interrupts)
*/ */
struct cc_drvdata { struct cc_drvdata {
void __iomem *cc_base; void __iomem *cc_base;
int irq; int irq;
u32 irq_mask;
struct completion hw_queue_avail; /* wait for HW queue availability */ struct completion hw_queue_avail; /* wait for HW queue availability */
struct platform_device *plat_dev; struct platform_device *plat_dev;
cc_sram_addr_t mlli_sram_addr; cc_sram_addr_t mlli_sram_addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment