非generic phy的引用计数为0
来源:互联网 发布:淘宝消费报告数据分析 编辑:程序博客网 时间:2024/06/08 03:12
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/drivers/net/phy/phy_device.c?h=v4.11.12&id=6d9f66ac7fec2a6ccd649e5909806dfe36f1fc25
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 0d8f4d3..8c8e15b 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
index 0d8f4d3..8c8e15b 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -908,6 +908,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
struct module *ndev_owner = dev->dev.parent->driver->owner;
struct mii_bus *bus = phydev->mdio.bus;
struct device *d = &phydev->mdio.dev;
+ bool using_genphy = false;
int err;
/* For Ethernet device drivers that register their own MDIO bus, we
@@ -920,11 +921,6 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
return -EIO;
}
- if (!try_module_get(d->driver->owner)) {
- dev_err(&dev->dev, "failed to get the device driver module\n");
- return -EIO;
- }
-
get_device(d);
/* Assume that if there is no driver, that it doesn't
@@ -938,12 +934,22 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
d->driver =
&genphy_driver[GENPHY_DRV_1G].mdiodrv.driver;
+ using_genphy = true;
+ }
+
+ if (!try_module_get(d->driver->owner)) {
+ dev_err(&dev->dev, "failed to get the device driver module\n");
+ err = -EIO;
+ goto error_put_device;
+ }
由于phy device 和 driver 特殊的匹配关系,因此如果不上这个patch的话,通过lsmod 看到的phy的ko的引用计数就是0。通过try_module_get 可以手动增加ko的引用计数.
阅读全文
0 0
- 非generic phy的引用计数为0
- oc引用计数为-1的情况
- python的引用计数
- 自己的引用计数
- GC的引用计数
- 引用计数的问题
- 为什么说设备的引用计数为0时,系统会自动调用它的release函数
- javaVM 判断对象实例何时回收 用的可达性分析算法,而非引用计数算法
- Objective-C关于非ARC模式下的对象引用计数
- 函数返回值为引用、非引用及引用左值的情况
- COM的引用计数规则
- 组件的引用计数问题
- COM的引用计数规则
- 引用计数的一种实现
- stl::string的引用计数
- 自动引用计数的实现
- share_ptr 引用计数的实现
- 引用计数的一些测试
- Java中类的加载顺序详解
- 使用spring-boot-starter-actuator,报错spring-boot-starter-actuator
- 深度学习利器: TensorFlow系统架构及高性能程序设计
- 转 OpenCV:remap()简单重映射
- AVR单片机方向数据寄存器(DDR)与数据寄存器的关系
- 非generic phy的引用计数为0
- minicom的移植
- Ultraedit打开中文乱码解决方案
- 各种基本的排序算法在Object-C实现
- Qt笔记 之 QListWidget控件的使用
- continue 和 return
- less
- css遇到的居中问题整理
- sed命令简单总结