aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/config_roms.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-26 19:36:50 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-04-29 18:00:30 -0400
commit70093cfde8af52b0b9030d90f9004cbde38f2ff8 (patch)
treef9230ca354e78b129898298095a6ee887c40a16d /drivers/ieee1394/config_roms.c
parente00f04a70fa387b3accc81b5c346200f836e2a52 (diff)
ieee1394: eth1394: don't autoload by hotplug when ohci1394 starts
Until now, ieee1394 put an IP-over-1394 capability entry into each new host's config ROM. As soon as the controller was initialized --- i.e. right after modprobe ohci1394 --- this entry triggered a hotplug event which typically caused auto-loading of eth1394. This irritated or annoyed many users and distributors. Of course they could blacklist eth1394, but then ieee1394 wrongly advertized IP-over- 1394 capability to the FireWire bus. Therefore - remove the offending kernel config option IEEE1394_CONFIG_ROM_IP1394, - let eth1394 add the ROM entry by itself, i.e. only after eth1394 was loaded. This fixes http://bugzilla.kernel.org/show_bug.cgi?id=7793 . To emulate the behaviour of older kernels, simply add the following to to /etc/modprobe.conf: install ohci1394 /sbin/modprobe eth1394; \ /sbin/modprobe --ignore-install ohci1394 Note, autoloading of eth1394 when an _external_ IP-over-1394 capable device is discovered is _not_ affected by this patch. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/ieee1394/config_roms.c')
-rw-r--r--drivers/ieee1394/config_roms.c76
1 files changed, 15 insertions, 61 deletions
diff --git a/drivers/ieee1394/config_roms.c b/drivers/ieee1394/config_roms.c
index 556658a1db2..1b981207fa7 100644
--- a/drivers/ieee1394/config_roms.c
+++ b/drivers/ieee1394/config_roms.c
@@ -26,12 +26,6 @@ struct hpsb_config_rom_entry {
26 /* Base initialization, called at module load */ 26 /* Base initialization, called at module load */
27 int (*init)(void); 27 int (*init)(void);
28 28
29 /* Add entry to specified host */
30 int (*add)(struct hpsb_host *host);
31
32 /* Remove entry from specified host */
33 void (*remove)(struct hpsb_host *host);
34
35 /* Cleanup called at module exit */ 29 /* Cleanup called at module exit */
36 void (*cleanup)(void); 30 void (*cleanup)(void);
37 31
@@ -78,7 +72,7 @@ int hpsb_default_host_entry(struct hpsb_host *host)
78} 72}
79 73
80 74
81#ifdef CONFIG_IEEE1394_CONFIG_ROM_IP1394 75#ifdef CONFIG_IEEE1394_ETH1394_ROM_ENTRY
82#include "eth1394.h" 76#include "eth1394.h"
83 77
84static struct csr1212_keyval *ip1394_ud; 78static struct csr1212_keyval *ip1394_ud;
@@ -137,7 +131,7 @@ static void config_rom_ip1394_cleanup(void)
137 } 131 }
138} 132}
139 133
140static int config_rom_ip1394_add(struct hpsb_host *host) 134int hpsb_config_rom_ip1394_add(struct hpsb_host *host)
141{ 135{
142 if (!ip1394_ud) 136 if (!ip1394_ud)
143 return -ENODEV; 137 return -ENODEV;
@@ -146,30 +140,33 @@ static int config_rom_ip1394_add(struct hpsb_host *host)
146 ip1394_ud) != CSR1212_SUCCESS) 140 ip1394_ud) != CSR1212_SUCCESS)
147 return -ENOMEM; 141 return -ENOMEM;
148 142
143 host->config_roms |= HPSB_CONFIG_ROM_ENTRY_IP1394;
144 host->update_config_rom = 1;
149 return 0; 145 return 0;
150} 146}
147EXPORT_SYMBOL_GPL(hpsb_config_rom_ip1394_add);
151 148
152static void config_rom_ip1394_remove(struct hpsb_host *host) 149void hpsb_config_rom_ip1394_remove(struct hpsb_host *host)
153{ 150{
154 csr1212_detach_keyval_from_directory(host->csr.rom->root_kv, ip1394_ud); 151 csr1212_detach_keyval_from_directory(host->csr.rom->root_kv, ip1394_ud);
152 host->config_roms &= ~HPSB_CONFIG_ROM_ENTRY_IP1394;
153 host->update_config_rom = 1;
155} 154}
155EXPORT_SYMBOL_GPL(hpsb_config_rom_ip1394_remove);
156 156
157static struct hpsb_config_rom_entry ip1394_entry = { 157static struct hpsb_config_rom_entry ip1394_entry = {
158 .name = "ip1394", 158 .name = "ip1394",
159 .init = config_rom_ip1394_init, 159 .init = config_rom_ip1394_init,
160 .add = config_rom_ip1394_add,
161 .remove = config_rom_ip1394_remove,
162 .cleanup = config_rom_ip1394_cleanup, 160 .cleanup = config_rom_ip1394_cleanup,
163 .flag = HPSB_CONFIG_ROM_ENTRY_IP1394, 161 .flag = HPSB_CONFIG_ROM_ENTRY_IP1394,
164}; 162};
165#endif /* CONFIG_IEEE1394_CONFIG_ROM_IP1394 */
166 163
164#endif /* CONFIG_IEEE1394_ETH1394_ROM_ENTRY */
167 165
168static struct hpsb_config_rom_entry *const config_rom_entries[] = { 166static struct hpsb_config_rom_entry *const config_rom_entries[] = {
169#ifdef CONFIG_IEEE1394_CONFIG_ROM_IP1394 167#ifdef CONFIG_IEEE1394_ETH1394_ROM_ENTRY
170 &ip1394_entry, 168 &ip1394_entry,
171#endif 169#endif
172 NULL,
173}; 170};
174 171
175/* Initialize all config roms */ 172/* Initialize all config roms */
@@ -177,18 +174,12 @@ int hpsb_init_config_roms(void)
177{ 174{
178 int i, error = 0; 175 int i, error = 0;
179 176
180 for (i = 0; config_rom_entries[i]; i++) { 177 for (i = 0; i < ARRAY_SIZE(config_rom_entries); i++)
181 if (!config_rom_entries[i]->init)
182 continue;
183
184 if (config_rom_entries[i]->init()) { 178 if (config_rom_entries[i]->init()) {
185 HPSB_ERR("Failed to initialize config rom entry `%s'", 179 HPSB_ERR("Failed to initialize config rom entry `%s'",
186 config_rom_entries[i]->name); 180 config_rom_entries[i]->name);
187 error = -1; 181 error = -1;
188 } else 182 }
189 HPSB_DEBUG("Initialized config rom entry `%s'",
190 config_rom_entries[i]->name);
191 }
192 183
193 return error; 184 return error;
194} 185}
@@ -198,43 +189,6 @@ void hpsb_cleanup_config_roms(void)
198{ 189{
199 int i; 190 int i;
200 191
201 for (i = 0; config_rom_entries[i]; i++) { 192 for (i = 0; i < ARRAY_SIZE(config_rom_entries); i++)
202 if (config_rom_entries[i]->cleanup) 193 config_rom_entries[i]->cleanup();
203 config_rom_entries[i]->cleanup();
204 }
205}
206
207/* Add extra config roms to specified host */
208int hpsb_add_extra_config_roms(struct hpsb_host *host)
209{
210 int i, error = 0;
211
212 for (i = 0; config_rom_entries[i]; i++) {
213 if (config_rom_entries[i]->add(host)) {
214 HPSB_ERR("fw-host%d: Failed to attach config rom entry `%s'",
215 host->id, config_rom_entries[i]->name);
216 error = -1;
217 } else {
218 host->config_roms |= config_rom_entries[i]->flag;
219 host->update_config_rom = 1;
220 }
221 }
222
223 return error;
224}
225
226/* Remove extra config roms from specified host */
227void hpsb_remove_extra_config_roms(struct hpsb_host *host)
228{
229 int i;
230
231 for (i = 0; config_rom_entries[i]; i++) {
232 if (!(host->config_roms & config_rom_entries[i]->flag))
233 continue;
234
235 config_rom_entries[i]->remove(host);
236
237 host->config_roms &= ~config_rom_entries[i]->flag;
238 host->update_config_rom = 1;
239 }
240} 194}