Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dell SMF driver hwmon number reorder fix for Dell S6100/Z9100 #2305

Merged
merged 2 commits into from
Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

HWMON_DIR = "/sys/devices/platform/SMF.512/hwmon/"
HWMON_NODE = ', '.join(os.listdir(HWMON_DIR))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why join with commas when there should only ever be one node? This is a confusing way to get the node name, because you should only ever find one node, and will never join anything with commas.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed joe. Since there is only one entry for SMF better I can harness first entry like this: os.listdir(HWMON_DIR)[0]


class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""
Expand All @@ -20,7 +22,7 @@ def __init__(self):

# Get a mailbox register
def get_pmc_register(self, reg_name):
mailbox_dir = "/sys/devices/platform/SMF.512/hwmon/hwmon1"
mailbox_dir = HWMON_DIR + HWMON_NODE
retval = 'ERR'
mb_reg_file = mailbox_dir+'/' + reg_name
if (not os.path.isfile(mb_reg_file)):
Expand Down
4 changes: 3 additions & 1 deletion device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

HWMON_DIR = "/sys/devices/platform/SMF.512/hwmon/"
HWMON_NODE = ', '.join(os.listdir(HWMON_DIR))

class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""
Expand All @@ -20,7 +22,7 @@ def __init__(self):

# Get a mailbox register
def get_pmc_register(self, reg_name):
mailbox_dir = "/sys/devices/platform/SMF.512/hwmon/hwmon1"
mailbox_dir = HWMON_DIR + HWMON_NODE
retval = 'ERR'
mb_reg_file = mailbox_dir+'/' + reg_name
if (not os.path.isfile(mb_reg_file)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
S6100_MAX_PSUS = 2
S6100_MAX_IOMS = 4

MAILBOX_DIR = "/sys/devices/platform/SMF.512/hwmon/hwmon1"
HWMON_DIR = "/sys/devices/platform/SMF.512/hwmon/"
HWMON_NODE = ', '.join(os.listdir(HWMON_DIR))
MAILBOX_DIR = HWMON_DIR + HWMON_NODE
iom_status_list = []

# Get a mailbox register
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
Z9100_MAX_PSUS = 2
S6100_MAX_IOMS = 4

MAILBOX_DIR = "/sys/devices/platform/SMF.512/hwmon/hwmon0"
HWMON_DIR = "/sys/devices/platform/SMF.512/hwmon/"
HWMON_NODE = ', '.join(os.listdir(HWMON_DIR))
MAILBOX_DIR = HWMON_DIR + HWMON_NODE

# Get a mailbox register

Expand Down