Chinaunix首页 | 论坛 | 博客
  • 博客访问: 217932
  • 博文数量: 32
  • 博客积分: 410
  • 博客等级: 一等列兵
  • 技术积分: 396
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-03 16:58
文章分类

全部博文(32)

文章存档

2013年(17)

2012年(15)

我的朋友

分类: LINUX

2013-02-04 20:46:17

//驱动登记到自己的总线上; /**
 * driver_register - register driver with bus
 * @drv: driver to register
 *
 * We pass off most of the work to the bus_add_driver() call,
 * since most of the things we have to do deal with the bus
 * structures.
 */ int driver_register(struct device_driver *drv)//将驱动注册到指定的总线(bus); { int ret;
    struct device_driver *other;
    BUG_ON(!drv->bus->p);
    if ((drv->bus->probe && drv->probe) || (drv->bus->remove && drv->remove) ||
        (drv->bus->shutdown && drv->shutdown)) printk(KERN_WARNING "Driver '%s' needs updating - please use " "bus_type methods\n", drv->name);
    other = driver_find(drv->name,
    drv->bus);//通过对比,确认总线上之前没有注册过;
    if (other) { put_driver(other);
        printk(KERN_ERR "Error: Driver '%s' is already registered, " "aborting...\n", drv->name); return -EBUSY; }
    ret = bus_add_driver(drv);//将驱动注册到总线上;
    if (ret) return ret; ret = driver_add_groups(drv, drv->groups);
    if (ret) bus_remove_driver(drv); return ret; }
阅读(1651) | 评论(0) | 转发(0) |
0

上一篇:SPI读写总结

下一篇:usb_register_driver

给主人留下些什么吧!~~