ASoC: SDCA: Add missing destroy for HID device

The SDCA code is currently missing a cleanup for HID devices when the
drivers are unbound. Add the missing HID cleanup as part of the IRQ
cleanup to mirror when the HID device is created.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Link: https://patch.msgid.link/20260805124205.4152543-7-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Charles Keepax
2026-08-05 13:42:03 +01:00
committed by Mark Brown
parent 01dba3e934
commit df1fd5d8ab
3 changed files with 19 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ struct sdca_interrupt;
#if IS_ENABLED(CONFIG_SND_SOC_SDCA_HID)
int sdca_add_hid_device(struct sdca_interrupt *interrupt);
void sdca_destroy_hid_device(struct sdca_interrupt *interrupt);
int sdca_hid_process_report(struct sdca_interrupt *interrupt);
#else
@@ -26,6 +27,10 @@ static inline int sdca_add_hid_device(struct sdca_interrupt *interrupt)
return 0;
}
static inline void sdca_destroy_hid_device(struct sdca_interrupt *interrupt)
{
}
static inline int sdca_hid_process_report(struct sdca_interrupt *interrupt)
{
return 0;

View File

@@ -122,6 +122,18 @@ int sdca_add_hid_device(struct sdca_interrupt *interrupt)
}
EXPORT_SYMBOL_NS(sdca_add_hid_device, "SND_SOC_SDCA");
/**
* sdca_destroy_hid_device - destroy the HID device
* @interrupt: Pointer to the SDCA interrupt information structure.
*/
void sdca_destroy_hid_device(struct sdca_interrupt *interrupt)
{
struct hid_device *hid = interrupt->priv;
hid_destroy_device(hid);
}
EXPORT_SYMBOL_NS(sdca_destroy_hid_device, "SND_SOC_SDCA");
/**
* sdca_hid_process_report - read a HID event from the device and report
* @interrupt: Pointer to the SDCA interrupt information structure.

View File

@@ -487,6 +487,8 @@ int sdca_irq_populate_early(struct device *dev, struct regmap *regmap,
}
break;
case SDCA_CTL_TYPE_S(HIDE, HIDTX_CURRENTOWNER):
interrupt->free_priv = sdca_destroy_hid_device;
ret = sdca_add_hid_device(interrupt);
if (ret)
return ret;