Skip to content

Commit 33c4b31

Browse files
Gilad Ben-Yossefherbertx
authored andcommitted
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: Gilad Ben-Yossef <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 15fd256 commit 33c4b31

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

drivers/crypto/ccree/cc_driver.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ static int init_cc_resources(struct platform_device *plat_dev)
271271
const struct cc_hw_data *hw_rev;
272272
const struct of_device_id *dev_id;
273273
struct clk *clk;
274+
int irq;
274275
int rc = 0;
275276

276277
new_drvdata = devm_kzalloc(dev, sizeof(*new_drvdata), GFP_KERNEL);
@@ -337,9 +338,9 @@ static int init_cc_resources(struct platform_device *plat_dev)
337338
&req_mem_cc_regs->start, new_drvdata->cc_base);
338339

339340
/* Then IRQ */
340-
new_drvdata->irq = platform_get_irq(plat_dev, 0);
341-
if (new_drvdata->irq < 0)
342-
return new_drvdata->irq;
341+
irq = platform_get_irq(plat_dev, 0);
342+
if (irq < 0)
343+
return irq;
343344

344345
init_completion(&new_drvdata->hw_queue_avail);
345346

@@ -442,14 +443,13 @@ static int init_cc_resources(struct platform_device *plat_dev)
442443
dev_info(dev, "ARM CryptoCell %s Driver: HW version 0x%08X/0x%8X, Driver version %s\n",
443444
hw_rev->name, hw_rev_pidr, sig_cidr, DRV_MODULE_VERSION);
444445
/* register the driver isr function */
445-
rc = devm_request_irq(dev, new_drvdata->irq, cc_isr,
446-
IRQF_SHARED, "ccree", new_drvdata);
446+
rc = devm_request_irq(dev, irq, cc_isr, IRQF_SHARED, "ccree",
447+
new_drvdata);
447448
if (rc) {
448-
dev_err(dev, "Could not register to interrupt %d\n",
449-
new_drvdata->irq);
449+
dev_err(dev, "Could not register to interrupt %d\n", irq);
450450
goto post_clk_err;
451451
}
452-
dev_dbg(dev, "Registered to IRQ: %d\n", new_drvdata->irq);
452+
dev_dbg(dev, "Registered to IRQ: %d\n", irq);
453453

454454
rc = init_cc_regs(new_drvdata, true);
455455
if (rc) {

drivers/crypto/ccree/cc_driver.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,11 @@ struct cc_crypto_req {
132132
/**
133133
* struct cc_drvdata - driver private data context
134134
* @cc_base: virt address of the CC registers
135-
* @irq: device IRQ number
136-
* @irq_mask: Interrupt mask shadow (1 for masked interrupts)
135+
* @irq: bitmap indicating source of last interrupt
137136
*/
138137
struct cc_drvdata {
139138
void __iomem *cc_base;
140139
int irq;
141-
u32 irq_mask;
142140
struct completion hw_queue_avail; /* wait for HW queue availability */
143141
struct platform_device *plat_dev;
144142
cc_sram_addr_t mlli_sram_addr;

0 commit comments

Comments
 (0)