[1/2] npu2: Add npu2_clear_link_flag()

Message ID 1502303377-28407-1-git-send-email-arbab@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Reza Arbab Aug. 9, 2017, 6:29 p.m.
Add a complement to npu2_set_link_flag().

Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
---
 hw/npu2.c      | 7 +++++++
 include/npu2.h | 1 +
 2 files changed, 8 insertions(+)

Comments

Stewart Smith Sept. 13, 2017, 6:58 a.m. | #1
Reza Arbab <arbab@linux.vnet.ibm.com> writes:
> Add a complement to npu2_set_link_flag().
>
> Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
> ---
>  hw/npu2.c      | 7 +++++++
>  include/npu2.h | 1 +
>  2 files changed, 8 insertions(+)

Thanks, series merged to master as of f5c55f30f6a1120cb73b6089b60a64e595ee197c

Patch

diff --git a/hw/npu2.c b/hw/npu2.c
index 74e3325..807c78d 100644
--- a/hw/npu2.c
+++ b/hw/npu2.c
@@ -147,6 +147,13 @@  void npu2_set_link_flag(struct npu2_dev *ndev, uint8_t flag)
 			     VENDOR_CAP_PCI_DEV_OFFSET, 1, ndev->link_flags);
 }
 
+void npu2_clear_link_flag(struct npu2_dev *ndev, uint8_t flag)
+{
+	ndev->link_flags &= ~flag;
+	PCI_VIRT_CFG_INIT_RO(ndev->pvd, VENDOR_CAP_START +
+			     VENDOR_CAP_PCI_DEV_OFFSET, 1, ndev->link_flags);
+}
+
 static inline void npu2_ioda_sel(struct npu2 *p, uint32_t table,
 				uint32_t index, bool autoinc)
 {
diff --git a/include/npu2.h b/include/npu2.h
index 544e98e..ef05f46 100644
--- a/include/npu2.h
+++ b/include/npu2.h
@@ -156,5 +156,6 @@  int64_t npu2_dev_procedure(void *dev, struct pci_cfg_reg_filter *pcrf,
 			   uint32_t offset, uint32_t len, uint32_t *data,
 			   bool write);
 void npu2_set_link_flag(struct npu2_dev *ndev, uint8_t flag);
+void npu2_clear_link_flag(struct npu2_dev *ndev, uint8_t flag);
 extern int nv_zcal_nominal;
 #endif /* __NPU2_H */