diff options
author | Wolfram Sang <wsa@the-dreams.de> | 2015-05-09 13:42:22 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-05-18 05:25:44 -0400 |
commit | ac397c80de895094cbb72264c279fade45447cbf (patch) | |
tree | 2d008fc2e70e739b3ac1d95ccb894c968cec59e3 | |
parent | 108c5df14a5fcc4a5470df2de091c48d54a553a3 (diff) |
ALSA: ppc: keywest: drop using attach adapter
As we now have deferred probing, we can use a custom mechanism and
finally get rid of this legacy interface from the i2c core.
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Tested-by: Dan DeVoto <dand1972@yahoo.com>
Tested-by: Mark Elliott <txlitebeer@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/ppc/keywest.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index 0d1c27e911b8..d7627bae0836 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c | |||
@@ -52,7 +52,7 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter) | |||
52 | return -EINVAL; | 52 | return -EINVAL; |
53 | 53 | ||
54 | if (strncmp(adapter->name, "mac-io", 6)) | 54 | if (strncmp(adapter->name, "mac-io", 6)) |
55 | return 0; /* ignored */ | 55 | return -EINVAL; /* ignored */ |
56 | 56 | ||
57 | memset(&info, 0, sizeof(struct i2c_board_info)); | 57 | memset(&info, 0, sizeof(struct i2c_board_info)); |
58 | strlcpy(info.type, "keywest", I2C_NAME_SIZE); | 58 | strlcpy(info.type, "keywest", I2C_NAME_SIZE); |
@@ -100,7 +100,6 @@ static struct i2c_driver keywest_driver = { | |||
100 | .driver = { | 100 | .driver = { |
101 | .name = "PMac Keywest Audio", | 101 | .name = "PMac Keywest Audio", |
102 | }, | 102 | }, |
103 | .attach_adapter = keywest_attach_adapter, | ||
104 | .probe = keywest_probe, | 103 | .probe = keywest_probe, |
105 | .remove = keywest_remove, | 104 | .remove = keywest_remove, |
106 | .id_table = keywest_i2c_id, | 105 | .id_table = keywest_i2c_id, |
@@ -132,16 +131,32 @@ int snd_pmac_tumbler_post_init(void) | |||
132 | /* exported */ | 131 | /* exported */ |
133 | int snd_pmac_keywest_init(struct pmac_keywest *i2c) | 132 | int snd_pmac_keywest_init(struct pmac_keywest *i2c) |
134 | { | 133 | { |
135 | int err; | 134 | struct i2c_adapter *adap; |
135 | int err, i = 0; | ||
136 | 136 | ||
137 | if (keywest_ctx) | 137 | if (keywest_ctx) |
138 | return -EBUSY; | 138 | return -EBUSY; |
139 | 139 | ||
140 | adap = i2c_get_adapter(0); | ||
141 | if (!adap) | ||
142 | return -EPROBE_DEFER; | ||
143 | |||
140 | keywest_ctx = i2c; | 144 | keywest_ctx = i2c; |
141 | 145 | ||
142 | if ((err = i2c_add_driver(&keywest_driver))) { | 146 | if ((err = i2c_add_driver(&keywest_driver))) { |
143 | snd_printk(KERN_ERR "cannot register keywest i2c driver\n"); | 147 | snd_printk(KERN_ERR "cannot register keywest i2c driver\n"); |
148 | i2c_put_adapter(adap); | ||
144 | return err; | 149 | return err; |
145 | } | 150 | } |
146 | return 0; | 151 | |
152 | /* We assume Macs have consecutive I2C bus numbers starting at 0 */ | ||
153 | while (adap) { | ||
154 | err = keywest_attach_adapter(adap); | ||
155 | if (!err) | ||
156 | return 0; | ||
157 | i2c_put_adapter(adap); | ||
158 | adap = i2c_get_adapter(++i); | ||
159 | } | ||
160 | |||
161 | return -ENODEV; | ||
147 | } | 162 | } |