diff options
author | Helge Deller <deller@gmx.de> | 2008-12-25 15:04:00 -0500 |
---|---|---|
committer | Kyle McMartin <kyle@mcmartin.ca> | 2009-01-05 14:11:59 -0500 |
commit | 7246c31e45021bc68688c4a8fd2bbb70b485d1ef (patch) | |
tree | baaa5913bec7d3a36b02861f67e1cdde66815005 /arch | |
parent | 5fbf6635a951a75870be9874580c55da538fb025 (diff) |
parisc: add uevent helper for parisc bus
parisc: add uevent helper for parisc bus
udev device-driver auto detection was failing to work on the GSC bus, since
udev didn't knew wich driver to load due to a missing MODALIAS environment
variable from kernel.
This patch fixes this by adding the MODALIAS environment variable to the
uevent kernel notifications.
Since modalias_show() generated the modalias string already, I splitted this
out and created a new static function make_modalias() which is now used by
modalias_show() and the new parisc_uevent() function.
Tested on 715/64 and c3000.
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/parisc/kernel/drivers.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c index 884b7ce16a3b..994bcd980909 100644 --- a/arch/parisc/kernel/drivers.c +++ b/arch/parisc/kernel/drivers.c | |||
@@ -549,6 +549,38 @@ static int parisc_generic_match(struct device *dev, struct device_driver *drv) | |||
549 | return match_device(to_parisc_driver(drv), to_parisc_device(dev)); | 549 | return match_device(to_parisc_driver(drv), to_parisc_device(dev)); |
550 | } | 550 | } |
551 | 551 | ||
552 | static ssize_t make_modalias(struct device *dev, char *buf) | ||
553 | { | ||
554 | const struct parisc_device *padev = to_parisc_device(dev); | ||
555 | const struct parisc_device_id *id = &padev->id; | ||
556 | |||
557 | return sprintf(buf, "parisc:t%02Xhv%04Xrev%02Xsv%08X\n", | ||
558 | (u8)id->hw_type, (u16)id->hversion, (u8)id->hversion_rev, | ||
559 | (u32)id->sversion); | ||
560 | } | ||
561 | |||
562 | static int parisc_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
563 | { | ||
564 | const struct parisc_device *padev; | ||
565 | char modalias[40]; | ||
566 | |||
567 | if (!dev) | ||
568 | return -ENODEV; | ||
569 | |||
570 | padev = to_parisc_device(dev); | ||
571 | if (!padev) | ||
572 | return -ENODEV; | ||
573 | |||
574 | if (add_uevent_var(env, "PARISC_NAME=%s", padev->name)) | ||
575 | return -ENOMEM; | ||
576 | |||
577 | make_modalias(dev, modalias); | ||
578 | if (add_uevent_var(env, "MODALIAS=%s", modalias)) | ||
579 | return -ENOMEM; | ||
580 | |||
581 | return 0; | ||
582 | } | ||
583 | |||
552 | #define pa_dev_attr(name, field, format_string) \ | 584 | #define pa_dev_attr(name, field, format_string) \ |
553 | static ssize_t name##_show(struct device *dev, struct device_attribute *attr, char *buf) \ | 585 | static ssize_t name##_show(struct device *dev, struct device_attribute *attr, char *buf) \ |
554 | { \ | 586 | { \ |
@@ -566,12 +598,7 @@ pa_dev_attr_id(sversion, "0x%05x\n"); | |||
566 | 598 | ||
567 | static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) | 599 | static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) |
568 | { | 600 | { |
569 | struct parisc_device *padev = to_parisc_device(dev); | 601 | return make_modalias(dev, buf); |
570 | struct parisc_device_id *id = &padev->id; | ||
571 | |||
572 | return sprintf(buf, "parisc:t%02Xhv%04Xrev%02Xsv%08X\n", | ||
573 | (u8)id->hw_type, (u16)id->hversion, (u8)id->hversion_rev, | ||
574 | (u32)id->sversion); | ||
575 | } | 602 | } |
576 | 603 | ||
577 | static struct device_attribute parisc_device_attrs[] = { | 604 | static struct device_attribute parisc_device_attrs[] = { |
@@ -587,6 +614,7 @@ static struct device_attribute parisc_device_attrs[] = { | |||
587 | struct bus_type parisc_bus_type = { | 614 | struct bus_type parisc_bus_type = { |
588 | .name = "parisc", | 615 | .name = "parisc", |
589 | .match = parisc_generic_match, | 616 | .match = parisc_generic_match, |
617 | .uevent = parisc_uevent, | ||
590 | .dev_attrs = parisc_device_attrs, | 618 | .dev_attrs = parisc_device_attrs, |
591 | .probe = parisc_driver_probe, | 619 | .probe = parisc_driver_probe, |
592 | .remove = parisc_driver_remove, | 620 | .remove = parisc_driver_remove, |