Skip to content

Commit 43bf2e6

Browse files
Finn Thaindavem330
authored andcommitted
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>
1 parent c967226 commit 43bf2e6

4 files changed

Lines changed: 33 additions & 43 deletions

File tree

‎arch/m68k/mac/config.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,10 @@ int __init mac_platform_init(void)
10881088
macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
10891089
platform_device_register_simple("macsonic", -1, NULL, 0);
10901090

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+
10911095
if (macintosh_config->ether_type == MAC_ETHER_MACE)
10921096
platform_device_register_simple("macmace", -1, NULL, 0);
10931097

‎drivers/net/Space.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ static struct devprobe2 m68k_probes[] __initdata = {
113113
#endif
114114
#ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */
115115
{mvme147lance_probe, 0},
116-
#endif
117-
#ifdef CONFIG_MAC89x0
118-
{mac89x0_probe, 0},
119116
#endif
120117
{NULL, 0},
121118
};

‎drivers/net/ethernet/cirrus/mac89x0.c‎

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ static const char version[] =
9393
#include <linux/errno.h>
9494
#include <linux/init.h>
9595
#include <linux/netdevice.h>
96+
#include <linux/platform_device.h>
9697
#include <linux/etherdevice.h>
9798
#include <linux/skbuff.h>
9899
#include <linux/delay.h>
@@ -105,6 +106,10 @@ static const char version[] =
105106

106107
#include "cs89x0.h"
107108

109+
static int debug;
110+
module_param(debug, int, 0);
111+
MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)");
112+
108113
static unsigned int net_debug = NET_DEBUG;
109114

110115
/* Information that need to be kept for each board. */
@@ -167,10 +172,9 @@ static const struct net_device_ops mac89x0_netdev_ops = {
167172

168173
/* Probe for the CS8900 card in slot E. We won't bother looking
169174
anywhere else until we have a really good reason to do so. */
170-
struct net_device * __init mac89x0_probe(int unit)
175+
static int mac89x0_device_probe(struct platform_device *pdev)
171176
{
172177
struct net_device *dev;
173-
static int once_is_enough;
174178
struct net_local *lp;
175179
static unsigned version_printed;
176180
int i, slot;
@@ -180,21 +184,11 @@ struct net_device * __init mac89x0_probe(int unit)
180184
int err = -ENODEV;
181185
struct nubus_rsrc *fres;
182186

183-
if (!MACH_IS_MAC)
184-
return ERR_PTR(-ENODEV);
187+
net_debug = debug;
185188

186189
dev = alloc_etherdev(sizeof(struct net_local));
187190
if (!dev)
188-
return ERR_PTR(-ENOMEM);
189-
190-
if (unit >= 0) {
191-
sprintf(dev->name, "eth%d", unit);
192-
netdev_boot_setup_check(dev);
193-
}
194-
195-
if (once_is_enough)
196-
goto out;
197-
once_is_enough = 1;
191+
return -ENOMEM;
198192

199193
/* We might have to parameterize this later */
200194
slot = 0xE;
@@ -221,6 +215,8 @@ struct net_device * __init mac89x0_probe(int unit)
221215
if (sig != swab16(CHIP_EISA_ID_SIG))
222216
goto out;
223217

218+
SET_NETDEV_DEV(dev, &pdev->dev);
219+
224220
/* Initialize the net_device structure. */
225221
lp = netdev_priv(dev);
226222

@@ -280,12 +276,14 @@ struct net_device * __init mac89x0_probe(int unit)
280276
err = register_netdev(dev);
281277
if (err)
282278
goto out1;
283-
return NULL;
279+
280+
platform_set_drvdata(pdev, dev);
281+
return 0;
284282
out1:
285283
nubus_writew(0, dev->base_addr + ADD_PORT);
286284
out:
287285
free_netdev(dev);
288-
return ERR_PTR(err);
286+
return err;
289287
}
290288

291289
/* Open/initialize the board. This is called (in the current kernel)
@@ -571,32 +569,24 @@ static int set_mac_address(struct net_device *dev, void *addr)
571569
return 0;
572570
}
573571

574-
#ifdef MODULE
575-
576-
static struct net_device *dev_cs89x0;
577-
static int debug;
578-
579-
module_param(debug, int, 0);
580-
MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)");
581572
MODULE_LICENSE("GPL");
582573

583-
int __init
584-
init_module(void)
574+
static int mac89x0_device_remove(struct platform_device *pdev)
585575
{
586-
net_debug = debug;
587-
dev_cs89x0 = mac89x0_probe(-1);
588-
if (IS_ERR(dev_cs89x0)) {
589-
printk(KERN_WARNING "mac89x0.c: No card found\n");
590-
return PTR_ERR(dev_cs89x0);
591-
}
576+
struct net_device *dev = platform_get_drvdata(pdev);
577+
578+
unregister_netdev(dev);
579+
nubus_writew(0, dev->base_addr + ADD_PORT);
580+
free_netdev(dev);
592581
return 0;
593582
}
594583

595-
void
596-
cleanup_module(void)
597-
{
598-
unregister_netdev(dev_cs89x0);
599-
nubus_writew(0, dev_cs89x0->base_addr + ADD_PORT);
600-
free_netdev(dev_cs89x0);
601-
}
602-
#endif /* MODULE */
584+
static struct platform_driver mac89x0_platform_driver = {
585+
.probe = mac89x0_device_probe,
586+
.remove = mac89x0_device_remove,
587+
.driver = {
588+
.name = "mac89x0",
589+
},
590+
};
591+
592+
module_platform_driver(mac89x0_platform_driver);

‎include/net/Space.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ struct net_device *cs89x0_probe(int unit);
2020
struct net_device *mvme147lance_probe(int unit);
2121
struct net_device *tc515_probe(int unit);
2222
struct net_device *lance_probe(int unit);
23-
struct net_device *mac89x0_probe(int unit);
2423
struct net_device *cops_probe(int unit);
2524
struct net_device *ltpc_probe(void);
2625

0 commit comments

Comments
 (0)