aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/class.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-11-16 03:00:00 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-04 19:18:08 -0500
commit312c004d36ce6c739512bac83b452f4c20ab1f62 (patch)
treee61e8331680a0da29557fe21414d3b31e62c9293 /drivers/base/class.c
parent5f123fbd80f4f788554636f02bf73e40f914e0d6 (diff)
[PATCH] driver core: replace "hotplug" by "uevent"
Leave the overloaded "hotplug" word to susbsystems which are handling real devices. The driver core does not "plug" anything, it just exports the state to userspace and generates events. Signed-off-by: Kay Sievers <kay.sievers@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/class.c')
-rw-r--r--drivers/base/class.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c
index db65fd0babe9..df7fdabd0730 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -178,7 +178,7 @@ static void class_device_create_release(struct class_device *class_dev)
178} 178}
179 179
180/* needed to allow these devices to have parent class devices */ 180/* needed to allow these devices to have parent class devices */
181static int class_device_create_hotplug(struct class_device *class_dev, 181static int class_device_create_uevent(struct class_device *class_dev,
182 char **envp, int num_envp, 182 char **envp, int num_envp,
183 char *buffer, int buffer_size) 183 char *buffer, int buffer_size)
184{ 184{
@@ -331,7 +331,7 @@ static struct kobj_type ktype_class_device = {
331 .release = class_dev_release, 331 .release = class_dev_release,
332}; 332};
333 333
334static int class_hotplug_filter(struct kset *kset, struct kobject *kobj) 334static int class_uevent_filter(struct kset *kset, struct kobject *kobj)
335{ 335{
336 struct kobj_type *ktype = get_ktype(kobj); 336 struct kobj_type *ktype = get_ktype(kobj);
337 337
@@ -343,14 +343,14 @@ static int class_hotplug_filter(struct kset *kset, struct kobject *kobj)
343 return 0; 343 return 0;
344} 344}
345 345
346static const char *class_hotplug_name(struct kset *kset, struct kobject *kobj) 346static const char *class_uevent_name(struct kset *kset, struct kobject *kobj)
347{ 347{
348 struct class_device *class_dev = to_class_dev(kobj); 348 struct class_device *class_dev = to_class_dev(kobj);
349 349
350 return class_dev->class->name; 350 return class_dev->class->name;
351} 351}
352 352
353static int class_hotplug(struct kset *kset, struct kobject *kobj, char **envp, 353static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp,
354 int num_envp, char *buffer, int buffer_size) 354 int num_envp, char *buffer, int buffer_size)
355{ 355{
356 struct class_device *class_dev = to_class_dev(kobj); 356 struct class_device *class_dev = to_class_dev(kobj);
@@ -365,29 +365,29 @@ static int class_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
365 struct device *dev = class_dev->dev; 365 struct device *dev = class_dev->dev;
366 char *path = kobject_get_path(&dev->kobj, GFP_KERNEL); 366 char *path = kobject_get_path(&dev->kobj, GFP_KERNEL);
367 367
368 add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, 368 add_uevent_var(envp, num_envp, &i, buffer, buffer_size,
369 &length, "PHYSDEVPATH=%s", path); 369 &length, "PHYSDEVPATH=%s", path);
370 kfree(path); 370 kfree(path);
371 371
372 if (dev->bus) 372 if (dev->bus)
373 add_hotplug_env_var(envp, num_envp, &i, 373 add_uevent_var(envp, num_envp, &i,
374 buffer, buffer_size, &length, 374 buffer, buffer_size, &length,
375 "PHYSDEVBUS=%s", dev->bus->name); 375 "PHYSDEVBUS=%s", dev->bus->name);
376 376
377 if (dev->driver) 377 if (dev->driver)
378 add_hotplug_env_var(envp, num_envp, &i, 378 add_uevent_var(envp, num_envp, &i,
379 buffer, buffer_size, &length, 379 buffer, buffer_size, &length,
380 "PHYSDEVDRIVER=%s", dev->driver->name); 380 "PHYSDEVDRIVER=%s", dev->driver->name);
381 } 381 }
382 382
383 if (MAJOR(class_dev->devt)) { 383 if (MAJOR(class_dev->devt)) {
384 add_hotplug_env_var(envp, num_envp, &i, 384 add_uevent_var(envp, num_envp, &i,
385 buffer, buffer_size, &length, 385 buffer, buffer_size, &length,
386 "MAJOR=%u", MAJOR(class_dev->devt)); 386 "MAJOR=%u", MAJOR(class_dev->devt));
387 387
388 add_hotplug_env_var(envp, num_envp, &i, 388 add_uevent_var(envp, num_envp, &i,
389 buffer, buffer_size, &length, 389 buffer, buffer_size, &length,
390 "MINOR=%u", MINOR(class_dev->devt)); 390 "MINOR=%u", MINOR(class_dev->devt));
391 } 391 }
392 392
393 /* terminate, set to next free slot, shrink available space */ 393 /* terminate, set to next free slot, shrink available space */
@@ -397,30 +397,30 @@ static int class_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
397 buffer = &buffer[length]; 397 buffer = &buffer[length];
398 buffer_size -= length; 398 buffer_size -= length;
399 399
400 if (class_dev->hotplug) { 400 if (class_dev->uevent) {
401 /* have the class device specific function add its stuff */ 401 /* have the class device specific function add its stuff */
402 retval = class_dev->hotplug(class_dev, envp, num_envp, 402 retval = class_dev->uevent(class_dev, envp, num_envp,
403 buffer, buffer_size); 403 buffer, buffer_size);
404 if (retval) 404 if (retval)
405 pr_debug("class_dev->hotplug() returned %d\n", retval); 405 pr_debug("class_dev->uevent() returned %d\n", retval);
406 } else if (class_dev->class->hotplug) { 406 } else if (class_dev->class->uevent) {
407 /* have the class specific function add its stuff */ 407 /* have the class specific function add its stuff */
408 retval = class_dev->class->hotplug(class_dev, envp, num_envp, 408 retval = class_dev->class->uevent(class_dev, envp, num_envp,
409 buffer, buffer_size); 409 buffer, buffer_size);
410 if (retval) 410 if (retval)
411 pr_debug("class->hotplug() returned %d\n", retval); 411 pr_debug("class->uevent() returned %d\n", retval);
412 } 412 }
413 413
414 return retval; 414 return retval;
415} 415}
416 416
417static struct kset_hotplug_ops class_hotplug_ops = { 417static struct kset_uevent_ops class_uevent_ops = {
418 .filter = class_hotplug_filter, 418 .filter = class_uevent_filter,
419 .name = class_hotplug_name, 419 .name = class_uevent_name,
420 .hotplug = class_hotplug, 420 .uevent = class_uevent,
421}; 421};
422 422
423static decl_subsys(class_obj, &ktype_class_device, &class_hotplug_ops); 423static decl_subsys(class_obj, &ktype_class_device, &class_uevent_ops);
424 424
425 425
426static int class_device_add_attrs(struct class_device * cd) 426static int class_device_add_attrs(struct class_device * cd)
@@ -464,7 +464,7 @@ static ssize_t show_dev(struct class_device *class_dev, char *buf)
464static ssize_t store_uevent(struct class_device *class_dev, 464static ssize_t store_uevent(struct class_device *class_dev,
465 const char *buf, size_t count) 465 const char *buf, size_t count)
466{ 466{
467 kobject_hotplug(&class_dev->kobj, KOBJ_ADD); 467 kobject_uevent(&class_dev->kobj, KOBJ_ADD);
468 return count; 468 return count;
469} 469}
470 470
@@ -559,7 +559,7 @@ int class_device_add(struct class_device *class_dev)
559 class_name); 559 class_name);
560 } 560 }
561 561
562 kobject_hotplug(&class_dev->kobj, KOBJ_ADD); 562 kobject_uevent(&class_dev->kobj, KOBJ_ADD);
563 563
564 /* notify any interfaces this device is now here */ 564 /* notify any interfaces this device is now here */
565 if (parent_class) { 565 if (parent_class) {
@@ -632,7 +632,7 @@ struct class_device *class_device_create(struct class *cls,
632 class_dev->class = cls; 632 class_dev->class = cls;
633 class_dev->parent = parent; 633 class_dev->parent = parent;
634 class_dev->release = class_device_create_release; 634 class_dev->release = class_device_create_release;
635 class_dev->hotplug = class_device_create_hotplug; 635 class_dev->uevent = class_device_create_uevent;
636 636
637 va_start(args, fmt); 637 va_start(args, fmt);
638 vsnprintf(class_dev->class_id, BUS_ID_SIZE, fmt, args); 638 vsnprintf(class_dev->class_id, BUS_ID_SIZE, fmt, args);
@@ -674,7 +674,7 @@ void class_device_del(struct class_device *class_dev)
674 class_device_remove_file(class_dev, class_dev->devt_attr); 674 class_device_remove_file(class_dev, class_dev->devt_attr);
675 class_device_remove_attrs(class_dev); 675 class_device_remove_attrs(class_dev);
676 676
677 kobject_hotplug(&class_dev->kobj, KOBJ_REMOVE); 677 kobject_uevent(&class_dev->kobj, KOBJ_REMOVE);
678 kobject_del(&class_dev->kobj); 678 kobject_del(&class_dev->kobj);
679 679
680 class_device_put(parent_device); 680 class_device_put(parent_device);