Re: [PATCH 04/10] ASoC: cs42l42: Split probe() and remove() into stages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/09/2022 14:53, Martin Povišer wrote:
+static int cs42l42_init(struct cs42l42_private *cs42l42)
+{
+	unsigned int reg;
+	int devid, ret;
+
  	/* initialize codec */
  	devid = cirrus_read_device_id(cs42l42->regmap, CS42L42_DEVID_AB);
  	if (devid < 0) {
@@ -2320,15 +2331,15 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client)
  	/* Setup headset detection */
  	cs42l42_setup_hs_type_detect(cs42l42);
+ /*
+	 * Set init_done before unmasking interrupts so any triggered
+	 * immediately will be handled.
+	 */
+	cs42l42->init_done = true;
+
  	/* Mask/Unmask Interrupts */
  	cs42l42_set_interrupt_masks(cs42l42);
- /* Register codec for machine driver */
-	ret = devm_snd_soc_register_component(cs42l42->dev,
-			&soc_component_dev_cs42l42, &cs42l42_dai, 1);
-	if (ret < 0)
-		goto err_shutdown;
-
  	return 0;
err_shutdown:
@@ -2337,34 +2348,69 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client)
  	regmap_write(cs42l42->regmap, CS42L42_PWR_CTL1, 0xff);
err_disable:
-	if (i2c_client->irq)
-		free_irq(i2c_client->irq, cs42l42);
-

These 3 lines should not be removed. cs42l42_init() must free
the irq in the error paths.



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux