diff options
author | Jonas Bonn <jonas.bonn@gmail.com> | 2008-10-01 15:47:19 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-10-12 20:18:20 -0400 |
commit | f9d1ab39e8c993f183c39a9724ca5ad29b6336e9 (patch) | |
tree | 95f4a4f821573cc1a27df69149322adc03ff91cb /sound/soc/s3c24xx | |
parent | df20cf92cae5640568ee3d48bf7a32987c057413 (diff) |
ALSA: ASoC: Drop device registration from GTA01 lm4857 driver
Device registration should be handled at the machine level and not
in the driver code itself. This patch removes the device registration
from the driver code in preparation for moving it to the machine
definition.
[Squashed down two parts to this patch for bisectability - there's also
a third part adding registration of the device to the out of tree GTA01
machine driver -- broonie]
Signed-off-by: Jonas Bonn <jonas.bonn@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/soc/s3c24xx')
-rw-r--r-- | sound/soc/s3c24xx/neo1973_wm8753.c | 51 |
1 files changed, 6 insertions, 45 deletions
diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c index f7fc231e238e..87ddfefcc2fb 100644 --- a/sound/soc/s3c24xx/neo1973_wm8753.c +++ b/sound/soc/s3c24xx/neo1973_wm8753.c | |||
@@ -602,6 +602,8 @@ static int lm4857_i2c_probe(struct i2c_client *client, | |||
602 | { | 602 | { |
603 | DBG("Entered %s\n", __func__); | 603 | DBG("Entered %s\n", __func__); |
604 | 604 | ||
605 | i2c = client; | ||
606 | |||
605 | lm4857_write_regs(); | 607 | lm4857_write_regs(); |
606 | return 0; | 608 | return 0; |
607 | } | 609 | } |
@@ -610,6 +612,8 @@ static int lm4857_i2c_remove(struct i2c_client *client) | |||
610 | { | 612 | { |
611 | DBG("Entered %s\n", __func__); | 613 | DBG("Entered %s\n", __func__); |
612 | 614 | ||
615 | i2c = NULL; | ||
616 | |||
613 | return 0; | 617 | return 0; |
614 | } | 618 | } |
615 | 619 | ||
@@ -667,48 +671,6 @@ static struct i2c_driver lm4857_i2c_driver = { | |||
667 | }; | 671 | }; |
668 | 672 | ||
669 | static struct platform_device *neo1973_snd_device; | 673 | static struct platform_device *neo1973_snd_device; |
670 | static struct i2c_client *lm4857_client; | ||
671 | |||
672 | static int __init neo1973_add_lm4857_device(struct platform_device *pdev, | ||
673 | int i2c_bus, | ||
674 | unsigned short i2c_address) | ||
675 | { | ||
676 | struct i2c_board_info info; | ||
677 | struct i2c_adapter *adapter; | ||
678 | struct i2c_client *client; | ||
679 | int ret; | ||
680 | |||
681 | ret = i2c_add_driver(&lm4857_i2c_driver); | ||
682 | if (ret != 0) { | ||
683 | dev_err(&pdev->dev, "can't add lm4857 driver\n"); | ||
684 | return ret; | ||
685 | } | ||
686 | |||
687 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
688 | info.addr = i2c_address; | ||
689 | strlcpy(info.type, "neo1973_lm4857", I2C_NAME_SIZE); | ||
690 | |||
691 | adapter = i2c_get_adapter(i2c_bus); | ||
692 | if (!adapter) { | ||
693 | dev_err(&pdev->dev, "can't get i2c adapter %d\n", i2c_bus); | ||
694 | goto err_driver; | ||
695 | } | ||
696 | |||
697 | client = i2c_new_device(adapter, &info); | ||
698 | i2c_put_adapter(adapter); | ||
699 | if (!client) { | ||
700 | dev_err(&pdev->dev, "can't add lm4857 device at 0x%x\n", | ||
701 | (unsigned int)info.addr); | ||
702 | goto err_driver; | ||
703 | } | ||
704 | |||
705 | lm4857_client = client; | ||
706 | return 0; | ||
707 | |||
708 | err_driver: | ||
709 | i2c_del_driver(&lm4857_i2c_driver); | ||
710 | return -ENODEV; | ||
711 | } | ||
712 | 674 | ||
713 | static int __init neo1973_init(void) | 675 | static int __init neo1973_init(void) |
714 | { | 676 | { |
@@ -735,8 +697,8 @@ static int __init neo1973_init(void) | |||
735 | return ret; | 697 | return ret; |
736 | } | 698 | } |
737 | 699 | ||
738 | ret = neo1973_add_lm4857_device(neo1973_snd_device, | 700 | ret = i2c_add_driver(&lm4857_i2c_driver); |
739 | 0, 0x7C); | 701 | |
740 | if (ret != 0) | 702 | if (ret != 0) |
741 | platform_device_unregister(neo1973_snd_device); | 703 | platform_device_unregister(neo1973_snd_device); |
742 | 704 | ||
@@ -747,7 +709,6 @@ static void __exit neo1973_exit(void) | |||
747 | { | 709 | { |
748 | DBG("Entered %s\n", __func__); | 710 | DBG("Entered %s\n", __func__); |
749 | 711 | ||
750 | i2c_unregister_device(lm4857_client); | ||
751 | i2c_del_driver(&lm4857_i2c_driver); | 712 | i2c_del_driver(&lm4857_i2c_driver); |
752 | platform_device_unregister(neo1973_snd_device); | 713 | platform_device_unregister(neo1973_snd_device); |
753 | } | 714 | } |