summaryrefslogtreecommitdiff
path: root/drivers/eisa/eisa-bus.c
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2006-12-12 23:13:32 (GMT)
committerDave Jones <davej@redhat.com>2006-12-12 23:13:32 (GMT)
commitf0eef25339f92f7cd4aeea23d9ae97987a5a1e82 (patch)
tree2472e94d39f43a9580a6d2d5d92de0b749023263 /drivers/eisa/eisa-bus.c
parent0cfea5dd98205f2fa318836da664a7d7df1afbc1 (diff)
parente1036502e5263851259d147771226161e5ccc85a (diff)
downloadlinux-fsl-qoriq-f0eef25339f92f7cd4aeea23d9ae97987a5a1e82.tar.xz
Merge ../linus
Diffstat (limited to 'drivers/eisa/eisa-bus.c')
-rw-r--r--drivers/eisa/eisa-bus.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c
index 6078e2f..d944647 100644
--- a/drivers/eisa/eisa-bus.c
+++ b/drivers/eisa/eisa-bus.c
@@ -128,9 +128,23 @@ static int eisa_bus_match (struct device *dev, struct device_driver *drv)
return 0;
}
+static int eisa_bus_uevent(struct device *dev, char **envp, int num_envp,
+ char *buffer, int buffer_size)
+{
+ struct eisa_device *edev = to_eisa_device(dev);
+ int i = 0;
+ int length = 0;
+
+ add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
+ "MODALIAS=" EISA_DEVICE_MODALIAS_FMT, edev->id.sig);
+ envp[i] = NULL;
+ return 0;
+}
+
struct bus_type eisa_bus_type = {
.name = "eisa",
.match = eisa_bus_match,
+ .uevent = eisa_bus_uevent,
};
int eisa_driver_register (struct eisa_driver *edrv)
@@ -160,6 +174,14 @@ static ssize_t eisa_show_state (struct device *dev, struct device_attribute *att
static DEVICE_ATTR(enabled, S_IRUGO, eisa_show_state, NULL);
+static ssize_t eisa_show_modalias (struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct eisa_device *edev = to_eisa_device (dev);
+ return sprintf (buf, EISA_DEVICE_MODALIAS_FMT "\n", edev->id.sig);
+}
+
+static DEVICE_ATTR(modalias, S_IRUGO, eisa_show_modalias, NULL);
+
static int __init eisa_init_device (struct eisa_root_device *root,
struct eisa_device *edev,
int slot)
@@ -204,13 +226,26 @@ static int __init eisa_init_device (struct eisa_root_device *root,
static int __init eisa_register_device (struct eisa_device *edev)
{
- if (device_register (&edev->dev))
- return -1;
+ int rc = device_register (&edev->dev);
+ if (rc)
+ return rc;
- device_create_file (&edev->dev, &dev_attr_signature);
- device_create_file (&edev->dev, &dev_attr_enabled);
+ rc = device_create_file (&edev->dev, &dev_attr_signature);
+ if (rc) goto err_devreg;
+ rc = device_create_file (&edev->dev, &dev_attr_enabled);
+ if (rc) goto err_sig;
+ rc = device_create_file (&edev->dev, &dev_attr_modalias);
+ if (rc) goto err_enab;
return 0;
+
+err_enab:
+ device_remove_file (&edev->dev, &dev_attr_enabled);
+err_sig:
+ device_remove_file (&edev->dev, &dev_attr_signature);
+err_devreg:
+ device_unregister(&edev->dev);
+ return rc;
}
static int __init eisa_request_resources (struct eisa_root_device *root,