aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/firmware_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/firmware_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/firmware_class.c')
-rw-r--r--drivers/base/firmware_class.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 59dacb6552c0..5b3d5e9ddcb6 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -85,17 +85,17 @@ firmware_timeout_store(struct class *class, const char *buf, size_t count)
85static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store); 85static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store);
86 86
87static void fw_class_dev_release(struct class_device *class_dev); 87static void fw_class_dev_release(struct class_device *class_dev);
88int firmware_class_hotplug(struct class_device *dev, char **envp, 88int firmware_class_uevent(struct class_device *dev, char **envp,
89 int num_envp, char *buffer, int buffer_size); 89 int num_envp, char *buffer, int buffer_size);
90 90
91static struct class firmware_class = { 91static struct class firmware_class = {
92 .name = "firmware", 92 .name = "firmware",
93 .hotplug = firmware_class_hotplug, 93 .uevent = firmware_class_uevent,
94 .release = fw_class_dev_release, 94 .release = fw_class_dev_release,
95}; 95};
96 96
97int 97int
98firmware_class_hotplug(struct class_device *class_dev, char **envp, 98firmware_class_uevent(struct class_device *class_dev, char **envp,
99 int num_envp, char *buffer, int buffer_size) 99 int num_envp, char *buffer, int buffer_size)
100{ 100{
101 struct firmware_priv *fw_priv = class_get_devdata(class_dev); 101 struct firmware_priv *fw_priv = class_get_devdata(class_dev);
@@ -104,13 +104,12 @@ firmware_class_hotplug(struct class_device *class_dev, char **envp,
104 if (!test_bit(FW_STATUS_READY, &fw_priv->status)) 104 if (!test_bit(FW_STATUS_READY, &fw_priv->status))
105 return -ENODEV; 105 return -ENODEV;
106 106
107 if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &len, 107 if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len,
108 "FIRMWARE=%s", fw_priv->fw_id)) 108 "FIRMWARE=%s", fw_priv->fw_id))
109 return -ENOMEM; 109 return -ENOMEM;
110 if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &len, 110 if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len,
111 "TIMEOUT=%i", loading_timeout)) 111 "TIMEOUT=%i", loading_timeout))
112 return -ENOMEM; 112 return -ENOMEM;
113
114 envp[i] = NULL; 113 envp[i] = NULL;
115 114
116 return 0; 115 return 0;
@@ -352,7 +351,7 @@ error_kfree:
352 351
353static int 352static int
354fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p, 353fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p,
355 const char *fw_name, struct device *device, int hotplug) 354 const char *fw_name, struct device *device, int uevent)
356{ 355{
357 struct class_device *class_dev; 356 struct class_device *class_dev;
358 struct firmware_priv *fw_priv; 357 struct firmware_priv *fw_priv;
@@ -384,7 +383,7 @@ fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p,
384 goto error_unreg; 383 goto error_unreg;
385 } 384 }
386 385
387 if (hotplug) 386 if (uevent)
388 set_bit(FW_STATUS_READY, &fw_priv->status); 387 set_bit(FW_STATUS_READY, &fw_priv->status);
389 else 388 else
390 set_bit(FW_STATUS_READY_NOHOTPLUG, &fw_priv->status); 389 set_bit(FW_STATUS_READY_NOHOTPLUG, &fw_priv->status);
@@ -399,7 +398,7 @@ out:
399 398
400static int 399static int
401_request_firmware(const struct firmware **firmware_p, const char *name, 400_request_firmware(const struct firmware **firmware_p, const char *name,
402 struct device *device, int hotplug) 401 struct device *device, int uevent)
403{ 402{
404 struct class_device *class_dev; 403 struct class_device *class_dev;
405 struct firmware_priv *fw_priv; 404 struct firmware_priv *fw_priv;
@@ -418,19 +417,19 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
418 } 417 }
419 418
420 retval = fw_setup_class_device(firmware, &class_dev, name, device, 419 retval = fw_setup_class_device(firmware, &class_dev, name, device,
421 hotplug); 420 uevent);
422 if (retval) 421 if (retval)
423 goto error_kfree_fw; 422 goto error_kfree_fw;
424 423
425 fw_priv = class_get_devdata(class_dev); 424 fw_priv = class_get_devdata(class_dev);
426 425
427 if (hotplug) { 426 if (uevent) {
428 if (loading_timeout > 0) { 427 if (loading_timeout > 0) {
429 fw_priv->timeout.expires = jiffies + loading_timeout * HZ; 428 fw_priv->timeout.expires = jiffies + loading_timeout * HZ;
430 add_timer(&fw_priv->timeout); 429 add_timer(&fw_priv->timeout);
431 } 430 }
432 431
433 kobject_hotplug(&class_dev->kobj, KOBJ_ADD); 432 kobject_uevent(&class_dev->kobj, KOBJ_ADD);
434 wait_for_completion(&fw_priv->completion); 433 wait_for_completion(&fw_priv->completion);
435 set_bit(FW_STATUS_DONE, &fw_priv->status); 434 set_bit(FW_STATUS_DONE, &fw_priv->status);
436 del_timer_sync(&fw_priv->timeout); 435 del_timer_sync(&fw_priv->timeout);
@@ -456,7 +455,7 @@ out:
456} 455}
457 456
458/** 457/**
459 * request_firmware: - request firmware to hotplug and wait for it 458 * request_firmware: - send firmware request and wait for it
460 * @firmware_p: pointer to firmware image 459 * @firmware_p: pointer to firmware image
461 * @name: name of firmware file 460 * @name: name of firmware file
462 * @device: device for which firmware is being loaded 461 * @device: device for which firmware is being loaded
@@ -466,7 +465,7 @@ out:
466 * 465 *
467 * Should be called from user context where sleeping is allowed. 466 * Should be called from user context where sleeping is allowed.
468 * 467 *
469 * @name will be used as $FIRMWARE in the hotplug environment and 468 * @name will be used as $FIRMWARE in the uevent environment and
470 * should be distinctive enough not to be confused with any other 469 * should be distinctive enough not to be confused with any other
471 * firmware image for this or any other device. 470 * firmware image for this or any other device.
472 **/ 471 **/
@@ -474,8 +473,8 @@ int
474request_firmware(const struct firmware **firmware_p, const char *name, 473request_firmware(const struct firmware **firmware_p, const char *name,
475 struct device *device) 474 struct device *device)
476{ 475{
477 int hotplug = 1; 476 int uevent = 1;
478 return _request_firmware(firmware_p, name, device, hotplug); 477 return _request_firmware(firmware_p, name, device, uevent);
479} 478}
480 479
481/** 480/**
@@ -518,7 +517,7 @@ struct firmware_work {
518 struct device *device; 517 struct device *device;
519 void *context; 518 void *context;
520 void (*cont)(const struct firmware *fw, void *context); 519 void (*cont)(const struct firmware *fw, void *context);
521 int hotplug; 520 int uevent;
522}; 521};
523 522
524static int 523static int
@@ -533,7 +532,7 @@ request_firmware_work_func(void *arg)
533 } 532 }
534 daemonize("%s/%s", "firmware", fw_work->name); 533 daemonize("%s/%s", "firmware", fw_work->name);
535 ret = _request_firmware(&fw, fw_work->name, fw_work->device, 534 ret = _request_firmware(&fw, fw_work->name, fw_work->device,
536 fw_work->hotplug); 535 fw_work->uevent);
537 if (ret < 0) 536 if (ret < 0)
538 fw_work->cont(NULL, fw_work->context); 537 fw_work->cont(NULL, fw_work->context);
539 else { 538 else {
@@ -548,7 +547,7 @@ request_firmware_work_func(void *arg)
548/** 547/**
549 * request_firmware_nowait: asynchronous version of request_firmware 548 * request_firmware_nowait: asynchronous version of request_firmware
550 * @module: module requesting the firmware 549 * @module: module requesting the firmware
551 * @hotplug: invokes hotplug event to copy the firmware image if this flag 550 * @uevent: sends uevent to copy the firmware image if this flag
552 * is non-zero else the firmware copy must be done manually. 551 * is non-zero else the firmware copy must be done manually.
553 * @name: name of firmware file 552 * @name: name of firmware file
554 * @device: device for which firmware is being loaded 553 * @device: device for which firmware is being loaded
@@ -562,7 +561,7 @@ request_firmware_work_func(void *arg)
562 **/ 561 **/
563int 562int
564request_firmware_nowait( 563request_firmware_nowait(
565 struct module *module, int hotplug, 564 struct module *module, int uevent,
566 const char *name, struct device *device, void *context, 565 const char *name, struct device *device, void *context,
567 void (*cont)(const struct firmware *fw, void *context)) 566 void (*cont)(const struct firmware *fw, void *context))
568{ 567{
@@ -583,7 +582,7 @@ request_firmware_nowait(
583 .device = device, 582 .device = device,
584 .context = context, 583 .context = context,
585 .cont = cont, 584 .cont = cont,
586 .hotplug = hotplug, 585 .uevent = uevent,
587 }; 586 };
588 587
589 ret = kernel_thread(request_firmware_work_func, fw_work, 588 ret = kernel_thread(request_firmware_work_func, fw_work,