1. 16 9月, 2009 1 次提交
    • A
      Driver core: add new device to bus's list before probing · 2023c610
      Alan Stern 提交于
      This patch (as1271) affects when new devices get linked into their
      bus's list of devices.  Currently this happens after probing, and it
      doesn't happen at all if probing fails.  Clearly this is wrong,
      because at that point quite a few symbolic links have already been
      created in sysfs.  We are committed to adding the device, so it should
      be linked into the bus's list regardless.
      
      In addition, this needs to happen before the uevent announcing the new
      device gets issued.  Otherwise user programs might try to access the
      device before it has been added to the bus.
      
      To fix both these problems, the patch moves the call to
      klist_add_tail() forward from bus_attach_device() to bus_add_device().
      Since bus_attach_device() now does nothing but probe for drivers, it
      has been renamed to bus_probe_device().  And lastly, the kerneldoc is
      updated.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      
      
      2023c610
  2. 16 6月, 2009 3 次提交
  3. 29 5月, 2009 1 次提交
  4. 20 4月, 2009 1 次提交
    • K
      driver: dont update dev_name via device_add path · 8a577ffc
      Kay Sievers 提交于
      notice one system /proc/iomem some entries missed the name for pci_devices
      
      it turns that dev->dev.kobj name is changed after device_add.
      
      for pci code: via acpi_pci_root_driver.ops.add (aka acpi_pci_root_add)
      ==> pci_acpi_scan_root is used to scan pci bus/device, and at the same
      time we read the resource for pci_dev in the pci_read_bases, we have
      res->name = pci_name(pci_dev); pci_name is calling dev_name.
      
      later via acpi_pci_root_driver.ops.start (aka acpi_pci_root_start) ==>
      pci_bus_add_device to add all pci_dev in kobj tree.  pci_bus_add_device
      will call device_add.
      
      actually in device_add
      
              /* first, register with generic layer. */
              error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev_name(dev));
              if (error)
                      goto Error;
      
      will get one new name for that kobj, old name is freed.
      
      [Impact: fix corrupted names in /proc/iomem ]
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8a577ffc
  5. 17 4月, 2009 1 次提交
  6. 25 3月, 2009 5 次提交
  7. 29 1月, 2009 1 次提交
  8. 21 1月, 2009 1 次提交
    • R
      driver core: Convert '/' to '!' in dev_set_name() · 7143f7a1
      Roland Dreier 提交于
      Commit 3ada8b7e ("block: struct device - replace bus_id with dev_name(),
      dev_set_name()") deleted the code in register_disk() that changed a '/'
      to a '!' in the device name when registering a disk, but dev_set_name()
      does not perform this conversion.
      
      This leads to amusing problems with disks that have '/' in their names:
      for example a failure to boot with the root partition on a cciss device,
      even though the kernel says it knows about the root device:
      
          VFS: Cannot open root device "cciss/c0d0p6" or unknown-block(0,0)
          Please append a correct "root=" boot option; here are the available partitions:
          6800        71652960 cciss/c0d0 driver: cciss
            6802               1 cciss/c0d0p2
            6805         2931831 cciss/c0d0p5
            6806        34354908 cciss/c0d0p6
          6810        71652960 cciss/c0d1 driver: cciss
      
      Fix this by adding code to change '/' to '!' in dev_set_name() to handle
      this until dev_set_name() is converted to use kobject_set_name().
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      Acked-by: NKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7143f7a1
  9. 10 1月, 2009 2 次提交
  10. 07 1月, 2009 5 次提交
  11. 17 10月, 2008 3 次提交
    • E
      kobject: Fix kobject_rename and !CONFIG_SYSFS · 030c1d2b
      Eric W. Biederman 提交于
      When looking at kobject_rename I found two bugs with
      that exist when sysfs support is disabled in the kernel.
      
      kobject_rename does not change the name on the kobject when
      sysfs support is not compiled in.
      
      kobject_rename without locking attempts to check the
      validity of a rename operation, which the kobject layer
      simply does not have the infrastructure to do.
      
      This patch documents the previously unstated requirement of
      kobject_rename that is the responsibility of the caller to
      provide mutual exclusion and to be certain that the new_name
      for the kobject is valid.
      
      This patch modifies sysfs_rename_dir in !CONFIG_SYSFS case
      to call kobject_set_name to actually change the kobject_name.
      
      This patch removes the bogus and misleading check in kobject_rename
      that attempts to see if a rename is valid.  The check is bogus
      because we do not have the proper locking.  The check is misleading
      because it looks like we can and do perform checking at the kobject
      level that we don't.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      030c1d2b
    • C
      Driver core: Fix cleanup in device_create_vargs(). · 286661b3
      Cornelia Huck 提交于
      If device_register() in device_create_vargs() fails, the device
      must be cleaned up with put_device() (which is also fine on NULL)
      instead of kfree().
      Signed-off-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      286661b3
    • C
      Driver core: Clarify device cleanup. · 5739411a
      Cornelia Huck 提交于
      Make the comments on how to use device_initialize(), device_add()
      and device_register() a bit clearer - in particular, explicitly
      note that put_device() must be used once we tried to add the device
      to the hierarchy.
      Signed-off-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5739411a
  12. 09 10月, 2008 1 次提交
    • T
      driver-core: use klist for class device list and implement iterator · 5a3ceb86
      Tejun Heo 提交于
      Iterating over entries using callback usually isn't too fun especially
      when the entry being iterated over can't be manipulated freely.  This
      patch converts class->p->class_devices to klist and implements class
      device iterator so that the users can freely build their own control
      structure.  The users are also free to call back into class code
      without worrying about locking.
      
      class_for_each_device() and class_find_device() are converted to use
      the new iterators, so their users don't have to worry about locking
      anymore either.
      
      Note: This depends on klist-dont-iterate-over-deleted-entries patch
      because class_intf->add/remove_dev() depends on proper synchronization
      with device removal.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      5a3ceb86
  13. 22 8月, 2008 3 次提交
  14. 27 7月, 2008 1 次提交
  15. 22 7月, 2008 11 次提交