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

net/mac89x0: Convert to platform_driver

Apparently these Dayna cards don't have a pseudoslot declaration ROM
which means they can't be probed like NuBus cards.

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Finn Thain and committed by
David S. Miller
43bf2e6d c967226b

+33 -43
+4
arch/m68k/mac/config.c
··· 1088 1088 macintosh_config->expansion_type == MAC_EXP_PDS_COMM) 1089 1089 platform_device_register_simple("macsonic", -1, NULL, 0); 1090 1090 1091 + if (macintosh_config->expansion_type == MAC_EXP_PDS || 1092 + macintosh_config->expansion_type == MAC_EXP_PDS_COMM) 1093 + platform_device_register_simple("mac89x0", -1, NULL, 0); 1094 + 1091 1095 if (macintosh_config->ether_type == MAC_ETHER_MACE) 1092 1096 platform_device_register_simple("macmace", -1, NULL, 0); 1093 1097
-3
drivers/net/Space.c
··· 114 114 #ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */ 115 115 {mvme147lance_probe, 0}, 116 116 #endif 117 - #ifdef CONFIG_MAC89x0 118 - {mac89x0_probe, 0}, 119 - #endif 120 117 {NULL, 0}, 121 118 }; 122 119
+29 -39
drivers/net/ethernet/cirrus/mac89x0.c
··· 93 93 #include <linux/errno.h> 94 94 #include <linux/init.h> 95 95 #include <linux/netdevice.h> 96 + #include <linux/platform_device.h> 96 97 #include <linux/etherdevice.h> 97 98 #include <linux/skbuff.h> 98 99 #include <linux/delay.h> ··· 105 104 #include <asm/macints.h> 106 105 107 106 #include "cs89x0.h" 107 + 108 + static int debug; 109 + module_param(debug, int, 0); 110 + MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)"); 108 111 109 112 static unsigned int net_debug = NET_DEBUG; 110 113 ··· 172 167 173 168 /* Probe for the CS8900 card in slot E. We won't bother looking 174 169 anywhere else until we have a really good reason to do so. */ 175 - struct net_device * __init mac89x0_probe(int unit) 170 + static int mac89x0_device_probe(struct platform_device *pdev) 176 171 { 177 172 struct net_device *dev; 178 - static int once_is_enough; 179 173 struct net_local *lp; 180 174 static unsigned version_printed; 181 175 int i, slot; ··· 184 180 int err = -ENODEV; 185 181 struct nubus_rsrc *fres; 186 182 187 - if (!MACH_IS_MAC) 188 - return ERR_PTR(-ENODEV); 183 + net_debug = debug; 189 184 190 185 dev = alloc_etherdev(sizeof(struct net_local)); 191 186 if (!dev) 192 - return ERR_PTR(-ENOMEM); 193 - 194 - if (unit >= 0) { 195 - sprintf(dev->name, "eth%d", unit); 196 - netdev_boot_setup_check(dev); 197 - } 198 - 199 - if (once_is_enough) 200 - goto out; 201 - once_is_enough = 1; 187 + return -ENOMEM; 202 188 203 189 /* We might have to parameterize this later */ 204 190 slot = 0xE; ··· 214 220 sig = nubus_readw(ioaddr + DATA_PORT); 215 221 if (sig != swab16(CHIP_EISA_ID_SIG)) 216 222 goto out; 223 + 224 + SET_NETDEV_DEV(dev, &pdev->dev); 217 225 218 226 /* Initialize the net_device structure. */ 219 227 lp = netdev_priv(dev); ··· 276 280 err = register_netdev(dev); 277 281 if (err) 278 282 goto out1; 279 - return NULL; 283 + 284 + platform_set_drvdata(pdev, dev); 285 + return 0; 280 286 out1: 281 287 nubus_writew(0, dev->base_addr + ADD_PORT); 282 288 out: 283 289 free_netdev(dev); 284 - return ERR_PTR(err); 290 + return err; 285 291 } 286 292 287 293 /* Open/initialize the board. This is called (in the current kernel) ··· 569 571 return 0; 570 572 } 571 573 572 - #ifdef MODULE 573 - 574 - static struct net_device *dev_cs89x0; 575 - static int debug; 576 - 577 - module_param(debug, int, 0); 578 - MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)"); 579 574 MODULE_LICENSE("GPL"); 580 575 581 - int __init 582 - init_module(void) 576 + static int mac89x0_device_remove(struct platform_device *pdev) 583 577 { 584 - net_debug = debug; 585 - dev_cs89x0 = mac89x0_probe(-1); 586 - if (IS_ERR(dev_cs89x0)) { 587 - printk(KERN_WARNING "mac89x0.c: No card found\n"); 588 - return PTR_ERR(dev_cs89x0); 589 - } 578 + struct net_device *dev = platform_get_drvdata(pdev); 579 + 580 + unregister_netdev(dev); 581 + nubus_writew(0, dev->base_addr + ADD_PORT); 582 + free_netdev(dev); 590 583 return 0; 591 584 } 592 585 593 - void 594 - cleanup_module(void) 595 - { 596 - unregister_netdev(dev_cs89x0); 597 - nubus_writew(0, dev_cs89x0->base_addr + ADD_PORT); 598 - free_netdev(dev_cs89x0); 599 - } 600 - #endif /* MODULE */ 586 + static struct platform_driver mac89x0_platform_driver = { 587 + .probe = mac89x0_device_probe, 588 + .remove = mac89x0_device_remove, 589 + .driver = { 590 + .name = "mac89x0", 591 + }, 592 + }; 593 + 594 + module_platform_driver(mac89x0_platform_driver);
-1
include/net/Space.h
··· 20 20 struct net_device *mvme147lance_probe(int unit); 21 21 struct net_device *tc515_probe(int unit); 22 22 struct net_device *lance_probe(int unit); 23 - struct net_device *mac89x0_probe(int unit); 24 23 struct net_device *cops_probe(int unit); 25 24 struct net_device *ltpc_probe(void); 26 25