Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+36 -86
+9 -20
drivers/ieee1394/Kconfig
··· 34 34 Say Y if you really want or need the debugging output, everyone 35 35 else says N. 36 36 37 - config IEEE1394_EXTRA_CONFIG_ROMS 38 - bool "Build in extra config rom entries for certain functionality" 39 - depends on IEEE1394 40 - help 41 - Some IEEE1394 functionality depends on extra config rom entries 42 - being available in the host adapters CSR. These options will 43 - allow you to choose which ones. 44 - 45 - config IEEE1394_CONFIG_ROM_IP1394 46 - bool "IP-1394 Entry" 47 - depends on IEEE1394_EXTRA_CONFIG_ROMS && IEEE1394 48 - help 49 - Adds an entry for using IP-over-1394. If you want to use your 50 - IEEE1394 bus as a network for IP systems (including interacting 51 - with MacOSX and WinXP IP-over-1394), enable this option and the 52 - eth1394 option below. 53 - 54 37 comment "Device Drivers" 55 38 depends on IEEE1394 56 39 ··· 103 120 This option is buggy and currently broken on some architectures. 104 121 If unsure, say N. 105 122 123 + config IEEE1394_ETH1394_ROM_ENTRY 124 + depends on IEEE1394 125 + bool 126 + default n 127 + 106 128 config IEEE1394_ETH1394 107 - tristate "Ethernet over 1394" 129 + tristate "IP over 1394" 108 130 depends on IEEE1394 && EXPERIMENTAL && INET 109 - select IEEE1394_CONFIG_ROM_IP1394 110 - select IEEE1394_EXTRA_CONFIG_ROMS 131 + select IEEE1394_ETH1394_ROM_ENTRY 111 132 help 112 133 This driver implements a functional majority of RFC 2734: IPv4 over 113 134 1394. It will provide IP connectivity with implementations of RFC ··· 119 132 older versions of this driver found in stock kernels prior to 2.6.3. 120 133 This driver is still considered experimental. It does not yet support 121 134 MCAP, therefore multicast support is significantly limited. 135 + 136 + The module is called eth1394 although it does not emulate Ethernet. 122 137 123 138 config IEEE1394_DV1394 124 139 tristate "OHCI-DV I/O support (deprecated)"
+15 -61
drivers/ieee1394/config_roms.c
··· 26 26 /* Base initialization, called at module load */ 27 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 29 /* Cleanup called at module exit */ 36 30 void (*cleanup)(void); 37 31 ··· 72 78 } 73 79 74 80 75 - #ifdef CONFIG_IEEE1394_CONFIG_ROM_IP1394 81 + #ifdef CONFIG_IEEE1394_ETH1394_ROM_ENTRY 76 82 #include "eth1394.h" 77 83 78 84 static struct csr1212_keyval *ip1394_ud; ··· 131 137 } 132 138 } 133 139 134 - static int config_rom_ip1394_add(struct hpsb_host *host) 140 + int hpsb_config_rom_ip1394_add(struct hpsb_host *host) 135 141 { 136 142 if (!ip1394_ud) 137 143 return -ENODEV; ··· 140 146 ip1394_ud) != CSR1212_SUCCESS) 141 147 return -ENOMEM; 142 148 149 + host->config_roms |= HPSB_CONFIG_ROM_ENTRY_IP1394; 150 + host->update_config_rom = 1; 143 151 return 0; 144 152 } 153 + EXPORT_SYMBOL_GPL(hpsb_config_rom_ip1394_add); 145 154 146 - static void config_rom_ip1394_remove(struct hpsb_host *host) 155 + void hpsb_config_rom_ip1394_remove(struct hpsb_host *host) 147 156 { 148 157 csr1212_detach_keyval_from_directory(host->csr.rom->root_kv, ip1394_ud); 158 + host->config_roms &= ~HPSB_CONFIG_ROM_ENTRY_IP1394; 159 + host->update_config_rom = 1; 149 160 } 161 + EXPORT_SYMBOL_GPL(hpsb_config_rom_ip1394_remove); 150 162 151 163 static struct hpsb_config_rom_entry ip1394_entry = { 152 164 .name = "ip1394", 153 165 .init = config_rom_ip1394_init, 154 - .add = config_rom_ip1394_add, 155 - .remove = config_rom_ip1394_remove, 156 166 .cleanup = config_rom_ip1394_cleanup, 157 167 .flag = HPSB_CONFIG_ROM_ENTRY_IP1394, 158 168 }; 159 - #endif /* CONFIG_IEEE1394_CONFIG_ROM_IP1394 */ 160 169 170 + #endif /* CONFIG_IEEE1394_ETH1394_ROM_ENTRY */ 161 171 162 172 static struct hpsb_config_rom_entry *const config_rom_entries[] = { 163 - #ifdef CONFIG_IEEE1394_CONFIG_ROM_IP1394 173 + #ifdef CONFIG_IEEE1394_ETH1394_ROM_ENTRY 164 174 &ip1394_entry, 165 175 #endif 166 - NULL, 167 176 }; 168 177 169 178 /* Initialize all config roms */ ··· 174 177 { 175 178 int i, error = 0; 176 179 177 - for (i = 0; config_rom_entries[i]; i++) { 178 - if (!config_rom_entries[i]->init) 179 - continue; 180 - 180 + for (i = 0; i < ARRAY_SIZE(config_rom_entries); i++) 181 181 if (config_rom_entries[i]->init()) { 182 182 HPSB_ERR("Failed to initialize config rom entry `%s'", 183 183 config_rom_entries[i]->name); 184 184 error = -1; 185 - } else 186 - HPSB_DEBUG("Initialized config rom entry `%s'", 187 - config_rom_entries[i]->name); 188 - } 185 + } 189 186 190 187 return error; 191 188 } ··· 189 198 { 190 199 int i; 191 200 192 - for (i = 0; config_rom_entries[i]; i++) { 193 - if (config_rom_entries[i]->cleanup) 194 - config_rom_entries[i]->cleanup(); 195 - } 196 - } 197 - 198 - /* Add extra config roms to specified host */ 199 - int hpsb_add_extra_config_roms(struct hpsb_host *host) 200 - { 201 - int i, error = 0; 202 - 203 - for (i = 0; config_rom_entries[i]; i++) { 204 - if (config_rom_entries[i]->add(host)) { 205 - HPSB_ERR("fw-host%d: Failed to attach config rom entry `%s'", 206 - host->id, config_rom_entries[i]->name); 207 - error = -1; 208 - } else { 209 - host->config_roms |= config_rom_entries[i]->flag; 210 - host->update_config_rom = 1; 211 - } 212 - } 213 - 214 - return error; 215 - } 216 - 217 - /* Remove extra config roms from specified host */ 218 - void hpsb_remove_extra_config_roms(struct hpsb_host *host) 219 - { 220 - int i; 221 - 222 - for (i = 0; config_rom_entries[i]; i++) { 223 - if (!(host->config_roms & config_rom_entries[i]->flag)) 224 - continue; 225 - 226 - config_rom_entries[i]->remove(host); 227 - 228 - host->config_roms &= ~config_rom_entries[i]->flag; 229 - host->update_config_rom = 1; 230 - } 201 + for (i = 0; i < ARRAY_SIZE(config_rom_entries); i++) 202 + config_rom_entries[i]->cleanup(); 231 203 }
+5 -2
drivers/ieee1394/config_roms.h
··· 6 6 int hpsb_default_host_entry(struct hpsb_host *host); 7 7 int hpsb_init_config_roms(void); 8 8 void hpsb_cleanup_config_roms(void); 9 - int hpsb_add_extra_config_roms(struct hpsb_host *host); 10 - void hpsb_remove_extra_config_roms(struct hpsb_host *host); 11 9 12 10 /* List of flags to check if a host contains a certain extra config rom 13 11 * entry. Available in the host->config_roms member. */ 14 12 #define HPSB_CONFIG_ROM_ENTRY_IP1394 0x00000001 13 + 14 + #ifdef CONFIG_IEEE1394_ETH1394_ROM_ENTRY 15 + int hpsb_config_rom_ip1394_add(struct hpsb_host *host); 16 + void hpsb_config_rom_ip1394_remove(struct hpsb_host *host); 17 + #endif 15 18 16 19 #endif /* _IEEE1394_CONFIG_ROMS_H */
+6 -1
drivers/ieee1394/eth1394.c
··· 561 561 struct eth1394_priv *priv; 562 562 u64 fifo_addr; 563 563 564 - if (!(host->config_roms & HPSB_CONFIG_ROM_ENTRY_IP1394)) 564 + if (hpsb_config_rom_ip1394_add(host) != 0) { 565 + ETH1394_PRINT_G(KERN_ERR, "Can't add IP-over-1394 ROM entry\n"); 565 566 return; 567 + } 566 568 567 569 fifo_addr = hpsb_allocate_and_register_addrspace( 568 570 &eth1394_highlevel, host, &addr_ops, ··· 572 570 CSR1212_INVALID_ADDR_SPACE, CSR1212_INVALID_ADDR_SPACE); 573 571 if (fifo_addr == CSR1212_INVALID_ADDR_SPACE) { 574 572 ETH1394_PRINT_G(KERN_ERR, "Cannot register CSR space\n"); 573 + hpsb_config_rom_ip1394_remove(host); 575 574 return; 576 575 } 577 576 ··· 652 649 if (hi) 653 650 hpsb_destroy_hostinfo(&eth1394_highlevel, host); 654 651 hpsb_unregister_addrspace(&eth1394_highlevel, host, fifo_addr); 652 + hpsb_config_rom_ip1394_remove(host); 655 653 } 656 654 657 655 /* Remove a card from our list */ ··· 666 662 return; 667 663 priv = netdev_priv(hi->dev); 668 664 hpsb_unregister_addrspace(&eth1394_highlevel, host, priv->local_fifo); 665 + hpsb_config_rom_ip1394_remove(host); 669 666 if (priv->iso) 670 667 hpsb_iso_shutdown(priv->iso); 671 668 unregister_netdev(hi->dev);
+1 -2
drivers/ieee1394/hosts.c
··· 180 180 { 181 181 if (hpsb_default_host_entry(host)) 182 182 return -ENOMEM; 183 - hpsb_add_extra_config_roms(host); 183 + 184 184 highlevel_add_host(host); 185 185 return 0; 186 186 } ··· 202 202 203 203 host->driver = &dummy_driver; 204 204 highlevel_remove_host(host); 205 - hpsb_remove_extra_config_roms(host); 206 205 207 206 class_device_unregister(&host->class_dev); 208 207 device_unregister(&host->device);