Cleanup and fixes in sysman source

In this Change:
 - Initialize local variables used in pci source.
 - Move setting of temperature handle's type to constructor of
   TemperatureImp class as temperature handle's type is used in
   init() of TemperatureImp class.
 - Allow only ENOENT  errno at the end of FsAccess::listDirectory function.
   Because in this function all directory entries will be read in a
   loop. And loop will exit only after readdir() finished reading
   all entries in directory and thus readdir() will exit, when it fails
   reading any further entry. Thus system will return ENOENT for readdir.

Change-Id: Ibd3ac3f841b114fd87edea1410750b33f3a14e5b
Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
Jitendra Sharma
2020-06-24 18:15:45 +05:30
committed by sys_ocldev
parent 7e56a8303a
commit c43759cc48
5 changed files with 8 additions and 9 deletions

View File

@ -185,7 +185,7 @@ ze_result_t FsAccess::listDirectory(const std::string path, std::vector<std::str
}
::closedir(procDir);
// Check if in above while loop, readdir encountered any error.
if (errno != 0) {
if ((errno != 0) && (errno != ENOENT)) {
list.clear();
return getResult(errno);
}

View File

@ -78,9 +78,9 @@ void PciImp::init() {
&pciProperties.address.device, &pciProperties.address.function);
}
uint32_t maxLinkWidth, gen;
uint64_t maxBandWidth;
double maxLinkSpeed;
uint32_t maxLinkWidth = 0, gen = 0;
uint64_t maxBandWidth = 0;
double maxLinkSpeed = 0;
pOsPci->getMaxLinkSpeed(maxLinkSpeed);
pOsPci->getMaxLinkWidth(maxLinkWidth);
maxBandWidth = maxLinkWidth * convertPcieSpeedFromGTsToBs(maxLinkSpeed);

View File

@ -18,8 +18,7 @@ TemperatureHandleContext::~TemperatureHandleContext() {
}
void TemperatureHandleContext::createHandle(zet_temp_sensors_t type) {
Temperature *pTemperature = new TemperatureImp(pOsSysman);
pTemperature->sensorType = type;
Temperature *pTemperature = new TemperatureImp(pOsSysman, type);
if (pTemperature->initSuccess == true) {
handleList.push_back(pTemperature);
} else {

View File

@ -32,9 +32,9 @@ void TemperatureImp::init() {
pOsTemperature->setSensorType(this->sensorType);
}
TemperatureImp::TemperatureImp(OsSysman *pOsSysman) {
TemperatureImp::TemperatureImp(OsSysman *pOsSysman, zet_temp_sensors_t type) {
pOsTemperature = OsTemperature::create(pOsSysman);
this->sensorType = type;
init();
}

View File

@ -21,7 +21,7 @@ class TemperatureImp : public NEO::NonCopyableClass, public Temperature {
ze_result_t temperatureGetState(double *pTemperature) override;
TemperatureImp() = default;
TemperatureImp(OsSysman *pOsSysman);
TemperatureImp(OsSysman *pOsSysman, zet_temp_sensors_t type);
~TemperatureImp() override;
OsTemperature *pOsTemperature = nullptr;