提交 6f08cbda 编写于 作者: L Lukas Wunner 提交者: Mark Brown

ASoC: Intel: Use acpi_dev_present()

Use shiny new acpi_dev_present() and remove all the boilerplate
to search for a particular ACPI device. No functional change.
Cf. 2d12b6b3 ("ACPI / utils: Add acpi_dev_present()").
Signed-off-by: NLukas Wunner <lukas@wunner.de>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 92e963f5
...@@ -287,33 +287,20 @@ static struct snd_soc_card snd_soc_card_cht = { ...@@ -287,33 +287,20 @@ static struct snd_soc_card snd_soc_card_cht = {
.num_controls = ARRAY_SIZE(cht_mc_controls), .num_controls = ARRAY_SIZE(cht_mc_controls),
}; };
static acpi_status snd_acpi_codec_match(acpi_handle handle, u32 level,
void *context, void **ret)
{
*(bool *)context = true;
return AE_OK;
}
static int snd_cht_mc_probe(struct platform_device *pdev) static int snd_cht_mc_probe(struct platform_device *pdev)
{ {
int ret_val = 0; int ret_val = 0;
bool found = false;
struct cht_mc_private *drv; struct cht_mc_private *drv;
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC); drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC);
if (!drv) if (!drv)
return -ENOMEM; return -ENOMEM;
if (ACPI_SUCCESS(acpi_get_devices( drv->ts3a227e_present = acpi_dev_present("104C227E");
"104C227E", if (!drv->ts3a227e_present) {
snd_acpi_codec_match,
&found, NULL)) && found) {
drv->ts3a227e_present = true;
} else {
/* no need probe TI jack detection chip */ /* no need probe TI jack detection chip */
snd_soc_card_cht.aux_dev = NULL; snd_soc_card_cht.aux_dev = NULL;
snd_soc_card_cht.num_aux_devs = 0; snd_soc_card_cht.num_aux_devs = 0;
drv->ts3a227e_present = false;
} }
/* register the soc card */ /* register the soc card */
......
...@@ -333,20 +333,12 @@ static struct cht_acpi_card snd_soc_cards[] = { ...@@ -333,20 +333,12 @@ static struct cht_acpi_card snd_soc_cards[] = {
{"10EC5650", CODEC_TYPE_RT5650, &snd_soc_card_chtrt5650}, {"10EC5650", CODEC_TYPE_RT5650, &snd_soc_card_chtrt5650},
}; };
static acpi_status snd_acpi_codec_match(acpi_handle handle, u32 level,
void *context, void **ret)
{
*(bool *)context = true;
return AE_OK;
}
static int snd_cht_mc_probe(struct platform_device *pdev) static int snd_cht_mc_probe(struct platform_device *pdev)
{ {
int ret_val = 0; int ret_val = 0;
int i; int i;
struct cht_mc_private *drv; struct cht_mc_private *drv;
struct snd_soc_card *card = snd_soc_cards[0].soc_card; struct snd_soc_card *card = snd_soc_cards[0].soc_card;
bool found = false;
char codec_name[16]; char codec_name[16];
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC); drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC);
...@@ -354,10 +346,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) ...@@ -354,10 +346,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < ARRAY_SIZE(snd_soc_cards); i++) { for (i = 0; i < ARRAY_SIZE(snd_soc_cards); i++) {
if (ACPI_SUCCESS(acpi_get_devices( if (acpi_dev_present(snd_soc_cards[i].codec_id)) {
snd_soc_cards[i].codec_id,
snd_acpi_codec_match,
&found, NULL)) && found) {
dev_dbg(&pdev->dev, dev_dbg(&pdev->dev,
"found codec %s\n", snd_soc_cards[i].codec_id); "found codec %s\n", snd_soc_cards[i].codec_id);
card = snd_soc_cards[i].soc_card; card = snd_soc_cards[i].soc_card;
......
...@@ -13,29 +13,15 @@ ...@@ -13,29 +13,15 @@
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details. * more details.
*/ */
#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include "sst-acpi.h" #include "sst-acpi.h"
static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
void *context, void **ret)
{
*(bool *)context = true;
return AE_OK;
}
struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines) struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
{ {
struct sst_acpi_mach *mach; struct sst_acpi_mach *mach;
bool found = false;
for (mach = machines; mach->id[0]; mach++) for (mach = machines; mach->id[0]; mach++)
if (ACPI_SUCCESS(acpi_get_devices(mach->id, if (acpi_dev_present(mach->id))
sst_acpi_mach_match,
&found, NULL)) && found)
return mach; return mach;
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册