summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDean Luick <dean.luick@intel.com>2016-02-03 22:37:24 (GMT)
committerDoug Ledford <dledford@redhat.com>2016-03-11 01:38:00 (GMT)
commite154f12716ffbbd7bab52b48b8e78142a22a59c0 (patch)
tree29318e9ba19077ee06868815ba41c6be55138392 /drivers
parent3fafebb6f6c7084c899924b51c0716a778915c3b (diff)
downloadlinux-e154f12716ffbbd7bab52b48b8e78142a22a59c0.tar.xz
staging/rdma/hfi1: Make EPROM check per device
Add a variable eprom_available to each device, replacing the global of the same name. This is to allow multiple HFI devices with different EPROM availability to operate correctly on the the same system. Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Dean Luick <dean.luick@intel.com> Signed-off-by: Jubin John <jubin.john@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/rdma/hfi1/eprom.c16
-rw-r--r--drivers/staging/rdma/hfi1/hfi.h1
2 files changed, 6 insertions, 11 deletions
diff --git a/drivers/staging/rdma/hfi1/eprom.c b/drivers/staging/rdma/hfi1/eprom.c
index 8104a11..29958aa 100644
--- a/drivers/staging/rdma/hfi1/eprom.c
+++ b/drivers/staging/rdma/hfi1/eprom.c
@@ -106,10 +106,8 @@
/*
* Use the EP mutex to guard against other callers from within the driver.
- * Also covers usage of eprom_available.
*/
static DEFINE_MUTEX(eprom_mutex);
-static int eprom_available; /* default: not available */
/*
* Turn on external enable line that allows writing on the flash.
@@ -376,15 +374,13 @@ int handle_eprom_command(struct file *fp, const struct hfi1_cmd *cmd)
return -EINVAL;
}
+ /* some devices do not have an EPROM */
+ if (!dd->eprom_available)
+ return -EOPNOTSUPP;
+
/* lock against other callers touching the ASIC block */
mutex_lock(&eprom_mutex);
- /* some platforms do not have an EPROM */
- if (!eprom_available) {
- ret = -ENOSYS;
- goto done_asic;
- }
-
/* lock against the other HFI on another OS */
ret = acquire_hw_mutex(dd);
if (ret) {
@@ -458,8 +454,6 @@ int eprom_init(struct hfi1_devdata *dd)
/* lock against other callers */
mutex_lock(&eprom_mutex);
- if (eprom_available) /* already initialized */
- goto done_asic;
/*
* Lock against the other HFI on another OS - the mutex above
@@ -487,7 +481,7 @@ int eprom_init(struct hfi1_devdata *dd)
/* wake the device with command "release powerdown NoID" */
write_csr(dd, ASIC_EEP_ADDR_CMD, CMD_RELEASE_POWERDOWN_NOID);
- eprom_available = 1;
+ dd->eprom_available = true;
release_hw_mutex(dd);
done_asic:
mutex_unlock(&eprom_mutex);
diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h
index 023c504..585485b 100644
--- a/drivers/staging/rdma/hfi1/hfi.h
+++ b/drivers/staging/rdma/hfi1/hfi.h
@@ -1145,6 +1145,7 @@ struct hfi1_devdata {
__le64 *rcvhdrtail_dummy_kvaddr;
dma_addr_t rcvhdrtail_dummy_physaddr;
+ bool eprom_available; /* true if EPROM is available for this device */
bool aspm_supported; /* Does HW support ASPM */
bool aspm_enabled; /* ASPM state: enabled/disabled */
/* Serialize ASPM enable/disable between multiple verbs contexts */