Skip to content

Commit b2c80be

Browse files
Fix typo and error check when retrieving pci information
Fix 1. typo PhysialDevicePciSpeedInfo to PhysicalDevicePciSpeedInfo 2. error check to verify open() call Signed-off-by: Joshua Santosh Ranjan <[email protected]>
1 parent 95505d8 commit b2c80be

File tree

15 files changed

+50
-38
lines changed

15 files changed

+50
-38
lines changed

level_zero/core/test/unit_tests/sources/device/linux/test_device_pci_speed_info_linux.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace L0 {
1515
namespace ult {
1616

17-
void PciSpeedInfoTest::setPciSpeedInfo(NEO::ExecutionEnvironment *executionEnvironment, const NEO::PhyicalDevicePciSpeedInfo &pciSpeedInfo) {
17+
void PciSpeedInfoTest::setPciSpeedInfo(NEO::ExecutionEnvironment *executionEnvironment, const NEO::PhysicalDevicePciSpeedInfo &pciSpeedInfo) {
1818
auto driverModel = std::make_unique<NEO::MockDriverModel>();
1919
driverModel->pciSpeedInfo = pciSpeedInfo;
2020
driverModel->pciBusInfo = {0, 1, 2, 3};

level_zero/core/test/unit_tests/sources/device/test_device_pci_speed_info.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
namespace L0 {
1919
namespace ult {
2020

21-
std::unique_ptr<NEO::UltDeviceFactory> PciSpeedInfoTest::createDevices(uint32_t numSubDevices, const NEO::PhyicalDevicePciSpeedInfo &pciSpeedInfo) {
21+
std::unique_ptr<NEO::UltDeviceFactory> PciSpeedInfoTest::createDevices(uint32_t numSubDevices, const NEO::PhysicalDevicePciSpeedInfo &pciSpeedInfo) {
2222

2323
DebugManager.flags.CreateMultipleSubDevices.set(numSubDevices);
2424
DebugManager.flags.EnableChipsetUniqueUUID.set(0);
@@ -31,7 +31,7 @@ std::unique_ptr<NEO::UltDeviceFactory> PciSpeedInfoTest::createDevices(uint32_t
3131

3232
TEST_F(PciSpeedInfoTest, givenSuccessfulReadingOfSpeedValuesCorrectValuesAreReturned) {
3333

34-
NEO::PhyicalDevicePciSpeedInfo expectedSpeedInfo;
34+
NEO::PhysicalDevicePciSpeedInfo expectedSpeedInfo;
3535
expectedSpeedInfo.genVersion = 4;
3636
expectedSpeedInfo.width = 1024;
3737
expectedSpeedInfo.maxBandwidth = 4096;

level_zero/core/test/unit_tests/sources/device/test_device_pci_speed_info.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "gtest/gtest.h"
1313

1414
namespace NEO {
15-
struct PhyicalDevicePciSpeedInfo;
15+
struct PhysicalDevicePciSpeedInfo;
1616
struct UltDeviceFactory;
1717
class ExecutionEnvironment;
1818
} // namespace NEO
@@ -21,11 +21,11 @@ namespace L0 {
2121
namespace ult {
2222

2323
struct PciSpeedInfoTest : public ::testing::Test {
24-
std::unique_ptr<NEO::UltDeviceFactory> createDevices(uint32_t numSubDevices, const NEO::PhyicalDevicePciSpeedInfo &pciSpeedInfo);
24+
std::unique_ptr<NEO::UltDeviceFactory> createDevices(uint32_t numSubDevices, const NEO::PhysicalDevicePciSpeedInfo &pciSpeedInfo);
2525
DebugManagerStateRestore restorer;
2626

2727
private:
28-
void setPciSpeedInfo(NEO::ExecutionEnvironment *executionEnvironment, const NEO::PhyicalDevicePciSpeedInfo &pciSpeedInfo);
28+
void setPciSpeedInfo(NEO::ExecutionEnvironment *executionEnvironment, const NEO::PhysicalDevicePciSpeedInfo &pciSpeedInfo);
2929
};
3030

3131
} // namespace ult

level_zero/core/test/unit_tests/sources/device/windows/test_device_pci_speed_info_windows.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ namespace ult {
2121
class PciSpeedInfoTestDriverModel : public WddmMock {
2222
public:
2323
PciSpeedInfoTestDriverModel(RootDeviceEnvironment &rootDeviceEnvironment) : WddmMock(rootDeviceEnvironment) {}
24-
void setExpectedPciSpeedInfo(const PhyicalDevicePciSpeedInfo &pciSpeedInfo) {
24+
void setExpectedPciSpeedInfo(const PhysicalDevicePciSpeedInfo &pciSpeedInfo) {
2525
returnedSpeedInfo = pciSpeedInfo;
2626
}
2727

28-
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override {
28+
PhysicalDevicePciSpeedInfo getPciSpeedInfo() const override {
2929
return returnedSpeedInfo;
3030
}
3131
PhysicalDevicePciBusInfo getPciBusInfo() const override {
3232
return NEO::PhysicalDevicePciBusInfo(0, 1, 2, 3);
3333
}
3434

35-
PhyicalDevicePciSpeedInfo returnedSpeedInfo = {-1, -1, -1};
35+
PhysicalDevicePciSpeedInfo returnedSpeedInfo = {-1, -1, -1};
3636
};
3737

38-
void PciSpeedInfoTest::setPciSpeedInfo(NEO::ExecutionEnvironment *executionEnvironment, const NEO::PhyicalDevicePciSpeedInfo &pciSpeedInfo) {
38+
void PciSpeedInfoTest::setPciSpeedInfo(NEO::ExecutionEnvironment *executionEnvironment, const NEO::PhysicalDevicePciSpeedInfo &pciSpeedInfo) {
3939
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(
4040
std::make_unique<PciSpeedInfoTestDriverModel>(*executionEnvironment->rootDeviceEnvironments[0]));
4141
PciSpeedInfoTestDriverModel *driverModel = static_cast<PciSpeedInfoTestDriverModel *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel());

level_zero/tools/test/unit_tests/sources/sysman/linux/test_sysman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ class UnknownDriverModel : public DriverModel {
433433
PhysicalDevicePciBusInfo pciBusInfo(PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue);
434434
return pciBusInfo;
435435
}
436-
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override { return {}; }
436+
PhysicalDevicePciSpeedInfo getPciSpeedInfo() const override { return {}; }
437437

438438
bool isGpuHangDetected(OsContext &osContext) override {
439439
return false;

opencl/test/unit_test/execution_environment/execution_environment_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ class DriverModelMock : public DriverModel {
292292
PhysicalDevicePciBusInfo getPciBusInfo() const override {
293293
return {};
294294
}
295-
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override {
295+
PhysicalDevicePciSpeedInfo getPciSpeedInfo() const override {
296296
return {};
297297
}
298298

shared/source/os_interface/driver_info.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct PhysicalDevicePciBusInfo {
3333
uint32_t pciFunction = invalidValue;
3434
};
3535

36-
struct PhyicalDevicePciSpeedInfo {
36+
struct PhysicalDevicePciSpeedInfo {
3737
static constexpr int32_t unknown = -1;
3838
int32_t genVersion = unknown;
3939
int32_t width = unknown;

shared/source/os_interface/linux/drm_neo.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,9 +1485,9 @@ int Drm::createDrmVirtualMemory(uint32_t &drmVmId) {
14851485
return ret;
14861486
}
14871487

1488-
PhyicalDevicePciSpeedInfo Drm::getPciSpeedInfo() const {
1488+
PhysicalDevicePciSpeedInfo Drm::getPciSpeedInfo() const {
14891489

1490-
PhyicalDevicePciSpeedInfo pciSpeedInfo = {};
1490+
PhysicalDevicePciSpeedInfo pciSpeedInfo = {};
14911491

14921492
std::string pathPrefix{};
14931493
bool isIntegratedDevice = rootDeviceEnvironment.getHardwareInfo()->capabilityTable.isIntegratedDevice;
@@ -1516,7 +1516,7 @@ PhyicalDevicePciSpeedInfo Drm::getPciSpeedInfo() const {
15161516
linkWidthStream << pathPrefix << fileName;
15171517

15181518
int fd = NEO::SysCalls::open(linkWidthStream.str().c_str(), O_RDONLY);
1519-
if (fd == 0) {
1519+
if (fd < 0) {
15201520
return false;
15211521
}
15221522
ssize_t bytesRead = NEO::SysCalls::pread(fd, readString.data(), readString.size() - 1, 0);

shared/source/os_interface/linux/drm_neo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class Drm : public DriverModel {
8484
unsigned int getDeviceHandle() const override {
8585
return 0;
8686
}
87-
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override;
87+
PhysicalDevicePciSpeedInfo getPciSpeedInfo() const override;
8888
int getExecSoftPin(int &execSoftPin);
8989
int enableTurboBoost();
9090
int getEuTotal(int &euTotal);

shared/source/os_interface/os_interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class DriverModel : public NonCopyableClass {
7979
}
8080

8181
virtual PhysicalDevicePciBusInfo getPciBusInfo() const = 0;
82-
virtual PhyicalDevicePciSpeedInfo getPciSpeedInfo() const = 0;
82+
virtual PhysicalDevicePciSpeedInfo getPciSpeedInfo() const = 0;
8383

8484
virtual size_t getMaxMemAllocSize() const {
8585
return std::numeric_limits<size_t>::max();

0 commit comments

Comments
 (0)