mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 09:20:13 -04:00
crypto: talitos - Use platform_get_irq() to retrieve interrupt
Remove the need to call irq_dispose_mapping as needed by irq_of_parse_and_map(). Simplify the function as a result. No need for gotos anymore. Add a missing free_irq. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@@ -192,7 +192,7 @@ static int reset_device(struct device *dev)
|
||||
&& --timeout)
|
||||
cpu_relax();
|
||||
|
||||
if (priv->irq[1]) {
|
||||
if (priv->irq[1] > 0) {
|
||||
mcr = TALITOS_MCR_RCA1 | TALITOS_MCR_RCA3;
|
||||
setbits32(priv->reg + TALITOS_MCR, mcr);
|
||||
}
|
||||
@@ -3242,13 +3242,11 @@ static void talitos_remove(struct platform_device *ofdev)
|
||||
talitos_unregister_rng(dev);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
if (priv->irq[i]) {
|
||||
if (priv->irq[i] > 0)
|
||||
free_irq(priv->irq[i], dev);
|
||||
irq_dispose_mapping(priv->irq[i]);
|
||||
}
|
||||
|
||||
tasklet_kill(&priv->done_task[0]);
|
||||
if (priv->irq[1])
|
||||
if (priv->irq[1] > 0)
|
||||
tasklet_kill(&priv->done_task[1]);
|
||||
}
|
||||
|
||||
@@ -3354,26 +3352,26 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
|
||||
static int talitos_probe_irq(struct platform_device *ofdev)
|
||||
{
|
||||
struct device *dev = &ofdev->dev;
|
||||
struct device_node *np = ofdev->dev.of_node;
|
||||
struct talitos_private *priv = dev_get_drvdata(dev);
|
||||
int err;
|
||||
bool is_sec1 = has_ftr_sec1(priv);
|
||||
|
||||
priv->irq[0] = irq_of_parse_and_map(np, 0);
|
||||
if (!priv->irq[0]) {
|
||||
dev_err(dev, "failed to map irq\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
priv->irq[0] = platform_get_irq(ofdev, 0);
|
||||
if (priv->irq[0] < 0)
|
||||
return priv->irq[0];
|
||||
|
||||
if (is_sec1) {
|
||||
err = request_irq(priv->irq[0], talitos1_interrupt_4ch, 0,
|
||||
dev_driver_string(dev), dev);
|
||||
goto primary_out;
|
||||
}
|
||||
|
||||
priv->irq[1] = irq_of_parse_and_map(np, 1);
|
||||
priv->irq[1] = platform_get_irq_optional(ofdev, 1);
|
||||
if (priv->irq[1] == -EPROBE_DEFER)
|
||||
return priv->irq[1];
|
||||
|
||||
/* get the primary irq line */
|
||||
if (!priv->irq[1]) {
|
||||
if (priv->irq[1] < 0) {
|
||||
err = request_irq(priv->irq[0], talitos2_interrupt_4ch, 0,
|
||||
dev_driver_string(dev), dev);
|
||||
goto primary_out;
|
||||
@@ -3389,7 +3387,6 @@ static int talitos_probe_irq(struct platform_device *ofdev)
|
||||
dev_driver_string(dev), dev);
|
||||
if (err) {
|
||||
dev_err(dev, "failed to request secondary irq\n");
|
||||
irq_dispose_mapping(priv->irq[1]);
|
||||
priv->irq[1] = 0;
|
||||
}
|
||||
|
||||
@@ -3398,7 +3395,6 @@ static int talitos_probe_irq(struct platform_device *ofdev)
|
||||
primary_out:
|
||||
if (err) {
|
||||
dev_err(dev, "failed to request primary irq\n");
|
||||
irq_dispose_mapping(priv->irq[0]);
|
||||
priv->irq[0] = 0;
|
||||
}
|
||||
|
||||
@@ -3499,7 +3495,7 @@ static int talitos_probe(struct platform_device *ofdev)
|
||||
tasklet_init(&priv->done_task[0], talitos1_done_4ch,
|
||||
(unsigned long)dev);
|
||||
} else {
|
||||
if (priv->irq[1]) {
|
||||
if (priv->irq[1] > 0) {
|
||||
tasklet_init(&priv->done_task[0], talitos2_done_ch0_2,
|
||||
(unsigned long)dev);
|
||||
tasklet_init(&priv->done_task[1], talitos2_done_ch1_3,
|
||||
@@ -3517,7 +3513,7 @@ static int talitos_probe(struct platform_device *ofdev)
|
||||
|
||||
for (i = 0; i < priv->num_channels; i++) {
|
||||
priv->chan[i].reg = priv->reg + stride * (i + 1);
|
||||
if (!priv->irq[1] || !(i & 1))
|
||||
if (priv->irq[1] < 0 || !(i & 1))
|
||||
priv->chan[i].reg += TALITOS_CH_BASE_OFFSET;
|
||||
|
||||
spin_lock_init(&priv->chan[i].head_lock);
|
||||
|
||||
Reference in New Issue
Block a user