diff options
author | Bryan O'Sullivan <bos@pathscale.com> | 2006-04-24 14:22:57 -0700 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-05-01 12:14:11 -0700 |
commit | 755e4ca4a9885b79a14169ab5b615920eb38a32a (patch) | |
tree | df85b5a5f16f25db7f6d106c69f4ddb10b9f1880 /drivers/infiniband/hw/ipath/ipath_sysfs.c | |
parent | 254abfd33a214617deb916585b306faee834c97f (diff) | |
download | op-kernel-dev-755e4ca4a9885b79a14169ab5b615920eb38a32a.zip op-kernel-dev-755e4ca4a9885b79a14169ab5b615920eb38a32a.tar.gz |
IB/ipath: fix race with exposing reset file
We were accidentally exposing the "reset" sysfs file more than once
per device.
Signed-off-by: Bryan O'Sullivan <bos@pathscale.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_sysfs.c')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_sysfs.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_sysfs.c b/drivers/infiniband/hw/ipath/ipath_sysfs.c index 32acd80..f323791 100644 --- a/drivers/infiniband/hw/ipath/ipath_sysfs.c +++ b/drivers/infiniband/hw/ipath/ipath_sysfs.c @@ -711,10 +711,22 @@ static struct attribute_group dev_attr_group = { * enters diag mode. A device reset is quite likely to crash the * machine entirely, so we don't want to normally make it * available. + * + * Called with ipath_mutex held. */ int ipath_expose_reset(struct device *dev) { - return device_create_file(dev, &dev_attr_reset); + static int exposed; + int ret; + + if (!exposed) { + ret = device_create_file(dev, &dev_attr_reset); + exposed = 1; + } + else + ret = 0; + + return ret; } int ipath_driver_create_group(struct device_driver *drv) |