mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
rapidio: add udev notification
Add RapidIO-specific modalias generation to enable udev notifications about RapidIO-specific events. The RapidIO modalias string format is shown below: "rapidio:vNNNNdNNNNavNNNNadNNNN" Where: v - Device Vendor ID (16 bit), d - Device ID (16 bit), av - Assembly Vendor ID (16 bit), ad - Assembly ID (16 bit), as they are reported in corresponding Capability Registers (CARs) of each RapidIO device. Signed-off-by: Alexandre Bounine <[email protected]> Cc: Matt Porter <[email protected]> Cc: Li Yang <[email protected]> Cc: Kumar Gala <[email protected]> Cc: Andre van Herk <[email protected]> Cc: Micha Nelissen <[email protected]> Cc: Stef van Os <[email protected]> Cc: Jean Delvare <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
fdf90abc00
commit
3bdbb62fe9
7 changed files with 74 additions and 17 deletions
|
|
@ -199,6 +199,23 @@ static int rio_match_bus(struct device *dev, struct device_driver *drv)
|
|||
out:return 0;
|
||||
}
|
||||
|
||||
static int rio_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
{
|
||||
struct rio_dev *rdev;
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
rdev = to_rio_dev(dev);
|
||||
if (!rdev)
|
||||
return -ENODEV;
|
||||
|
||||
if (add_uevent_var(env, "MODALIAS=rapidio:v%04Xd%04Xav%04Xad%04X",
|
||||
rdev->vid, rdev->did, rdev->asm_vid, rdev->asm_did))
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct device rio_bus = {
|
||||
.init_name = "rapidio",
|
||||
};
|
||||
|
|
@ -210,6 +227,7 @@ struct bus_type rio_bus_type = {
|
|||
.bus_attrs = rio_bus_attrs,
|
||||
.probe = rio_device_probe,
|
||||
.remove = rio_device_remove,
|
||||
.uevent = rio_uevent,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -84,6 +84,15 @@ static ssize_t lnext_show(struct device *dev,
|
|||
return str - buf;
|
||||
}
|
||||
|
||||
static ssize_t modalias_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct rio_dev *rdev = to_rio_dev(dev);
|
||||
|
||||
return sprintf(buf, "rapidio:v%04Xd%04Xav%04Xad%04X\n",
|
||||
rdev->vid, rdev->did, rdev->asm_vid, rdev->asm_did);
|
||||
}
|
||||
|
||||
struct device_attribute rio_dev_attrs[] = {
|
||||
__ATTR_RO(did),
|
||||
__ATTR_RO(vid),
|
||||
|
|
@ -93,6 +102,7 @@ struct device_attribute rio_dev_attrs[] = {
|
|||
__ATTR_RO(asm_rev),
|
||||
__ATTR_RO(lprev),
|
||||
__ATTR_RO(destid),
|
||||
__ATTR_RO(modalias),
|
||||
__ATTR_NULL,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue