• Patrick Mochel's avatar
    driver model: fix device interfaces. · 2e646ed0
    Patrick Mochel authored
    - Remove struct intf_data. 
      It was silly, and gave us an unbalanced interface. 
      Instead, when removing a device_interface, all of a class's devices are
      iterated over, and intf->remove_device() is called for each. (Instead 
      of the device's list of interfaces it belongs to). 
      Interfaces are expected to tell if they support the device being removed.
    
    - Remove struct device::intf_list.
    
    - Protect classes' device list access with devclass_sem, which is taken 
      when a device or interface is added or removed. This allows access to the
      list w/o taking the class's lock, which allows subordinate objects to be
      registered (e.g. the interface itself, or objects the interfaces create
      for a device). 
    
    - This should fix a deadlock when devices are added to interfaces, which 
      calls intf->add_device(), then interface_add_data(), which call 
      kobject_register() and hangs, since it tries to take the class's lock
      again. 
    2e646ed0
core.c 7.49 KB