-
Notifications
You must be signed in to change notification settings - Fork 140
ASoC: Intel: boards: remove device properties #2306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1156,6 +1156,20 @@ struct acpi_chan_package { /* ACPICA seems to require 64 bit integers */ | |
| u64 mclock_value; /* usually 25MHz (0x17d7940), ignored */ | ||
| }; | ||
|
|
||
| static int remove_properties(struct bus_type *bus, char *codec_name) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about sharing this function? Maybe even just making it an inline in a suitable header, or creating a new header for it in this directory.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I couldn't find a header for this, so I left it as an optimization. |
||
| { | ||
| struct device *dev; | ||
|
|
||
| dev = bus_find_device_by_name(bus, NULL, codec_name); | ||
| if (!dev) | ||
| return -EINVAL; | ||
|
|
||
| device_remove_properties(dev); | ||
| put_device(dev); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) | ||
| { | ||
| static const char * const map_name[] = { "dmic1", "dmic2", "in1", "in3" }; | ||
|
|
@@ -1300,7 +1314,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) | |
| * for all other errors, including -EPROBE_DEFER | ||
| */ | ||
| if (ret_val != -ENOENT) | ||
| return ret_val; | ||
| goto err; | ||
| byt_rt5640_quirk &= ~BYT_RT5640_MCLK_EN; | ||
| } | ||
| } | ||
|
|
@@ -1325,17 +1339,26 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) | |
| ret_val = snd_soc_fixup_dai_links_platform_name(&byt_rt5640_card, | ||
| platform_name); | ||
| if (ret_val) | ||
| return ret_val; | ||
| goto err; | ||
|
|
||
| ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5640_card); | ||
|
|
||
| if (ret_val) { | ||
| dev_err(&pdev->dev, "devm_snd_soc_register_card failed %d\n", | ||
| ret_val); | ||
| return ret_val; | ||
| goto err; | ||
| } | ||
| platform_set_drvdata(pdev, &byt_rt5640_card); | ||
| return ret_val; | ||
|
|
||
| err: | ||
| remove_properties(&i2c_bus_type, byt_rt5640_codec_name); | ||
| return ret_val; | ||
| } | ||
|
|
||
| static int snd_byt_rt5640_mc_remove(struct platform_device *pdev) | ||
| { | ||
| return remove_properties(&i2c_bus_type, byt_rt5640_codec_name); | ||
| } | ||
|
|
||
| static struct platform_driver snd_byt_rt5640_mc_driver = { | ||
|
|
@@ -1346,6 +1369,7 @@ static struct platform_driver snd_byt_rt5640_mc_driver = { | |
| #endif | ||
| }, | ||
| .probe = snd_byt_rt5640_mc_probe, | ||
| .remove = snd_byt_rt5640_mc_remove | ||
| }; | ||
|
|
||
| module_platform_driver(snd_byt_rt5640_mc_driver); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is rather theoretical, but this is a platform driver
.return()method. What happens if it returns an error code?rmmodfails and the module remains loaded? Is this what we want?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it matters, the driver core ignores the remove() return value.