remove old profile
[openwrt.git] / target / linux / ar7 / patches-2.6.23 / 210-phy_fixed.patch
1 Index: linux-2.6.23-rc6/drivers/net/phy/fixed.c
2 ===================================================================
3 --- linux-2.6.23-rc6.orig/drivers/net/phy/fixed.c 2007-09-21 16:23:51.000000000 +0800
4 +++ linux-2.6.23-rc6/drivers/net/phy/fixed.c 2007-09-21 16:24:13.000000000 +0800
5 @@ -189,6 +189,19 @@
6 .driver = { .owner = THIS_MODULE,},
7 };
8
9 +static void fixed_mdio_release (struct device * dev)
10 +{
11 + struct phy_device *phydev = container_of(dev, struct phy_device, dev);
12 + struct mii_bus *bus = phydev->bus;
13 + struct fixed_info *fixed = bus->priv;
14 +
15 + kfree(phydev);
16 + kfree(bus->dev);
17 + kfree(bus);
18 + kfree(fixed->regs);
19 + kfree(fixed);
20 +}
21 +
22 /*-----------------------------------------------------------------------------
23 * This func is used to create all the necessary stuff, bind
24 * the fixed phy driver and register all it on the mdio_bus_type.
25 @@ -224,6 +237,12 @@
26 }
27
28 fixed->regs = kzalloc(MII_REGS_NUM*sizeof(int), GFP_KERNEL);
29 + if (NULL == fixed->regs) {
30 + kfree(dev);
31 + kfree(new_bus);
32 + kfree(fixed);
33 + return -ENOMEM;
34 + }
35 fixed->regs_num = MII_REGS_NUM;
36 fixed->phy_status.speed = speed;
37 fixed->phy_status.duplex = duplex;
38 @@ -252,8 +271,11 @@
39 fixed->phydev = phydev;
40
41 if(NULL == phydev) {
42 - err = -ENOMEM;
43 - goto device_create_fail;
44 + kfree(dev);
45 + kfree(new_bus);
46 + kfree(fixed->regs);
47 + kfree(fixed);
48 + return -ENOMEM;
49 }
50
51 phydev->irq = PHY_IGNORE_INTERRUPT;
52 @@ -265,8 +287,33 @@
53 else
54 snprintf(phydev->dev.bus_id, BUS_ID_SIZE,
55 "fixed@%d:%d", speed, duplex);
56 +
57 phydev->bus = new_bus;
58
59 +#if 1
60 + phydev->dev.driver = &fixed_mdio_driver.driver;
61 + phydev->dev.release = fixed_mdio_release;
62 +
63 + err = phydev->dev.driver->probe(&phydev->dev);
64 + if(err < 0) {
65 + printk(KERN_ERR "Phy %s: problems with fixed driver\n",
66 + phydev->dev.bus_id);
67 + kfree(phydev);
68 + kfree(dev);
69 + kfree(new_bus);
70 + kfree(fixed->regs);
71 + kfree(fixed);
72 + return err;
73 + }
74 +
75 + err = device_register(&phydev->dev);
76 + if(err) {
77 + printk(KERN_ERR "Phy %s failed to register\n",
78 + phydev->dev.bus_id);
79 + }
80 +
81 + return 0;
82 +#else
83 err = device_register(&phydev->dev);
84 if(err) {
85 printk(KERN_ERR "Phy %s failed to register\n",
86 @@ -303,6 +350,7 @@
87 kfree(fixed);
88
89 return err;
90 +#endif
91 }
92 #endif
93
This page took 0.044374 seconds and 5 git commands to generate.