Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
Browse files Browse the repository at this point in the history
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (28 commits)
  sysfs: Shadow directory support
  Driver Core: Increase the default timeout value of the firmware subsystem
  Driver core: allow to delay the uevent at device creation time
  Driver core: add device_type to struct device
  Driver core: add uevent vars for devices of a class
  SYSFS: Fix missing include of list.h in sysfs.h
  HOWTO: Add a reference to Harbison and Steele
  sysfs: error handling in sysfs, fill_read_buffer()
  kobject: kobject_put cleanup
  sysfs: kobject_put cleanup
  sysfs: suppress lockdep warnings
  Driver core: fix race in sysfs between sysfs_remove_file() and read()/write()
  driver core: Change function call order in device_bind_driver().
  driver core: Don't stop probing on ->probe errors.
  driver core fixes: device_register() retval check in platform.c
  driver core fixes: make_class_name() retval checks
  /sys/modules/*/holders
  USB: add the sysfs driver name to all modules
  SERIO: add the sysfs driver name to all modules
  PCI: add the sysfs driver name to all modules
  ...
  • Loading branch information
Linus Torvalds committed Feb 8, 2007
2 parents 7677ced + b592fcf commit f2aca47
Show file tree
Hide file tree
Showing 69 changed files with 1,286 additions and 709 deletions.
1 change: 1 addition & 0 deletions Documentation/HOWTO
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ are not a good substitute for a solid C education and/or years of
experience, the following books are good for, if anything, reference:
- "The C Programming Language" by Kernighan and Ritchie [Prentice Hall]
- "Practical C Programming" by Steve Oualline [O'Reilly]
- "C: A Reference Manual" by Harbison and Steele [Prentice Hall]

The kernel is written using GNU C and the GNU toolchain. While it
adheres to the ISO C89 standard, it uses a number of extensions that are
Expand Down
21 changes: 14 additions & 7 deletions drivers/base/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ char *make_class_name(const char *name, struct kobject *kobj)

class_name = kmalloc(size, GFP_KERNEL);
if (!class_name)
return ERR_PTR(-ENOMEM);
return NULL;

strcpy(class_name, name);
strcat(class_name, ":");
Expand Down Expand Up @@ -411,8 +411,11 @@ static int make_deprecated_class_device_links(struct class_device *class_dev)
return 0;

class_name = make_class_name(class_dev->class->name, &class_dev->kobj);
error = sysfs_create_link(&class_dev->dev->kobj, &class_dev->kobj,
class_name);
if (class_name)
error = sysfs_create_link(&class_dev->dev->kobj,
&class_dev->kobj, class_name);
else
error = -ENOMEM;
kfree(class_name);
return error;
}
Expand All @@ -425,7 +428,8 @@ static void remove_deprecated_class_device_links(struct class_device *class_dev)
return;

class_name = make_class_name(class_dev->class->name, &class_dev->kobj);
sysfs_remove_link(&class_dev->dev->kobj, class_name);
if (class_name)
sysfs_remove_link(&class_dev->dev->kobj, class_name);
kfree(class_name);
}
#else
Expand Down Expand Up @@ -863,9 +867,12 @@ int class_device_rename(struct class_device *class_dev, char *new_name)
if (class_dev->dev) {
new_class_name = make_class_name(class_dev->class->name,
&class_dev->kobj);
sysfs_create_link(&class_dev->dev->kobj, &class_dev->kobj,
new_class_name);
sysfs_remove_link(&class_dev->dev->kobj, old_class_name);
if (new_class_name)
sysfs_create_link(&class_dev->dev->kobj,
&class_dev->kobj, new_class_name);
if (old_class_name)
sysfs_remove_link(&class_dev->dev->kobj,
old_class_name);
}
#endif
class_device_put(class_dev);
Expand Down
Loading

0 comments on commit f2aca47

Please sign in to comment.