Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28288
b: refs/heads/master
c: a0245f7
h: refs/heads/master
v: v3
  • Loading branch information
David Brownell authored and Greg Kroah-Hartman committed Jun 21, 2006
1 parent 1105efa commit 78809ca
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 05967118a6c354eaa5950429c70ad4c8daca94bf
refs/heads/master: a0245f7ad5214cb00131d7cd176446e067c913dc
33 changes: 33 additions & 0 deletions trunk/drivers/base/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,37 @@ void platform_driver_unregister(struct platform_driver *drv)
EXPORT_SYMBOL_GPL(platform_driver_unregister);


/* modalias support enables more hands-off userspace setup:
* (a) environment variable lets new-style hotplug events work once system is
* fully running: "modprobe $MODALIAS"
* (b) sysfs attribute lets new-style coldplug recover from hotplug events
* mishandled before system is fully running: "modprobe $(cat modalias)"
*/
static ssize_t
modalias_show(struct device *dev, struct device_attribute *a, char *buf)
{
struct platform_device *pdev = to_platform_device(dev);
int len = snprintf(buf, PAGE_SIZE, "%s\n", pdev->name);

return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
}

static struct device_attribute platform_dev_attrs[] = {
__ATTR_RO(modalias),
__ATTR_NULL,
};

static int platform_uevent(struct device *dev, char **envp, int num_envp,
char *buffer, int buffer_size)
{
struct platform_device *pdev = to_platform_device(dev);

envp[0] = buffer;
snprintf(buffer, buffer_size, "MODALIAS=%s", pdev->name);
return 0;
}


/**
* platform_match - bind platform device to platform driver.
* @dev: device.
Expand Down Expand Up @@ -496,7 +527,9 @@ static int platform_resume(struct device * dev)

struct bus_type platform_bus_type = {
.name = "platform",
.dev_attrs = platform_dev_attrs,
.match = platform_match,
.uevent = platform_uevent,
.suspend = platform_suspend,
.resume = platform_resume,
};
Expand Down

0 comments on commit 78809ca

Please sign in to comment.