1 // SPDX-License-Identifier: GPL-2.0-only 2 /* Copyright(c) 2021 Intel Corporation. All rights reserved. */ 3 #include <cxl.h> 4 #include "test/mock.h" 5 #include <core/core.h> 6 match_nvdimm_bridge(struct device * dev,const void * data)7int match_nvdimm_bridge(struct device *dev, const void *data) 8 { 9 int index, rc = 0; 10 struct cxl_mock_ops *ops = get_cxl_mock_ops(&index); 11 const struct cxl_nvdimm *cxl_nvd = data; 12 13 if (ops) { 14 if (dev->type == &cxl_nvdimm_bridge_type && 15 (ops->is_mock_dev(dev->parent->parent) == 16 ops->is_mock_dev(cxl_nvd->dev.parent->parent))) 17 rc = 1; 18 } else 19 rc = dev->type == &cxl_nvdimm_bridge_type; 20 21 put_cxl_mock_ops(index); 22 23 return rc; 24 } 25