|
7 | 7 | // Author: Mark Brown <[email protected]>
|
8 | 8 | // Liam Girdwood <[email protected]>
|
9 | 9 |
|
10 |
| -#include <linux/platform_device.h> |
| 10 | +#include <linux/device/faux.h> |
11 | 11 | #include <linux/export.h>
|
12 | 12 | #include <linux/math.h>
|
13 | 13 | #include <sound/core.h>
|
@@ -262,48 +262,38 @@ struct snd_soc_dai_link_component snd_soc_dummy_dlc = {
|
262 | 262 | };
|
263 | 263 | EXPORT_SYMBOL_GPL(snd_soc_dummy_dlc);
|
264 | 264 |
|
265 |
| -static int snd_soc_dummy_probe(struct platform_device *pdev) |
| 265 | +static int snd_soc_dummy_probe(struct faux_device *fdev) |
266 | 266 | {
|
267 | 267 | int ret;
|
268 | 268 |
|
269 |
| - ret = devm_snd_soc_register_component(&pdev->dev, |
| 269 | + ret = devm_snd_soc_register_component(&fdev->dev, |
270 | 270 | &dummy_codec, &dummy_dai, 1);
|
271 | 271 | if (ret < 0)
|
272 | 272 | return ret;
|
273 | 273 |
|
274 |
| - ret = devm_snd_soc_register_component(&pdev->dev, &dummy_platform, |
| 274 | + ret = devm_snd_soc_register_component(&fdev->dev, &dummy_platform, |
275 | 275 | NULL, 0);
|
276 | 276 |
|
277 | 277 | return ret;
|
278 | 278 | }
|
279 | 279 |
|
280 |
| -static struct platform_driver soc_dummy_driver = { |
281 |
| - .driver = { |
282 |
| - .name = "snd-soc-dummy", |
283 |
| - }, |
| 280 | +static struct faux_device_ops soc_dummy_ops = { |
284 | 281 | .probe = snd_soc_dummy_probe,
|
285 | 282 | };
|
286 | 283 |
|
287 |
| -static struct platform_device *soc_dummy_dev; |
| 284 | +static struct faux_device *soc_dummy_dev; |
288 | 285 |
|
289 | 286 | int __init snd_soc_util_init(void)
|
290 | 287 | {
|
291 |
| - int ret; |
292 |
| - |
293 |
| - soc_dummy_dev = |
294 |
| - platform_device_register_simple("snd-soc-dummy", -1, NULL, 0); |
295 |
| - if (IS_ERR(soc_dummy_dev)) |
296 |
| - return PTR_ERR(soc_dummy_dev); |
| 288 | + soc_dummy_dev = faux_device_create("snd-soc-dummy", NULL, |
| 289 | + &soc_dummy_ops); |
| 290 | + if (!soc_dummy_dev) |
| 291 | + return -ENODEV; |
297 | 292 |
|
298 |
| - ret = platform_driver_register(&soc_dummy_driver); |
299 |
| - if (ret != 0) |
300 |
| - platform_device_unregister(soc_dummy_dev); |
301 |
| - |
302 |
| - return ret; |
| 293 | + return 0; |
303 | 294 | }
|
304 | 295 |
|
305 | 296 | void snd_soc_util_exit(void)
|
306 | 297 | {
|
307 |
| - platform_driver_unregister(&soc_dummy_driver); |
308 |
| - platform_device_unregister(soc_dummy_dev); |
| 298 | + faux_device_destroy(soc_dummy_dev); |
309 | 299 | }
|
0 commit comments