@@ -27,7 +27,6 @@ static int cs35l56_i2c_probe(struct i2c_client *client)
return -ENOMEM;
cs35l56->dev = dev;
- cs35l56->irq = client->irq;
cs35l56->can_hibernate = true;
i2c_set_clientdata(client, cs35l56);
@@ -43,7 +42,7 @@ static int cs35l56_i2c_probe(struct i2c_client *client)
ret = cs35l56_init(cs35l56);
if (ret == 0)
- ret = cs35l56_irq_request(cs35l56);
+ ret = cs35l56_irq_request(cs35l56, client->irq);
if (ret < 0)
cs35l56_remove(cs35l56);
@@ -32,7 +32,6 @@ static int cs35l56_spi_probe(struct spi_device *spi)
}
cs35l56->dev = &spi->dev;
- cs35l56->irq = spi->irq;
ret = cs35l56_common_probe(cs35l56);
if (ret != 0)
@@ -40,7 +39,7 @@ static int cs35l56_spi_probe(struct spi_device *spi)
ret = cs35l56_init(cs35l56);
if (ret == 0)
- ret = cs35l56_irq_request(cs35l56);
+ ret = cs35l56_irq_request(cs35l56, spi->irq);
if (ret < 0)
cs35l56_remove(cs35l56);
@@ -423,18 +423,19 @@ irqreturn_t cs35l56_irq(int irq, void *data)
}
EXPORT_SYMBOL_NS_GPL(cs35l56_irq, SND_SOC_CS35L56_CORE);
-int cs35l56_irq_request(struct cs35l56_private *cs35l56)
+int cs35l56_irq_request(struct cs35l56_private *cs35l56, int irq)
{
int ret;
- if (!cs35l56->irq)
+ if (!irq)
return 0;
- ret = devm_request_threaded_irq(cs35l56->dev, cs35l56->irq, NULL,
- cs35l56_irq,
+ ret = devm_request_threaded_irq(cs35l56->dev, irq, NULL, cs35l56_irq,
IRQF_ONESHOT | IRQF_SHARED | IRQF_TRIGGER_LOW,
"cs35l56", cs35l56);
- if (ret < 0)
+ if (!ret)
+ cs35l56->irq = irq;
+ else
dev_err(cs35l56->dev, "Failed to get IRQ: %d\n", ret);
return ret;
@@ -74,7 +74,7 @@ int cs35l56_system_resume_no_irq(struct device *dev);
int cs35l56_system_resume_early(struct device *dev);
int cs35l56_system_resume(struct device *dev);
irqreturn_t cs35l56_irq(int irq, void *data);
-int cs35l56_irq_request(struct cs35l56_private *cs35l56);
+int cs35l56_irq_request(struct cs35l56_private *cs35l56, int irq);
int cs35l56_common_probe(struct cs35l56_private *cs35l56);
int cs35l56_init(struct cs35l56_private *cs35l56);
int cs35l56_remove(struct cs35l56_private *cs35l56);