Commit f9c82a0b authored by Dean Luick's avatar Dean Luick Committed by Doug Ledford

IB/hfi1: Fix i2c resource reservation checks

The i2c and qsfp read/write routines should check for the resource
reservation of the incoming argument target rather than the implicit
target of the hardware HFI.
Reviewed-by: default avatarEaswar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: default avatarDean Luick <dean.luick@intel.com>
Signed-off-by: default avatarJubin John <jubin.john@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 4ee15859
...@@ -96,7 +96,7 @@ int i2c_write(struct hfi1_pportdata *ppd, u32 target, int i2c_addr, int offset, ...@@ -96,7 +96,7 @@ int i2c_write(struct hfi1_pportdata *ppd, u32 target, int i2c_addr, int offset,
{ {
int ret; int ret;
if (!check_chip_resource(ppd->dd, qsfp_resource(ppd->dd), __func__)) if (!check_chip_resource(ppd->dd, i2c_target(target), __func__))
return -EACCES; return -EACCES;
/* make sure the TWSI bus is in a sane state */ /* make sure the TWSI bus is in a sane state */
...@@ -162,7 +162,7 @@ int i2c_read(struct hfi1_pportdata *ppd, u32 target, int i2c_addr, int offset, ...@@ -162,7 +162,7 @@ int i2c_read(struct hfi1_pportdata *ppd, u32 target, int i2c_addr, int offset,
{ {
int ret; int ret;
if (!check_chip_resource(ppd->dd, qsfp_resource(ppd->dd), __func__)) if (!check_chip_resource(ppd->dd, i2c_target(target), __func__))
return -EACCES; return -EACCES;
/* make sure the TWSI bus is in a sane state */ /* make sure the TWSI bus is in a sane state */
...@@ -192,7 +192,7 @@ int qsfp_write(struct hfi1_pportdata *ppd, u32 target, int addr, void *bp, ...@@ -192,7 +192,7 @@ int qsfp_write(struct hfi1_pportdata *ppd, u32 target, int addr, void *bp,
int ret; int ret;
u8 page; u8 page;
if (!check_chip_resource(ppd->dd, qsfp_resource(ppd->dd), __func__)) if (!check_chip_resource(ppd->dd, i2c_target(target), __func__))
return -EACCES; return -EACCES;
/* make sure the TWSI bus is in a sane state */ /* make sure the TWSI bus is in a sane state */
...@@ -276,7 +276,7 @@ int qsfp_read(struct hfi1_pportdata *ppd, u32 target, int addr, void *bp, ...@@ -276,7 +276,7 @@ int qsfp_read(struct hfi1_pportdata *ppd, u32 target, int addr, void *bp,
int ret; int ret;
u8 page; u8 page;
if (!check_chip_resource(ppd->dd, qsfp_resource(ppd->dd), __func__)) if (!check_chip_resource(ppd->dd, i2c_target(target), __func__))
return -EACCES; return -EACCES;
/* make sure the TWSI bus is in a sane state */ /* make sure the TWSI bus is in a sane state */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment