aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar7/patches-2.6.22/210-phy_fixed.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2007-09-06 16:27:37 +0000
committerFelix Fietkau <nbd@openwrt.org>2007-09-06 16:27:37 +0000
commit92558d67a463bfbb351d30e28648de03b635f024 (patch)
treea5d41b991a151e72663527a96fbc6c494565d65c /target/linux/ar7/patches-2.6.22/210-phy_fixed.patch
parente1dbce411cd2a3a067f387cee011cd889486a07d (diff)
downloadupstream-92558d67a463bfbb351d30e28648de03b635f024.tar.gz
upstream-92558d67a463bfbb351d30e28648de03b635f024.tar.bz2
upstream-92558d67a463bfbb351d30e28648de03b635f024.zip
strip the kernel version suffix from target directories, except for brcm-2.4 (the -2.4 will be included in the board name here). CONFIG_LINUX_<ver>_<board> becomes CONFIG_TARGET_<board>, same for profiles.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8653 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar7/patches-2.6.22/210-phy_fixed.patch')
-rw-r--r--target/linux/ar7/patches-2.6.22/210-phy_fixed.patch93
1 files changed, 93 insertions, 0 deletions
diff --git a/target/linux/ar7/patches-2.6.22/210-phy_fixed.patch b/target/linux/ar7/patches-2.6.22/210-phy_fixed.patch
new file mode 100644
index 0000000000..c8eceebb50
--- /dev/null
+++ b/target/linux/ar7/patches-2.6.22/210-phy_fixed.patch
@@ -0,0 +1,93 @@
+Index: linux-2.6.21.4/drivers/net/phy/fixed.c
+===================================================================
+--- linux-2.6.21.4.orig/drivers/net/phy/fixed.c 2007-06-11 16:30:06.418483448 +0200
++++ linux-2.6.21.4/drivers/net/phy/fixed.c 2007-06-11 16:30:11.156763120 +0200
+@@ -187,6 +187,19 @@
+ .driver = { .owner = THIS_MODULE,},
+ };
+
++static void fixed_mdio_release (struct device * dev)
++{
++ struct phy_device *phydev = container_of(dev, struct phy_device, dev);
++ struct mii_bus *bus = phydev->bus;
++ struct fixed_info *fixed = bus->priv;
++
++ kfree(phydev);
++ kfree(bus->dev);
++ kfree(bus);
++ kfree(fixed->regs);
++ kfree(fixed);
++}
++
+ /*-----------------------------------------------------------------------------
+ * This func is used to create all the necessary stuff, bind
+ * the fixed phy driver and register all it on the mdio_bus_type.
+@@ -221,6 +234,12 @@
+ }
+
+ fixed->regs = kzalloc(MII_REGS_NUM*sizeof(int), GFP_KERNEL);
++ if (NULL == fixed->regs) {
++ kfree(dev);
++ kfree(new_bus);
++ kfree(fixed);
++ return -ENOMEM;
++ }
+ fixed->regs_num = MII_REGS_NUM;
+ fixed->phy_status.speed = speed;
+ fixed->phy_status.duplex = duplex;
+@@ -249,8 +268,11 @@
+ fixed->phydev = phydev;
+
+ if(NULL == phydev) {
+- err = -ENOMEM;
+- goto device_create_fail;
++ kfree(dev);
++ kfree(new_bus);
++ kfree(fixed->regs);
++ kfree(fixed);
++ return -ENOMEM;
+ }
+
+ phydev->irq = PHY_IGNORE_INTERRUPT;
+@@ -262,8 +283,33 @@
+ else
+ snprintf(phydev->dev.bus_id, BUS_ID_SIZE,
+ "fixed@%d:%d", speed, duplex);
++
+ phydev->bus = new_bus;
+
++#if 1
++ phydev->dev.driver = &fixed_mdio_driver.driver;
++ phydev->dev.release = fixed_mdio_release;
++
++ err = phydev->dev.driver->probe(&phydev->dev);
++ if(err < 0) {
++ printk(KERN_ERR "Phy %s: problems with fixed driver\n",
++ phydev->dev.bus_id);
++ kfree(phydev);
++ kfree(dev);
++ kfree(new_bus);
++ kfree(fixed->regs);
++ kfree(fixed);
++ return err;
++ }
++
++ err = device_register(&phydev->dev);
++ if(err) {
++ printk(KERN_ERR "Phy %s failed to register\n",
++ phydev->dev.bus_id);
++ }
++
++ return 0;
++#else
+ err = device_register(&phydev->dev);
+ if(err) {
+ printk(KERN_ERR "Phy %s failed to register\n",
+@@ -306,6 +354,7 @@
+ kfree(fixed);
+
+ return err;
++#endif
+ }
+
+