[Edgecore][sonic-platform-modules-accton]Support kernel 6.1 and bookworm (#16982)

* [Edgecore][sonic-platform-modules-accton]Support kernel 6.1 and bookworm

* Modify pddf drv code for i2c_remove_callback function fail
This commit is contained in:
jostar-yang 2023-11-01 03:08:58 +08:00 committed by Ying Xie
parent c436ce20be
commit 6ed491db74
105 changed files with 373 additions and 717 deletions

View File

@ -4,14 +4,13 @@ include $(PLATFORM_PATH)/sai.dep
# TODO: re-enable once the following have been updated for bookworm:
# * Nokia
# * Dell
# * Accton
# * Juniper
# * Ragile
include $(PLATFORM_PATH)/platform-modules-s6000.dep
#include $(PLATFORM_PATH)/platform-modules-dell.dep
include $(PLATFORM_PATH)/platform-modules-arista.dep
include $(PLATFORM_PATH)/platform-modules-ingrasys.dep
#include $(PLATFORM_PATH)/platform-modules-accton.dep
include $(PLATFORM_PATH)/platform-modules-accton.dep
include $(PLATFORM_PATH)/platform-modules-alphanetworks.dep
include $(PLATFORM_PATH)/platform-modules-inventec.dep
include $(PLATFORM_PATH)/platform-modules-cel.dep

View File

@ -3,7 +3,6 @@ include $(PLATFORM_PATH)/sai.mk
# TODO: re-enable once the following have been updated for bookworm:
# * Nokia
# * Dell
# * Accton
# * Juniper
# * Ragile
# * Ufispace
@ -11,7 +10,7 @@ include $(PLATFORM_PATH)/sai.mk
#include $(PLATFORM_PATH)/platform-modules-dell.mk
include $(PLATFORM_PATH)/platform-modules-arista.mk
#include $(PLATFORM_PATH)/platform-modules-ingrasys.mk
#include $(PLATFORM_PATH)/platform-modules-accton.mk
include $(PLATFORM_PATH)/platform-modules-accton.mk
include $(PLATFORM_PATH)/platform-modules-alphanetworks.mk
#include $(PLATFORM_PATH)/platform-modules-inventec.mk
include $(PLATFORM_PATH)/platform-modules-cel.mk

View File

@ -769,7 +769,7 @@ exit:
return ret;
}
static int as4630_54pe_cpld_remove(struct i2c_client *client)
static void as4630_54pe_cpld_remove(struct i2c_client *client)
{
struct as4630_54pe_cpld_data *data = i2c_get_clientdata(client);
const struct attribute_group *group = NULL;
@ -794,7 +794,6 @@ static int as4630_54pe_cpld_remove(struct i2c_client *client)
kfree(data);
return 0;
}
static int as4630_54pe_cpld_read_internal(struct i2c_client *client, u8 reg)

View File

@ -186,7 +186,7 @@ exit:
return status;
}
static int as4630_54pe_psu_remove(struct i2c_client *client)
static void as4630_54pe_psu_remove(struct i2c_client *client)
{
struct as4630_54pe_psu_data *data = i2c_get_clientdata(client);
@ -194,7 +194,6 @@ static int as4630_54pe_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as4630_54pe_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -772,7 +772,7 @@ exit:
return ret;
}
static int as4630_54te_cpld_remove(struct i2c_client *client)
static void as4630_54te_cpld_remove(struct i2c_client *client)
{
struct as4630_54te_cpld_data *data = i2c_get_clientdata(client);
const struct attribute_group *group = NULL;
@ -797,7 +797,6 @@ static int as4630_54te_cpld_remove(struct i2c_client *client)
kfree(data);
return 0;
}
static int as4630_54te_cpld_read_internal(struct i2c_client *client, u8 reg)

View File

@ -187,7 +187,7 @@ exit:
return status;
}
static int as4630_54te_psu_remove(struct i2c_client *client)
static void as4630_54te_psu_remove(struct i2c_client *client)
{
struct as4630_54te_psu_data *data = i2c_get_clientdata(client);
@ -195,7 +195,6 @@ static int as4630_54te_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as4630_54te_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -122,7 +122,7 @@ class FanUtil(object):
return None
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -153,7 +153,7 @@ class FanUtil(object):
val_file.write(content)
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -225,14 +225,3 @@ class FanUtil(object):
return True
#def main():
# fan = FanUtil()
#
# print 'get_size_node_map : %d' % fan.get_size_node_map()
# print 'get_size_path_map : %d' % fan.get_size_path_map()
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
# print fan.get_fan_to_device_path(x, y)
#
#if __name__ == '__main__':
# main()

View File

@ -80,7 +80,7 @@ class ThermalUtil(object):
return None
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -109,13 +109,3 @@ class ThermalUtil(object):
def get_thermal_2_val(self):
return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX)
#def main():
# thermal = ThermalUtil()
#
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
# print thermal.get_thermal_to_device_path(x)
#
#if __name__ == '__main__':
# main()

View File

@ -193,7 +193,7 @@ exit:
return status;
}
static int as5712_54x_psu_remove(struct i2c_client *client)
static void as5712_54x_psu_remove(struct i2c_client *client)
{
struct as5712_54x_psu_data *data = i2c_get_clientdata(client);
@ -201,7 +201,6 @@ static int as5712_54x_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as5712_54x_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -498,7 +498,7 @@ exit:
return status;
}
static int as5712_54x_sfp_remove(struct i2c_client *client)
static void as5712_54x_sfp_remove(struct i2c_client *client)
{
struct as5712_54x_sfp_data *data = i2c_get_clientdata(client);
@ -506,7 +506,6 @@ static int as5712_54x_sfp_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as5712_54x_sfp_group);
kfree(data);
return 0;
}
enum port_numbers {

View File

@ -1277,7 +1277,7 @@ add_mux_failed:
return ret;
}
static int as5712_54x_cpld_mux_remove(struct i2c_client *client)
static void as5712_54x_cpld_mux_remove(struct i2c_client *client)
{
struct i2c_mux_core *muxc = i2c_get_clientdata(client);
struct as5712_54x_cpld_data *data = i2c_mux_priv(muxc);
@ -1306,7 +1306,6 @@ static int as5712_54x_cpld_mux_remove(struct i2c_client *client)
i2c_mux_del_adapters(muxc);
return 0;
}
static int as5712_54x_cpld_read_internal(struct i2c_client *client, u8 reg)

View File

@ -135,7 +135,7 @@ class FanUtil(object):
return None
try:
val_file.close()
val_file.close()
except:
self.logger.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -166,7 +166,7 @@ class FanUtil(object):
val_file.write(content)
try:
val_file.close()
val_file.close()
except:
self.logger.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -230,14 +230,3 @@ class FanUtil(object):
return True
#def main():
# fan = FanUtil()
#
# print 'get_size_node_map : %d' % fan.get_size_node_map()
# print 'get_size_path_map : %d' % fan.get_size_path_map()
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
# print fan.get_fan_to_device_path(x, y)
#
#if __name__ == '__main__':
# main()

View File

@ -77,19 +77,21 @@ class ThermalUtil(object):
self.logger.error('GET. unable to open file: %s', str(e))
return None
content = val_file.readline().rstrip()
content = val_file.readline().rstrip()
if content == '':
self.logger.debug('GET. content is NULL. device_path:%s', device_path)
return None
if content == '':
self.logger.debug('GET. content is NULL. device_path:%s', device_path)
return None
try:
val_file.close()
except:
self.logger.debug('GET. unable to close file. device_path:%s', device_path)
return None
try:
val_file.close()
except:
self.logger.debug('GET. unable to close file. device_path:%s', device_path)
return None
return int(content)
return int(content)
return 0
def get_num_thermals(self):
@ -112,14 +114,3 @@ class ThermalUtil(object):
def get_thermal_2_val(self):
return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX)
#def main():
# thermal = ThermalUtil()
#
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
# print thermal.get_thermal_to_device_path(x)
#
#if __name__ == '__main__':
# main()

View File

@ -447,7 +447,7 @@ exit:
return status;
}
static int as5812_54t_cpld_remove(struct i2c_client *client)
static void as5812_54t_cpld_remove(struct i2c_client *client)
{
struct as5812_54t_cpld_data *data = i2c_get_clientdata(client);
@ -456,7 +456,6 @@ static int as5812_54t_cpld_remove(struct i2c_client *client)
kfree(data);
as5812_54t_cpld_remove_client(client);
return 0;
}
int as5812_54t_cpld_read(unsigned short cpld_addr, u8 reg)

View File

@ -191,7 +191,7 @@ exit:
return status;
}
static int as5812_54t_psu_remove(struct i2c_client *client)
static void as5812_54t_psu_remove(struct i2c_client *client)
{
struct as5812_54t_psu_data *data = i2c_get_clientdata(client);
@ -199,7 +199,6 @@ static int as5812_54t_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as5812_54t_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -135,7 +135,7 @@ class FanUtil(object):
return None
try:
val_file.close()
val_file.close()
except:
self.logger.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -166,7 +166,7 @@ class FanUtil(object):
val_file.write(content)
try:
val_file.close()
val_file.close()
except:
self.logger.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -230,14 +230,3 @@ class FanUtil(object):
return True
#def main():
# fan = FanUtil()
#
# print 'get_size_node_map : %d' % fan.get_size_node_map()
# print 'get_size_path_map : %d' % fan.get_size_path_map()
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
# print fan.get_fan_to_device_path(x, y)
#
#if __name__ == '__main__':
# main()

View File

@ -77,21 +77,23 @@ class ThermalUtil(object):
self.logger.error('GET. unable to open file: %s', str(e))
return None
content = val_file.readline().rstrip()
content = val_file.readline().rstrip()
if content == '':
self.logger.debug('GET. content is NULL. device_path:%s', device_path)
return None
if content == '':
self.logger.debug('GET. content is NULL. device_path:%s', device_path)
return None
try:
val_file.close()
except:
self.logger.debug('GET. unable to close file. device_path:%s', device_path)
return None
try:
val_file.close()
except:
self.logger.debug('GET. unable to close file. device_path:%s', device_path)
return None
return int(content)
return int(content)
return 0
def get_num_thermals(self):
return self.THERMAL_NUM_ON_MAIN_BROAD
@ -113,13 +115,3 @@ class ThermalUtil(object):
def get_thermal_2_val(self):
return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX)
#def main():
# thermal = ThermalUtil()
#
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
# print thermal.get_thermal_to_device_path(x)
#
#if __name__ == '__main__':
# main()

View File

@ -193,7 +193,7 @@ exit:
return status;
}
static int as5812_54x_psu_remove(struct i2c_client *client)
static void as5812_54x_psu_remove(struct i2c_client *client)
{
struct as5812_54x_psu_data *data = i2c_get_clientdata(client);
@ -201,7 +201,6 @@ static int as5812_54x_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as5812_54x_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -498,7 +498,7 @@ exit:
return status;
}
static int as5812_54x_sfp_remove(struct i2c_client *client)
static void as5812_54x_sfp_remove(struct i2c_client *client)
{
struct as5812_54x_sfp_data *data = i2c_get_clientdata(client);
@ -506,7 +506,6 @@ static int as5812_54x_sfp_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as5812_54x_sfp_group);
kfree(data);
return 0;
}
enum port_numbers {

View File

@ -267,7 +267,7 @@ exit:
return status;
}
static int cpr_4011_4mxx_remove(struct i2c_client *client)
static void cpr_4011_4mxx_remove(struct i2c_client *client)
{
struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client);
@ -275,7 +275,6 @@ static int cpr_4011_4mxx_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group);
kfree(data);
return 0;
}
static const struct i2c_device_id cpr_4011_4mxx_id[] = {

View File

@ -1277,7 +1277,7 @@ add_mux_failed:
return ret;
}
static int as5812_54x_cpld_mux_remove(struct i2c_client *client)
static void as5812_54x_cpld_mux_remove(struct i2c_client *client)
{
struct i2c_mux_core *muxc = i2c_get_clientdata(client);
struct as5812_54x_cpld_data *data = i2c_mux_priv(muxc);
@ -1306,7 +1306,6 @@ static int as5812_54x_cpld_mux_remove(struct i2c_client *client)
i2c_mux_del_adapters(muxc);
return 0;
}
static int as5812_54x_cpld_read_internal(struct i2c_client *client, u8 reg)

View File

@ -466,7 +466,7 @@ exit:
return status;
}
static int ym2651y_remove(struct i2c_client *client)
static void ym2651y_remove(struct i2c_client *client)
{
struct ym2651y_data *data = i2c_get_clientdata(client);
@ -474,7 +474,6 @@ static int ym2651y_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &ym2651y_group);
kfree(data);
return 0;
}
static const struct i2c_device_id ym2651y_id[] = {

View File

@ -104,7 +104,7 @@ class FanUtil(object):
return None
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -135,7 +135,7 @@ class FanUtil(object):
val_file.write(content)
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -174,14 +174,11 @@ class FanUtil(object):
def get_fan_fault(self, fan_num):
return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP)
#def get_fan_speed(self, fan_num):
# return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP)
def get_fan_dir(self, fan_num):
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
def get_fan_duty_cycle(self):
#duty_path = self.FAN_DUTY_PATH
try:
val_file = open(self.FAN_DUTY_PATH)
except IOError as e:
@ -203,9 +200,6 @@ class FanUtil(object):
fan_file.close()
return True
#def get_fanr_fault(self, fan_num):
# return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP)
def get_fanr_speed(self, fan_num):
return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP)
@ -218,20 +212,6 @@ class FanUtil(object):
logging.debug('GET. FAN fault. fan_num, %d', fan_num)
return False
#if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0:
# logging.debug('GET. FANR fault. fan_num, %d', fan_num)
# return False
return True
#def main():
# fan = FanUtil()
#
# print 'get_size_node_map : %d' % fan.get_size_node_map()
# print 'get_size_path_map : %d' % fan.get_size_path_map()
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
# print fan.get_fan_to_device_path(x, y)
#
#if __name__ == '__main__':
# main()

View File

@ -76,10 +76,11 @@ class ThermalUtil(object):
logging.debug('GET. content is NULL. device_path:%s', device_path)
return None
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
return None
return int(content)
else:
@ -113,17 +114,3 @@ class ThermalUtil(object):
def get_thermal_temp(self):
return (self._get_thermal_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_val(self.THERMAL_NUM_3_IDX))
def main():
thermal = ThermalUtil()
print("termal1=%d" %thermal._get_thermal_val(1))
print("termal2=%d" %thermal._get_thermal_val(2))
print("termal3=%d" %thermal._get_thermal_val(3))
print("termal4=%d" %thermal._get_thermal_val(4))
#
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
# print thermal.get_thermal_to_device_path(x)
#
if __name__ == '__main__':
main()

View File

@ -462,7 +462,7 @@ exit:
return ret;
}
static int as5835_54t_cpld_remove(struct i2c_client *client)
static void as5835_54t_cpld_remove(struct i2c_client *client)
{
struct as5835_54t_cpld_data *data = i2c_get_clientdata(client);
const struct attribute_group *group = NULL;
@ -490,7 +490,6 @@ static int as5835_54t_cpld_remove(struct i2c_client *client)
kfree(data);
return 0;
}
static int as5835_54t_cpld_read_internal(struct i2c_client *client, u8 reg)

View File

@ -447,13 +447,12 @@ exit:
return status;
}
static int as5835_54t_fan_remove(struct i2c_client *client)
static void as5835_54t_fan_remove(struct i2c_client *client)
{
struct as5835_54t_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as5835_54t_fan_group);
return 0;
}
/* Addresses to scan */

View File

@ -189,7 +189,7 @@ exit:
return status;
}
static int as5835_54t_psu_remove(struct i2c_client *client)
static void as5835_54t_psu_remove(struct i2c_client *client)
{
struct as5835_54t_psu_data *data = i2c_get_clientdata(client);
@ -197,7 +197,6 @@ static int as5835_54t_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as5835_54t_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -174,14 +174,10 @@ class FanUtil(object):
def get_fan_fault(self, fan_num):
return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP)
#def get_fan_speed(self, fan_num):
# return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP)
def get_fan_dir(self, fan_num):
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
def get_fan_duty_cycle(self):
#duty_path = self.FAN_DUTY_PATH
try:
val_file = open(self.FAN_DUTY_PATH)
except IOError as e:
@ -203,8 +199,6 @@ class FanUtil(object):
fan_file.close()
return True
#def get_fanr_fault(self, fan_num):
# return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP)
def get_fanr_speed(self, fan_num):
return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP)
@ -218,9 +212,5 @@ class FanUtil(object):
logging.debug('GET. FAN fault. fan_num, %d', fan_num)
return False
#if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0:
# logging.debug('GET. FANR fault. fan_num, %d', fan_num)
# return False
return True

View File

@ -1055,7 +1055,7 @@ exit:
return ret;
}
static int as5835_54x_cpld_remove(struct i2c_client *client)
static void as5835_54x_cpld_remove(struct i2c_client *client)
{
struct as5835_54x_cpld_data *data = i2c_get_clientdata(client);
const struct attribute_group *group = NULL;
@ -1083,7 +1083,6 @@ static int as5835_54x_cpld_remove(struct i2c_client *client)
kfree(data);
return 0;
}
static int as5835_54x_cpld_read_internal(struct i2c_client *client, u8 reg)

View File

@ -447,13 +447,12 @@ exit:
return status;
}
static int as5835_54x_fan_remove(struct i2c_client *client)
static void as5835_54x_fan_remove(struct i2c_client *client)
{
struct as5835_54x_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as5835_54x_fan_group);
return 0;
}
/* Addresses to scan */

View File

@ -189,7 +189,7 @@ exit:
return status;
}
static int as5835_54x_psu_remove(struct i2c_client *client)
static void as5835_54x_psu_remove(struct i2c_client *client)
{
struct as5835_54x_psu_data *data = i2c_get_clientdata(client);
@ -197,7 +197,6 @@ static int as5835_54x_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as5835_54x_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -43,13 +43,8 @@ class FanUtil(object):
FAN_NODE_NUM_OF_MAP = 2
FAN_NODE_FAULT_IDX_OF_MAP = 1
#FAN_NODE_SPEED_IDX_OF_MAP = 2
FAN_NODE_DIR_IDX_OF_MAP = 2
#FAN_NODE_DUTY_IDX_OF_MAP = 4
#FANR_NODE_FAULT_IDX_OF_MAP = 5
#BASE_VAL_PATH = '/sys/bus/i2c/devices/11-0066/{0}'
#FAN_DUTY_PATH = '/sys/bus/i2c/devices/11-0066/fan_duty_cycle_percentage'
BASE_VAL_PATH = '/sys/devices/platform/as6712_32x_fan/{0}'
FAN_DUTY_PATH = '/sys/devices/platform/as6712_32x_fan/fan1_duty_cycle_percentage'
@ -66,7 +61,7 @@ class FanUtil(object):
#fan1_fault
#fan1_present
#(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage',
_fan_to_device_node_mapping = {
(FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault',
(FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction',
@ -112,7 +107,7 @@ class FanUtil(object):
return None
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -143,7 +138,7 @@ class FanUtil(object):
val_file.write(content)
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -182,14 +177,11 @@ class FanUtil(object):
def get_fan_fault(self, fan_num):
return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP)
#def get_fan_speed(self, fan_num):
# return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP)
def get_fan_dir(self, fan_num):
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
def get_fan_duty_cycle(self):
#duty_path = self.FAN_DUTY_PATH
try:
val_file = open(self.FAN_DUTY_PATH)
except IOError as e:
@ -200,13 +192,7 @@ class FanUtil(object):
val_file.close()
return int(content)
#self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP)
#static u32 reg_val_to_duty_cycle(u8 reg_val)
#{
# reg_val &= FAN_DUTY_CYCLE_REG_MASK;
# return ((u32)(reg_val+1) * 625 + 75)/ 100;
#}
#
def set_fan_duty_cycle(self, val):
try:
@ -214,13 +200,11 @@ class FanUtil(object):
except IOError as e:
print("Error: unable to open file: %s" % str(e))
return False
#val = ((val + 1 ) * 625 +75 ) / 100
fan_file.write(str(val))
fan_file.close()
return True
#def get_fanr_fault(self, fan_num):
# return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP)
def get_fanr_speed(self, fan_num):
return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP)
@ -234,20 +218,5 @@ class FanUtil(object):
logging.debug('GET. FAN fault. fan_num, %d', fan_num)
return False
#if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0:
# logging.debug('GET. FANR fault. fan_num, %d', fan_num)
# return False
return True
#def main():
# fan = FanUtil()
#
# print 'get_size_node_map : %d' % fan.get_size_node_map()
# print 'get_size_path_map : %d' % fan.get_size_path_map()
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
# print fan.get_fan_to_device_path(x, y)
#
#if __name__ == '__main__':
# main()

View File

@ -74,19 +74,21 @@ class ThermalUtil(object):
logging.error('GET. unable to open file: %s', str(e))
return None
content = val_file.readline().rstrip()
content = val_file.readline().rstrip()
if content == '':
logging.debug('GET. content is NULL. device_path:%s', device_path)
return None
if content == '':
logging.debug('GET. content is NULL. device_path:%s', device_path)
return None
try:
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
try:
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
return int(content)
return int(content)
return 0
def get_num_thermals(self):
@ -112,13 +114,3 @@ class ThermalUtil(object):
def get_thermal_temp(self):
return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX))
#def main():
# thermal = ThermalUtil()
#
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
# print thermal.get_thermal_to_device_path(x)
#
#if __name__ == '__main__':
# main()

View File

@ -721,7 +721,7 @@ exit_mux_register:
return ret;
}
static int as6712_32x_cpld_mux_remove(struct i2c_client *client)
static void as6712_32x_cpld_mux_remove(struct i2c_client *client)
{
struct i2c_mux_core *muxc = i2c_get_clientdata(client);
struct as6712_32x_cpld_data *data = i2c_mux_priv(muxc);
@ -750,7 +750,6 @@ static int as6712_32x_cpld_mux_remove(struct i2c_client *client)
i2c_mux_del_adapters(muxc);
return 0;
}
static int as6712_32x_cpld_read_internal(struct i2c_client *client, u8 reg)

View File

@ -188,7 +188,7 @@ exit:
return status;
}
static int as6712_32x_psu_remove(struct i2c_client *client)
static void as6712_32x_psu_remove(struct i2c_client *client)
{
struct as6712_32x_psu_data *data = i2c_get_clientdata(client);
@ -196,7 +196,6 @@ static int as6712_32x_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as6712_32x_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -300,7 +300,7 @@ exit:
return status;
}
static int cpr_4011_4mxx_remove(struct i2c_client *client)
static void cpr_4011_4mxx_remove(struct i2c_client *client)
{
struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client);
@ -308,7 +308,6 @@ static int cpr_4011_4mxx_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group);
kfree(data);
return 0;
}
static const struct i2c_device_id cpr_4011_4mxx_id[] = {

View File

@ -498,13 +498,12 @@ exit:
return status;
}
static int as7312_54x_fan_remove(struct i2c_client *client)
static void as7312_54x_fan_remove(struct i2c_client *client)
{
struct as7312_54x_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as7312_54x_fan_group);
return 0;
}
/* Addresses to scan */

View File

@ -155,7 +155,7 @@ exit:
return status;
}
static int as7312_54x_psu_remove(struct i2c_client *client)
static void as7312_54x_psu_remove(struct i2c_client *client)
{
struct as7312_54x_psu_data *data = i2c_get_clientdata(client);
@ -163,7 +163,6 @@ static int as7312_54x_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7312_54x_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -1919,7 +1919,7 @@ static int qfp_remove(struct i2c_client *client, struct qsfp_data *data)
return 0;
}
static int sfp_device_remove(struct i2c_client *client)
static void sfp_device_remove(struct i2c_client *client)
{
int ret = 0;
struct sfp_port_data *data = i2c_get_clientdata(client);
@ -1936,7 +1936,6 @@ static int sfp_device_remove(struct i2c_client *client)
kfree(data->writebuf);
#endif
kfree(data);
return ret;
}
/* Addresses scanned

View File

@ -1074,7 +1074,7 @@ exit:
return ret;
}
static int as7312_54x_cpld_remove(struct i2c_client *client)
static void as7312_54x_cpld_remove(struct i2c_client *client)
{
struct as7312_54x_cpld_data *data = i2c_get_clientdata(client);
const struct attribute_group *group = NULL;
@ -1102,7 +1102,6 @@ static int as7312_54x_cpld_remove(struct i2c_client *client)
kfree(data);
return 0;
}
static int as7312_54x_cpld_read_internal(struct i2c_client *client, u8 reg)

View File

@ -44,12 +44,8 @@ class FanUtil(object):
FAN_NODE_NUM_OF_MAP = 2
FAN_NODE_FAULT_IDX_OF_MAP = 1
#FAN_NODE_SPEED_IDX_OF_MAP = 2
FAN_NODE_DIR_IDX_OF_MAP = 2
#FAN_NODE_DUTY_IDX_OF_MAP = 4
#FANR_NODE_FAULT_IDX_OF_MAP = 5
#BASE_VAL_PATH = '/sys/devices/platform/as5712_54x_fan/{0}'
BASE_VAL_PATH = '/sys/bus/i2c/devices/2-0066/{0}'
FAN_DUTY_PATH = '/sys/bus/i2c/devices/2-0066/fan_duty_cycle_percentage'
@ -68,7 +64,7 @@ class FanUtil(object):
#fan1_fault
#fan1_present
#(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage',
_fan_to_device_node_mapping = {
(FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault',
(FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction',
@ -189,14 +185,10 @@ class FanUtil(object):
def get_fan_fault(self, fan_num):
return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP)
#def get_fan_speed(self, fan_num):
# return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP)
def get_fan_dir(self, fan_num):
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
def get_fan_duty_cycle(self):
#duty_path = self.FAN_DUTY_PATH
try:
val_file = open(self.FAN_DUTY_PATH)
except IOError as e:
@ -207,13 +199,7 @@ class FanUtil(object):
val_file.close()
return int(content)
#self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP)
#static u32 reg_val_to_duty_cycle(u8 reg_val)
#{
# reg_val &= FAN_DUTY_CYCLE_REG_MASK;
# return ((u32)(reg_val+1) * 625 + 75)/ 100;
#}
#
def set_fan_duty_cycle(self, val):
try:
@ -221,13 +207,11 @@ class FanUtil(object):
except IOError as e:
print("Error: unable to open file: %s" % str(e))
return False
#val = ((val + 1 ) * 625 +75 ) / 100
fan_file.write(str(val))
fan_file.close()
return True
#def get_fanr_fault(self, fan_num):
# return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP)
def get_fanr_speed(self, fan_num):
return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP)
@ -243,14 +227,3 @@ class FanUtil(object):
return True
#def main():
# fan = FanUtil()
#
# print 'get_size_node_map : %d' % fan.get_size_node_map()
# print 'get_size_path_map : %d' % fan.get_size_path_map()
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
# print fan.get_fan_to_device_path(x, y)
#
#if __name__ == '__main__':
# main()

View File

@ -78,20 +78,21 @@ class ThermalUtil(object):
self.logger.error('GET. unable to open file: %s', str(e))
return None
content = val_file.readline().rstrip()
content = val_file.readline().rstrip()
if content == '':
self.logger.debug('GET. content is NULL. device_path:%s', device_path)
if content == '':
self.logger.debug('GET. content is NULL. device_path:%s', device_path)
return None
try:
val_file.close()
except:
self.logger.debug('GET. unable to close file. device_path:%s', device_path)
return None
try:
val_file.close()
except:
self.logger.debug('GET. unable to close file. device_path:%s', device_path)
return None
return int(content)
return int(content)
return 0
def get_num_thermals(self):
return self.THERMAL_NUM_ON_MAIN_BROAD
@ -116,13 +117,3 @@ class ThermalUtil(object):
def get_thermal_temp(self):
return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX))
#def main():
# thermal = ThermalUtil()
#
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
# print thermal.get_thermal_to_device_path(x)
#
#if __name__ == '__main__':
# main()

View File

@ -496,13 +496,12 @@ exit:
return status;
}
static int as7312_54x_fan_remove(struct i2c_client *client)
static void as7312_54x_fan_remove(struct i2c_client *client)
{
struct as7312_54x_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as7312_54x_fan_group);
return 0;
}
/* Addresses to scan */

View File

@ -155,7 +155,7 @@ exit:
return status;
}
static int as7312_54x_psu_remove(struct i2c_client *client)
static void as7312_54x_psu_remove(struct i2c_client *client)
{
struct as7312_54x_psu_data *data = i2c_get_clientdata(client);
@ -163,7 +163,6 @@ static int as7312_54x_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7312_54x_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -1919,7 +1919,7 @@ static int qfp_remove(struct i2c_client *client, struct qsfp_data *data)
return 0;
}
static int sfp_device_remove(struct i2c_client *client)
static void sfp_device_remove(struct i2c_client *client)
{
int ret = 0;
struct sfp_port_data *data = i2c_get_clientdata(client);
@ -1936,7 +1936,6 @@ static int sfp_device_remove(struct i2c_client *client)
kfree(data->writebuf);
#endif
kfree(data);
return ret;
}
/* Addresses scanned

View File

@ -1074,7 +1074,7 @@ exit:
return ret;
}
static int as7312_54x_cpld_remove(struct i2c_client *client)
static void as7312_54x_cpld_remove(struct i2c_client *client)
{
struct as7312_54x_cpld_data *data = i2c_get_clientdata(client);
const struct attribute_group *group = NULL;
@ -1102,7 +1102,6 @@ static int as7312_54x_cpld_remove(struct i2c_client *client)
kfree(data);
return 0;
}
static int as7312_54x_cpld_read_internal(struct i2c_client *client, u8 reg)

View File

@ -630,14 +630,13 @@ out_kfree:
}
static int fan_remove(struct i2c_client *client)
static void fan_remove(struct i2c_client *client)
{
struct fan_data_t *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &data->group);
kfree(data->group.attrs);
return 0;
}

View File

@ -914,7 +914,7 @@ out_kfree:
}
static int as7315_i2c_cpld_remove(struct i2c_client *client)
static void as7315_i2c_cpld_remove(struct i2c_client *client)
{
struct cpld_data *data = i2c_get_clientdata(client);
struct i2c_mux_core *muxc = data->muxc;
@ -925,7 +925,6 @@ static int as7315_i2c_cpld_remove(struct i2c_client *client)
i2c_mux_del_adapters(muxc);
}
accton_i2c_cpld_remove_client(client);
return 0;
}
int accton_i2c_cpld_read(u8 cpld_addr, u8 reg)

View File

@ -263,7 +263,7 @@ exit:
return status;
}
static int as7315_27xb_psu_remove(struct i2c_client *client)
static void as7315_27xb_psu_remove(struct i2c_client *client)
{
struct as7315_27xb_psu_data *data = i2c_get_clientdata(client);
@ -271,7 +271,6 @@ static int as7315_27xb_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7315_27xb_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -497,13 +497,12 @@ exit:
return status;
}
static int as7326_56x_fan_remove(struct i2c_client *client)
static void as7326_56x_fan_remove(struct i2c_client *client)
{
struct as7326_56x_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as7326_56x_fan_group);
return 0;
}
/* Addresses to scan */

View File

@ -155,7 +155,7 @@ exit:
return status;
}
static int as7326_56x_psu_remove(struct i2c_client *client)
static void as7326_56x_psu_remove(struct i2c_client *client)
{
struct as7326_56x_psu_data *data = i2c_get_clientdata(client);
@ -163,7 +163,6 @@ static int as7326_56x_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7326_56x_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -1031,7 +1031,7 @@ exit:
return ret;
}
static int as7326_56x_cpld_remove(struct i2c_client *client)
static void as7326_56x_cpld_remove(struct i2c_client *client)
{
struct as7326_56x_cpld_data *data = i2c_get_clientdata(client);
const struct attribute_group *group = NULL;
@ -1059,7 +1059,6 @@ static int as7326_56x_cpld_remove(struct i2c_client *client)
kfree(data);
return 0;
}
static int as7326_56x_cpld_read_internal(struct i2c_client *client, u8 reg)

View File

@ -586,13 +586,12 @@ exit:
return status;
}
static int as7712_32x_fan_remove(struct i2c_client *client)
static void as7712_32x_fan_remove(struct i2c_client *client)
{
struct as7712_32x_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as7712_32x_fan_group);
return 0;
}
/* Addresses to scan */

View File

@ -155,7 +155,7 @@ exit:
return status;
}
static int as7712_32x_psu_remove(struct i2c_client *client)
static void as7712_32x_psu_remove(struct i2c_client *client)
{
struct as7712_32x_psu_data *data = i2c_get_clientdata(client);
@ -163,7 +163,6 @@ static int as7712_32x_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7712_32x_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -1126,20 +1126,19 @@ static int qfp_remove(struct i2c_client *client, struct qsfp_data *data)
return 0;
}
static int sfp_device_remove(struct i2c_client *client)
static void sfp_device_remove(struct i2c_client *client)
{
struct sfp_port_data *data = i2c_get_clientdata(client);
switch (data->driver_type) {
case DRIVER_TYPE_SFP_MSA:
return sfp_msa_remove(client, data->msa);
sfp_msa_remove(client, data->msa);
case DRIVER_TYPE_SFP_DDM:
return sfp_ddm_remove(client, data->ddm);
sfp_ddm_remove(client, data->ddm);
case DRIVER_TYPE_QSFP:
return qfp_remove(client, data->qsfp);
qfp_remove(client, data->qsfp);
}
return 0;
}
static struct i2c_driver sfp_driver = {

View File

@ -43,12 +43,8 @@ class FanUtil(object):
FAN_NODE_NUM_OF_MAP = 2
FAN_NODE_FAULT_IDX_OF_MAP = 1
#FAN_NODE_SPEED_IDX_OF_MAP = 2
FAN_NODE_DIR_IDX_OF_MAP = 2
#FAN_NODE_DUTY_IDX_OF_MAP = 4
#FANR_NODE_FAULT_IDX_OF_MAP = 5
#BASE_VAL_PATH = '/sys/devices/platform/as5712_54x_fan/{0}'
BASE_VAL_PATH = '/sys/bus/i2c/devices/9-0066/{0}'
FAN_DUTY_PATH = '/sys/bus/i2c/devices/9-0066/fan_duty_cycle_percentage'
@ -65,7 +61,7 @@ class FanUtil(object):
#fan1_fault
#fan1_present
#(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage',
_fan_to_device_node_mapping = {
(FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault',
(FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction',
@ -113,7 +109,7 @@ class FanUtil(object):
return None
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -144,7 +140,7 @@ class FanUtil(object):
val_file.write(content)
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -183,14 +179,11 @@ class FanUtil(object):
def get_fan_fault(self, fan_num):
return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP)
#def get_fan_speed(self, fan_num):
# return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP)
def get_fan_dir(self, fan_num):
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
def get_fan_duty_cycle(self):
#duty_path = self.FAN_DUTY_PATH
try:
val_file = open(self.FAN_DUTY_PATH)
except IOError as e:
@ -201,13 +194,7 @@ class FanUtil(object):
val_file.close()
return int(content)
#self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP)
#static u32 reg_val_to_duty_cycle(u8 reg_val)
#{
# reg_val &= FAN_DUTY_CYCLE_REG_MASK;
# return ((u32)(reg_val+1) * 625 + 75)/ 100;
#}
#
def set_fan_duty_cycle(self, val):
try:
@ -215,14 +202,11 @@ class FanUtil(object):
except IOError as e:
print("Error: unable to open file: %s" % str(e))
return False
#val = ((val + 1 ) * 625 +75 ) / 100
fan_file.write(str(val))
fan_file.close()
return True
#def get_fanr_fault(self, fan_num):
# return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP)
def get_fanr_speed(self, fan_num):
return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP)
@ -235,20 +219,6 @@ class FanUtil(object):
logging.debug('GET. FAN fault. fan_num, %d', fan_num)
return False
#if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0:
# logging.debug('GET. FANR fault. fan_num, %d', fan_num)
# return False
return True
#def main():
# fan = FanUtil()
#
# print 'get_size_node_map : %d' % fan.get_size_node_map()
# print 'get_size_path_map : %d' % fan.get_size_path_map()
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
# print fan.get_fan_to_device_path(x, y)
#
#if __name__ == '__main__':
# main()

View File

@ -73,20 +73,21 @@ class ThermalUtil(object):
logging.error('GET. unable to open file: %s', str(e))
return None
content = val_file.readline().rstrip()
content = val_file.readline().rstrip()
if content == '':
logging.debug('GET. content is NULL. device_path:%s', device_path)
return None
if content == '':
logging.debug('GET. content is NULL. device_path:%s', device_path)
return None
try:
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
try:
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
return int(content)
return int(content)
return 0
def get_num_thermals(self):
return self.THERMAL_NUM_ON_MAIN_BROAD
@ -110,14 +111,3 @@ class ThermalUtil(object):
return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX)
def get_thermal_temp(self):
return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX))
#def main():
# thermal = ThermalUtil()
#
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
# print thermal.get_thermal_to_device_path(x)
#
#if __name__ == '__main__':
# main()

View File

@ -571,7 +571,7 @@ exit:
return status;
}
static int as7716_32x_cpld_remove(struct i2c_client *client)
static void as7716_32x_cpld_remove(struct i2c_client *client)
{
struct as7716_32x_cpld_data *data = i2c_get_clientdata(client);
@ -580,7 +580,6 @@ static int as7716_32x_cpld_remove(struct i2c_client *client)
kfree(data);
as7716_32x_cpld_remove_client(client);
return 0;
}
int as7716_32x_cpld_read(unsigned short cpld_addr, u8 reg)

View File

@ -487,13 +487,12 @@ exit:
return status;
}
static int as7716_32x_fan_remove(struct i2c_client *client)
static void as7716_32x_fan_remove(struct i2c_client *client)
{
struct as7716_32x_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as7716_32x_fan_group);
return 0;
}
/* Addresses to scan */

View File

@ -181,7 +181,7 @@ exit:
return status;
}
static int as7716_32x_psu_remove(struct i2c_client *client)
static void as7716_32x_psu_remove(struct i2c_client *client)
{
struct as7716_32x_psu_data *data = i2c_get_clientdata(client);
@ -189,7 +189,6 @@ static int as7716_32x_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7716_32x_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -216,7 +216,7 @@ exit:
return status;
}
static int as7716_32x_sfp_remove(struct i2c_client *client)
static void as7716_32x_sfp_remove(struct i2c_client *client)
{
struct as7716_32x_sfp_data *data = i2c_get_clientdata(client);
@ -224,7 +224,6 @@ static int as7716_32x_sfp_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7716_32x_sfp_group);
kfree(data);
return 0;
}
enum port_numbers {

View File

@ -151,12 +151,11 @@ exit:
return status;
}
static int accton_i2c_cpld_remove(struct i2c_client *client)
static void accton_i2c_cpld_remove(struct i2c_client *client)
{
sysfs_remove_group(&client->dev.kobj, &as5712_54x_cpld_group);
accton_i2c_cpld_remove_client(client);
return 0;
}
static const struct i2c_device_id accton_i2c_cpld_id[] = {

View File

@ -267,7 +267,7 @@ exit:
return status;
}
static int cpr_4011_4mxx_remove(struct i2c_client *client)
static void cpr_4011_4mxx_remove(struct i2c_client *client)
{
struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client);
@ -275,7 +275,6 @@ static int cpr_4011_4mxx_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group);
kfree(data);
return 0;
}
static const struct i2c_device_id cpr_4011_4mxx_id[] = {

View File

@ -413,7 +413,7 @@ exit:
return status;
}
static int ym2651y_remove(struct i2c_client *client)
static void ym2651y_remove(struct i2c_client *client)
{
struct ym2651y_data *data = i2c_get_clientdata(client);
@ -421,7 +421,6 @@ static int ym2651y_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &ym2651y_group);
kfree(data);
return 0;
}
static const struct i2c_device_id ym2651y_id[] = {

View File

@ -43,12 +43,8 @@ class FanUtil(object):
FAN_NODE_NUM_OF_MAP = 2
FAN_NODE_FAULT_IDX_OF_MAP = 1
#FAN_NODE_SPEED_IDX_OF_MAP = 2
FAN_NODE_DIR_IDX_OF_MAP = 2
#FAN_NODE_DUTY_IDX_OF_MAP = 4
#FANR_NODE_FAULT_IDX_OF_MAP = 5
#BASE_VAL_PATH = '/sys/devices/platform/as5712_54x_fan/{0}'
BASE_VAL_PATH = '/sys/bus/i2c/devices/9-0066/{0}'
FAN_DUTY_PATH = '/sys/bus/i2c/devices/9-0066/fan_duty_cycle_percentage'
@ -65,7 +61,7 @@ class FanUtil(object):
#fan1_fault
#fan1_present
#(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage',
_fan_to_device_node_mapping = {
(FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault',
(FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction',
@ -107,17 +103,13 @@ class FanUtil(object):
return None
content = val_file.readline().rstrip()
#print "fan_num=%d" %fan_num
#print "node_num=%d" %node_num
#print "device_path=%s" %device_path
#print "content=%s" %content
if content == '':
logging.debug('GET. content is NULL. device_path:%s', device_path)
return None
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -148,7 +140,7 @@ class FanUtil(object):
val_file.write(content)
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -162,10 +154,6 @@ class FanUtil(object):
for node_num in range(self.FAN_NODE_FAULT_IDX_OF_MAP, self.FAN_NODE_NUM_OF_MAP+1):
self._fan_to_device_path_mapping[(fan_num, node_num)] = fan_path.format(
self._fan_to_device_node_mapping[(fan_num, node_num)])
#self._fan_to_device_path_mapping[(fan_num, node_num)] = fan_path + self._fan_to_device_node_mapping[(fan_num, node_num)])
#print "fan_num=%d" %fan_num
#print "node_num=%d" %node_num
#print "self._fan_to_device_path_mapping[(fan_num, node_num)]=%s" %self._fan_to_device_path_mapping[(fan_num, node_num)]
def get_num_fans(self):
return self.FAN_NUM_ON_MAIN_BROAD
@ -191,14 +179,11 @@ class FanUtil(object):
def get_fan_fault(self, fan_num):
return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP)
#def get_fan_speed(self, fan_num):
# return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP)
def get_fan_dir(self, fan_num):
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
def get_fan_duty_cycle(self):
#duty_path = self.FAN_DUTY_PATH
try:
val_file = open(self.FAN_DUTY_PATH)
except IOError as e:
@ -209,13 +194,7 @@ class FanUtil(object):
val_file.close()
return int(content)
#self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP)
#static u32 reg_val_to_duty_cycle(u8 reg_val)
#{
# reg_val &= FAN_DUTY_CYCLE_REG_MASK;
# return ((u32)(reg_val+1) * 625 + 75)/ 100;
#}
#
def set_fan_duty_cycle(self, val):
try:
@ -223,13 +202,11 @@ class FanUtil(object):
except IOError as e:
print("Error: unable to open file: %s" % str(e))
return False
#val = ((val + 1 ) * 625 +75 ) / 100
fan_file.write(str(val))
fan_file.close()
return True
#def get_fanr_fault(self, fan_num):
# return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP)
def get_fanr_speed(self, fan_num):
return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP)
@ -237,27 +214,12 @@ class FanUtil(object):
def get_fan_status(self, fan_num):
if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD:
logging.debug('GET. Parameter error. fan_num, %d', fan_num)
print("fan %d return none" %fan_num)
return None
if self.get_fan_fault(fan_num) is not None and self.get_fan_fault(fan_num) > 0:
logging.debug('GET. FAN fault. fan_num, %d', fan_num)
return False
#if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0:
# logging.debug('GET. FANR fault. fan_num, %d', fan_num)
# return False
return True
#def main():
# fan = FanUtil()
#
# print 'get_size_node_map : %d' % fan.get_size_node_map()
# print 'get_size_path_map : %d' % fan.get_size_path_map()
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
# print fan.get_fan_to_device_path(x, y)
#
#if __name__ == '__main__':
# main()

View File

@ -59,7 +59,6 @@ class ThermalUtil(object):
self._thermal_to_device_path_mapping[x] = thermal_path.format(
self._thermal_to_device_node_mapping[x][0],
self._thermal_to_device_node_mapping[x][1])
#print "self._thermal_to_device_path_mapping[x]=%s" %self._thermal_to_device_path_mapping[x]
def _get_thermal_node_val(self, thermal_num):
if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_ON_MAIN_BROAD:
@ -74,20 +73,21 @@ class ThermalUtil(object):
logging.error('GET. unable to open file: %s', str(e))
return None
content = val_file.readline().rstrip()
content = val_file.readline().rstrip()
if content == '':
logging.debug('GET. content is NULL. device_path:%s', device_path)
return None
if content == '':
logging.debug('GET. content is NULL. device_path:%s', device_path)
return None
try:
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
try:
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
return int(content)
return int(content)
return 0
def get_num_thermals(self):
return self.THERMAL_NUM_ON_MAIN_BROAD
@ -112,13 +112,3 @@ class ThermalUtil(object):
def get_thermal_temp(self):
return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX))
#def main():
# thermal = ThermalUtil()
#
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
# print thermal.get_thermal_to_device_path(x)
#
#if __name__ == '__main__':
# main()

View File

@ -505,8 +505,6 @@ static ssize_t sfp_value_store(struct device *dev, struct device_attribute *da,
int index;
long keyin = 0;
//printk("sfp_value_store\n");
//printk("attr->index=%d\n", attr->index);
mutex_lock(&data->update_lock);
switch (attr->index)
{
@ -550,8 +548,6 @@ static ssize_t sfp_value_show(struct device *dev, struct device_attribute *da,
int index;
int status = -EINVAL;
//printk("sfp_value_show, attr->index=%d\n", attr->index);
//printk("TRANSCEIVER_PRESENT_ATTR_ID(1)=%d, TRANSCEIVER_RESET_ATTR_ID(1)=%d\n", TRANSCEIVER_PRESENT_ATTR_ID(1), TRANSCEIVER_RESET_ATTR_ID(1));
mutex_lock(&data->update_lock);
switch (attr->index)
{
@ -569,7 +565,6 @@ static ssize_t sfp_value_show(struct device *dev, struct device_attribute *da,
case MODULE_RESET_17 ... MODULE_RESET_24:
case MODULE_RESET_25 ... MODULE_RESET_32:
index=sfp_array_index_get(attr->index);
//printk("rst:attr->index=%d, index=%d\n",attr->index, index);
if(index < 0 || index > PORT_NUM_MAX -1)
break;
status = sprintf(buf, "%u\n", data->reset[index]);
@ -809,7 +804,7 @@ exit:
return status;
}
static int as7716_32xb_cpld_remove(struct i2c_client *client)
static void as7716_32xb_cpld_remove(struct i2c_client *client)
{
struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client);
@ -818,7 +813,6 @@ static int as7716_32xb_cpld_remove(struct i2c_client *client)
kfree(data);
as7716_32xb_cpld_remove_client(client);
return 0;
}
int as7716_32xb_cpld_read(unsigned short cpld_addr, u8 reg)
@ -930,7 +924,6 @@ static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da,
if (error) {
return error;
}
//printk("set_mode_reset:attr->index=%d\n",attr->index);
switch (attr->index) {
case MODULE_RESET_1 ... MODULE_RESET_8:
reg = 0x04;
@ -957,17 +950,14 @@ static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da,
if (unlikely(status < 0)) {
goto exit;
}
//printk("set_mode_reset:reset=%d, reg=0x%x, mask=0x%x, ori_val=0x%x\n", reset, reg, mask, status);
/* Update lp_mode status */
if (reset)
{
val = status&(~mask);
//printk("1:new val=0x%x\n", val);
}
else
{
val =status | (mask);
//printk("0:new val=0x%x\n", val);
}
status = as7716_32xb_cpld_write_internal(client, reg, val);

View File

@ -403,8 +403,6 @@ static ssize_t fan_value_store(struct device *dev, struct device_attribute *da,
int status = -EINVAL;
int index;
long keyin = 0;
//printk("fan_value_store\n");
//printk("attr->index=%d\n", attr->index);
mutex_lock(&data->update_lock);
switch (attr->index)
{
@ -505,8 +503,6 @@ static ssize_t fan_value_show(struct device *dev, struct device_attribute *da,
struct as7716_32xb_fan_data *data = i2c_get_clientdata(client);
int status = -EINVAL;
int index=0;
//printk("ffan_value_show\n");
//printk("attr->index=%d\n", attr->index);
mutex_lock(&data->update_lock);
switch (attr->index)
{
@ -662,13 +658,12 @@ exit:
return status;
}
static int as7716_32xb_fan_remove(struct i2c_client *client)
static void as7716_32xb_fan_remove(struct i2c_client *client)
{
struct as7716_32xb_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as7716_32xb_fan_group);
return 0;
}
/* Addresses to scan */

View File

@ -69,12 +69,6 @@ static ssize_t oom_info_show(struct device *dev, struct device_attribute *da,
mutex_lock(&data->lock);
memcpy(buf, data->eeprom, EEPROM_DATA_SIZE);
//for(i=0; i < EEPROM_DATA_SIZE ; i++)
//{
// buf[i]=data->eeprom[i];
// printk("buf[%d]=0x%x ",i, buf[i]);
//}
//status = EEPROM_DATA_SIZE+1;
memcpy(buf, data->eeprom, 256);
@ -92,7 +86,6 @@ static ssize_t oom_info_store(struct device *dev, struct device_attribute *da,
unsigned char str[3];
unsigned int val;
// printk("strlen(buf)=%d\n",strlen(buf));
k=0;
mutex_lock(&data->lock);
memset(data->eeprom, 0xFF, EEPROM_DATA_SIZE);
@ -101,31 +94,20 @@ static ssize_t oom_info_store(struct device *dev, struct device_attribute *da,
{
for(i=0; i < strlen(buf) ; i++)
{
// printk("i=%d ", i);
for(j=0;j<2; j++)
{
str[j]=buf[i+j];
}
sscanf(str, "%x", &val);
//printk("str=%s val=0x%x ", str, val);
i=j+i-1;
if(k>=EEPROM_DATA_SIZE)
{
break;
}
data->eeprom[k]=(unsigned char)val;
//printk("data->eeprom[%d]=0x%x\n",k, data->eeprom[k]);
k++;
}
}
//printk("buf=\n");
//for(i=0; i < strlen(buf) ; i++)
//{
// printk("%c%c ", buf[i], buf[i+1]);
// if((i % 31)==0)
// printk("\n");
//}
//printk("\n");
mutex_unlock(&data->lock);
@ -215,7 +197,7 @@ exit:
return status;
}
static int as7716_32xb_oom_remove(struct i2c_client *client)
static void as7716_32xb_oom_remove(struct i2c_client *client)
{
struct as7716_32xb_oom_data *data = i2c_get_clientdata(client);
@ -223,7 +205,6 @@ static int as7716_32xb_oom_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7716_32xb_oom_group);
kfree(data);
return 0;
}

View File

@ -160,8 +160,6 @@ static ssize_t pmbus_info_show(struct device *dev, struct device_attribute *da,
struct i2c_client *client = to_i2c_client(dev);
struct as7716_32xb_pmbus_data *data = i2c_get_clientdata(client);
int status = -EINVAL;
//printk("pmbus_info_show\n");
printk("attr->index=%d\n", attr->index);
mutex_lock(&data->update_lock);
switch (attr->index)
{
@ -190,11 +188,9 @@ static ssize_t pmbus_info_show(struct device *dev, struct device_attribute *da,
status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->i_out);
break;
case PSU_P_OUT:
printk("read PSU_P_OUT\n");
status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->p_out);
break;
case PSU_P_OUT_UV:
printk("read PSU_P_OUT_UV\n");
status=snprintf(buf, PAGE_SIZE-1, "%ld\r\n", data->p_out * 1000000);
break;
case PSU_TEMP1_INPUT:
@ -256,8 +252,6 @@ static ssize_t pmbus_info_store(struct device *dev, struct device_attribute *da,
struct as7716_32xb_pmbus_data *data = i2c_get_clientdata(client);
long keyin = 0;
int status = -EINVAL;
//printk("pmbus_info_store\n");
//printk("attr->index=%d\n", attr->index);
mutex_lock(&data->update_lock);
status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin);
switch (attr->index)
@ -286,7 +280,6 @@ static ssize_t pmbus_info_store(struct device *dev, struct device_attribute *da,
data->i_out=keyin;
break;
case PSU_P_OUT:
printk("data->p_out=%d\n", data->p_out);
data->p_out=keyin;
break;
case PSU_P_OUT_UV:
@ -392,7 +385,7 @@ exit:
return status;
}
static int as7716_32xb_pmbus_remove(struct i2c_client *client)
static void as7716_32xb_pmbus_remove(struct i2c_client *client)
{
struct as7716_32xb_pmbus_data *data = i2c_get_clientdata(client);
@ -400,7 +393,6 @@ static int as7716_32xb_pmbus_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7716_32xb_pmbus_group);
kfree(data);
return 0;
}

View File

@ -96,25 +96,19 @@ static ssize_t psu_info_show(struct device *dev, struct device_attribute *da,
struct i2c_client *client = to_i2c_client(dev);
struct as7716_32xb_psu_data *data = i2c_get_clientdata(client);
int status = -EINVAL;
//printk("psu_info_show\n");
// printk("attr->index=%d\n", attr->index);
mutex_lock(&data->update_lock);
switch (attr->index)
{
case PSU_PRESENT:
//printk("data->present=%d\n",data->present);
status = snprintf(buf, PAGE_SIZE - 1, "%d\r\n", data->present);
break;
case PSU_MODEL_NAME:
//printk("data->model_name=%s\n",data->model_name);
status = snprintf(buf, PAGE_SIZE - 1, "%s\r\n", data->model_name);
break;
case PSU_POWER_GOOD:
// printk("data->present=%d\n",data->power_good);
status = snprintf(buf, PAGE_SIZE - 1, "%d\r\n", data->power_good);
break;
case PSU_FAN_DIR:
//printk("data->fan_dir=%s\n",data->fan_dir);
status = snprintf(buf, PAGE_SIZE - 1, "%s\r\n", data->fan_dir);
break;
default :
@ -132,8 +126,6 @@ static ssize_t psu_info_store(struct device *dev, struct device_attribute *da,
struct as7716_32xb_psu_data *data = i2c_get_clientdata(client);
long keyin = 0;
int status = -EINVAL;
//printk("psu_info_store\n");
//printk("attr->index=%d\n", attr->index);
mutex_lock(&data->update_lock);
switch (attr->index)
{
@ -219,15 +211,14 @@ exit:
return status;
}
static int as7716_32xb_psu_remove(struct i2c_client *client)
static void as7716_32xb_psu_remove(struct i2c_client *client)
{
struct as7716_32xb_psu_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as7716_32xb_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -137,7 +137,6 @@ static ssize_t show_present(struct device *dev, struct device_attribute *da,
struct as7716_32x_sfp_data *data = as7716_32x_sfp_update_device(dev);
if (!data->valid) {
printk("return -EIO\n");
return -EIO;
}
@ -216,7 +215,7 @@ exit:
return status;
}
static int as7716_32x_sfp_remove(struct i2c_client *client)
static void as7716_32x_sfp_remove(struct i2c_client *client)
{
struct as7716_32x_sfp_data *data = i2c_get_clientdata(client);
@ -224,7 +223,6 @@ static int as7716_32x_sfp_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7716_32x_sfp_group);
kfree(data);
return 0;
}
enum port_numbers {
@ -313,7 +311,6 @@ static struct as7716_32x_sfp_data *as7716_32x_sfp_update_device(struct device *d
}
data->is_present = (status & (1 << (data->port % 8))) ? 0 : 1;
printk("data->is_present=%d, data->port=%d, status=0x%x\n",data->is_present, data->port, status);
/* Read eeprom data based on port number */
memset(data->eeprom, 0, sizeof(data->eeprom));
@ -325,7 +322,6 @@ static struct as7716_32x_sfp_data *as7716_32x_sfp_update_device(struct device *d
data->eeprom+(i*I2C_SMBUS_BLOCK_MAX),
I2C_SMBUS_BLOCK_MAX);
if (status < 0) {
printk("unable to read eeprom from port(%d)\n", data->port);
dev_dbg(&client->dev, "unable to read eeprom from port(%d)\n", data->port);
goto exit;
}
@ -344,10 +340,6 @@ exit:
static int __init as7716_32x_sfp_init(void)
{
//extern int platform_accton_as7716_32x(void);
//if (!platform_accton_as7716_32x()) {
// return -ENODEV;
//}
return i2c_add_driver(&as7716_32x_sfp_driver);
}

View File

@ -49,36 +49,13 @@ static struct attribute *as7716_32xb_sys_attributes[] = {
static ssize_t sys_info_show(struct device *dev, struct device_attribute *da,
char *buf)
{
//struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct i2c_client *client = to_i2c_client(dev);
struct as7716_32xb_sys_data *data = i2c_get_clientdata(client);
// int status = -EINVAL;
int i;
//printk("sys_info_show\n");
// printk("attr->index=%d\n", attr->index);
mutex_lock(&data->lock);
//for(i=0; i<8; i++)
// printk("data->eeprom[%d]=0x%x ",i, data->eeprom[i]);
//printk("\n");
memcpy(buf, data->eeprom, EEPROM_DATA_SIZE);
//for(i=0; i < EEPROM_DATA_SIZE ; i++)
//{
// buf[i]=data->eeprom[i];
// printk("buf[%d]=0x%x ",i, buf[i]);
//}
//status = EEPROM_DATA_SIZE+1;
//printk("\n");
//status = sprintf(buf, "%x", 0xA);
//data->eeprom[0]=0x0d;
//data->eeprom[1]=0x0;
//data->eeprom[2]=0x06;
// buf[3]=0xFF;
// for(i=0; i< 16; i++)
// printk("buf[%d]=0x%x ",i, buf[i]);
//printk("\n");
memcpy(buf, data->eeprom, 256);
@ -97,11 +74,6 @@ static ssize_t sys_info_store(struct device *dev, struct device_attribute *da,
unsigned char str[3];
unsigned int val;
//printk("sys_info_store\n");
//printk("attr->index=%d\n", attr->index);
//printk("buf[0]=0x%x, buf[1]=0x%x, buf[2]=0x%x, buf[3]=0x%x\n", buf[0], buf[1], buf[2], buf[3]);
// printk("strlen(buf)=%d\n",strlen(buf));
k=0;
mutex_lock(&data->lock);
memset(data->eeprom, 0xFF, EEPROM_DATA_SIZE);
@ -110,34 +82,20 @@ static ssize_t sys_info_store(struct device *dev, struct device_attribute *da,
{
for(i=0; i < strlen(buf) ; i++)
{
// printk("i=%d ", i);
for(j=0;j<2; j++)
{
str[j]=buf[i+j];
}
sscanf(str, "%x", &val);
// printk("str=%s val=0x%x ", str, val);
i=j+i-1;
if(k>=EEPROM_DATA_SIZE)
{
break;
}
data->eeprom[k]=(unsigned char)val;
// printk("data->eeprom[%d]=0x%x\n",k, data->eeprom[k]);
k++;
}
}
//printk("buf=\n");
//for(i=0; i < strlen(buf) ; i++)
//{
// printk("%c%c ", buf[i], buf[i+1]);
// if((i % 31)==0)
// printk("\n");
//}
//printk("\n");
//printk("eeprom[0]=0x%x, eeprom[1]=0x%x, eeprom[2]=0x%x, eeprom[3]=0x%x\n",
// data->eeprom[0], data->eeprom[1], data->eeprom[2], data->eeprom[3]);
mutex_unlock(&data->lock);
return size;
@ -191,7 +149,7 @@ exit:
return status;
}
static int as7716_32xb_sys_remove(struct i2c_client *client)
static void as7716_32xb_sys_remove(struct i2c_client *client)
{
struct as7716_32xb_sys_data *data = i2c_get_clientdata(client);
@ -199,7 +157,6 @@ static int as7716_32xb_sys_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7716_32xb_sys_group);
kfree(data);
return 0;
}

View File

@ -162,7 +162,7 @@ exit:
return status;
}
static int as7716_32xb_thermal_remove(struct i2c_client *client)
static void as7716_32xb_thermal_remove(struct i2c_client *client)
{
struct as7716_32xb_thermal_data *data = i2c_get_clientdata(client);
@ -170,7 +170,6 @@ static int as7716_32xb_thermal_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7716_32xb_thermal_group);
kfree(data);
return 0;
}

View File

@ -151,12 +151,11 @@ exit:
return status;
}
static int accton_i2c_cpld_remove(struct i2c_client *client)
static void accton_i2c_cpld_remove(struct i2c_client *client)
{
sysfs_remove_group(&client->dev.kobj, &as5712_54x_cpld_group);
accton_i2c_cpld_remove_client(client);
return 0;
}
static const struct i2c_device_id accton_i2c_cpld_id[] = {
@ -234,23 +233,7 @@ static void __exit accton_i2c_cpld_exit(void)
{
i2c_del_driver(&accton_i2c_cpld_driver);
}
/*
static struct dmi_system_id as7712_dmi_table[] = {
{
.ident = "Accton AS7712",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Accton"),
DMI_MATCH(DMI_PRODUCT_NAME, "AS7712"),
},
}
};
int platform_accton_as7712_32x(void)
{
return dmi_check_system(as7712_dmi_table);
}
EXPORT_SYMBOL(platform_accton_as7712_32x);
*/
MODULE_AUTHOR("Brandon Chuang <brandon_chuang@accton.com.tw>");
MODULE_DESCRIPTION("accton_i2c_cpld driver");
MODULE_LICENSE("GPL");

View File

@ -110,7 +110,7 @@ class FanUtil(object):
return None
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -141,7 +141,7 @@ class FanUtil(object):
val_file.write(content)
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None

View File

@ -80,7 +80,7 @@ class ThermalUtil(object):
logging.debug('GET. content is NULL. device_path:%s', device_path)
return None
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -111,12 +111,3 @@ class ThermalUtil(object):
def get_thermal_temp(self):
return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX))
def main():
thermal = ThermalUtil()
logging.debug('thermal1=%d', thermal._get_thermal_val(1))
logging.debug('thermal2=%d', thermal._get_thermal_val(2))
logging.debug('thermal3=%d', thermal._get_thermal_val(3))
logging.debug('thermal4=%d', thermal._get_thermal_val(4))
logging.debug('thermal5=%d', thermal._get_thermal_val(5))
if __name__ == '__main__':
main()

View File

@ -778,7 +778,7 @@ exit:
return ret;
}
static int as7726_32x_cpld_remove(struct i2c_client *client)
static void as7726_32x_cpld_remove(struct i2c_client *client)
{
struct as7726_32x_cpld_data *data = i2c_get_clientdata(client);
const struct attribute_group *group = NULL;
@ -806,7 +806,6 @@ static int as7726_32x_cpld_remove(struct i2c_client *client)
kfree(data);
return 0;
}
static int as7726_32x_cpld_read_internal(struct i2c_client *client, u8 reg)

View File

@ -456,13 +456,12 @@ exit:
return status;
}
static int as7726_32x_fan_remove(struct i2c_client *client)
static void as7726_32x_fan_remove(struct i2c_client *client)
{
struct as7726_32x_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as7726_32x_fan_group);
return 0;
}
/* Addresses to scan */

View File

@ -155,7 +155,7 @@ exit:
return status;
}
static int as7726_32x_psu_remove(struct i2c_client *client)
static void as7726_32x_psu_remove(struct i2c_client *client)
{
struct as7726_32x_psu_data *data = i2c_get_clientdata(client);
@ -163,7 +163,6 @@ static int as7726_32x_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7726_32x_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -413,7 +413,7 @@ exit:
return status;
}
static int ym2651y_remove(struct i2c_client *client)
static void ym2651y_remove(struct i2c_client *client)
{
struct ym2651y_data *data = i2c_get_clientdata(client);
@ -421,7 +421,6 @@ static int ym2651y_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &ym2651y_group);
kfree(data);
return 0;
}
static const struct i2c_device_id ym2651y_id[] = {

View File

@ -424,13 +424,12 @@ exit:
return status;
}
static int as7816_64x_fan_remove(struct i2c_client *client)
static void as7816_64x_fan_remove(struct i2c_client *client)
{
struct as7816_64x_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as7816_64x_fan_group);
return 0;
}
/* Addresses to scan */

View File

@ -150,7 +150,7 @@ exit:
return status;
}
static int as7816_64x_psu_remove(struct i2c_client *client)
static void as7816_64x_psu_remove(struct i2c_client *client)
{
struct as7816_64x_psu_data *data = i2c_get_clientdata(client);
@ -158,7 +158,6 @@ static int as7816_64x_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as7816_64x_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -1530,7 +1530,7 @@ static int qsfp_remove(struct i2c_client *client, struct qsfp_data *data)
return 0;
}
static int sfp_device_remove(struct i2c_client *client)
static void sfp_device_remove(struct i2c_client *client)
{
int ret = 0;
struct sfp_port_data *data = i2c_get_clientdata(client);
@ -1540,7 +1540,6 @@ static int sfp_device_remove(struct i2c_client *client)
}
kfree(data);
return ret;
}
/* Addresses scanned

View File

@ -106,7 +106,7 @@ class FanUtil(object):
return None
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -137,7 +137,7 @@ class FanUtil(object):
val_file.write(content)
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None

View File

@ -76,7 +76,7 @@ class ThermalUtil(object):
logging.debug('GET. content is NULL. device_path:%s', device_path)
return None
try:
val_file.close()
val_file.close()
except:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -94,9 +94,3 @@ class ThermalUtil(object):
def get_thermal_path(self, thermal_num):
return self.thermal_sysfspath[thermal_num][0]
def main():
thermal = ThermalUtil()
if __name__ == '__main__':
main()

View File

@ -829,7 +829,7 @@ exit:
return ret;
}
static int as9716_32d_cpld_remove(struct i2c_client *client)
static void as9716_32d_cpld_remove(struct i2c_client *client)
{
struct as9716_32d_cpld_data *data = i2c_get_clientdata(client);
const struct attribute_group *group = NULL;
@ -857,7 +857,6 @@ static int as9716_32d_cpld_remove(struct i2c_client *client)
kfree(data);
return 0;
}
static int as9716_32d_cpld_read_internal(struct i2c_client *client, u8 reg)

View File

@ -455,13 +455,12 @@ exit:
return status;
}
static int as9716_32d_fan_remove(struct i2c_client *client)
static void as9716_32d_fan_remove(struct i2c_client *client)
{
struct as9716_32d_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as9716_32d_fan_group);
return 0;
}
/* Addresses to scan */

View File

@ -180,7 +180,7 @@ exit:
return status;
}
static int as9716_32d_psu_remove(struct i2c_client *client)
static void as9716_32d_psu_remove(struct i2c_client *client)
{
struct as9716_32d_psu_data *data = i2c_get_clientdata(client);
@ -188,7 +188,6 @@ static int as9716_32d_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as9716_32d_psu_group);
kfree(data);
return 0;
}
enum psu_index

View File

@ -372,7 +372,7 @@ exit:
return status;
}
static int accton_i2c_psu_remove(struct i2c_client *client)
static void accton_i2c_psu_remove(struct i2c_client *client)
{
struct accton_i2c_psu_data *data = i2c_get_clientdata(client);
@ -380,7 +380,6 @@ static int accton_i2c_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &accton_i2c_psu_group);
kfree(data);
return 0;
}
/* Support psu moduel
*/

View File

@ -56,7 +56,7 @@ class FanUtil(object):
#fan1_fault
#fan1_present
#(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage',
_fan_device_node_mapping = {
(FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault',
(FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction',
@ -104,7 +104,7 @@ class FanUtil(object):
return None
try:
val_file.close()
val_file.close()
except IOError:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -135,7 +135,7 @@ class FanUtil(object):
val_file.write(content)
try:
val_file.close()
val_file.close()
except BaseException:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
@ -178,7 +178,7 @@ class FanUtil(object):
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
def get_fan_duty_cycle(self):
#duty_path = self.FAN_DUTY_PATH
try:
val_file = open(self.FAN_DUTY_PATH)
except IOError as e:

View File

@ -39,7 +39,7 @@ class ThermalUtil(object):
""" Dictionary where
key1 = thermal id index (integer) starting from 1
value = path to fan device file (string) """
#_thermal_to_device_path_mapping = {}
thermal_sysfspath ={
THERMAL_NUM_1_IDX: ["/sys/bus/i2c/devices/15-0048/hwmon/hwmon*/temp1_input"],
@ -51,7 +51,6 @@ class ThermalUtil(object):
THERMAL_NUM_7_IDX: ["/sys/bus/i2c/devices/15-004b/hwmon/hwmon*/temp1_input"],
}
#def __init__(self):
def _get_thermal_val(self, thermal_num):
if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_MAX:
@ -70,11 +69,11 @@ class ThermalUtil(object):
logging.debug('GET. content is NULL. device_path:%s', device_path)
return None
try:
val_file.close()
val_file.close()
except BaseException:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None
return int(content)
return 0

View File

@ -839,7 +839,7 @@ exit:
return ret;
}
static int as9726_32d_cpld_remove(struct i2c_client *client)
static void as9726_32d_cpld_remove(struct i2c_client *client)
{
struct as9726_32d_cpld_data *data = i2c_get_clientdata(client);
const struct attribute_group *group = NULL;
@ -857,7 +857,7 @@ static int as9726_32d_cpld_remove(struct i2c_client *client)
case as9726_32d_cpld3:
group = &as9726_32d_cpld3_group;
break;
case as9726_32d_cpld_cpu:
case as9726_32d_cpld_cpu:
group = &as9726_32d_cpld_cpu_group;
break;
default:
@ -870,7 +870,6 @@ static int as9726_32d_cpld_remove(struct i2c_client *client)
kfree(data);
return 0;
}
static int as9726_32d_cpld_read_internal(struct i2c_client *client, u8 reg)

View File

@ -514,13 +514,12 @@ exit:
return status;
}
static int as9726_32d_fan_remove(struct i2c_client *client)
static void as9726_32d_fan_remove(struct i2c_client *client)
{
struct as9726_32d_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as9726_32d_fan_group);
return 0;
}
/* Addresses to scan */

View File

@ -187,7 +187,7 @@ exit:
return status;
}
static int as9726_32d_psu_remove(struct i2c_client *client)
static void as9726_32d_psu_remove(struct i2c_client *client)
{
struct as9726_32d_psu_data *data = i2c_get_clientdata(client);
@ -195,7 +195,6 @@ static int as9726_32d_psu_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &as9726_32d_psu_group);
kfree(data);
return 0;
}
enum psu_index
@ -267,7 +266,6 @@ static struct as9726_32d_psu_data *as9726_32d_psu_update_device(struct device *d
/* Read psu status */
status = as9726_32d_cpld_read(0x60, 0x03);
//printk("status=0x%x in %s\n", status, __FUNCTION__);
if (status < 0) {
dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status);

View File

@ -480,7 +480,7 @@ exit:
return status;
}
static int ym2651y_remove(struct i2c_client *client)
static void ym2651y_remove(struct i2c_client *client)
{
struct ym2651y_data *data = i2c_get_clientdata(client);
@ -488,7 +488,6 @@ static int ym2651y_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &ym2651y_group);
kfree(data);
return 0;
}
static const struct i2c_device_id ym2651y_id[] = {

View File

@ -787,7 +787,7 @@ out_kfree:
}
static int accton_i2c_cpld_remove(struct i2c_client *client)
static void accton_i2c_cpld_remove(struct i2c_client *client)
{
struct cpld_data *data = i2c_get_clientdata(client);
@ -795,7 +795,6 @@ static int accton_i2c_cpld_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &data->group);
kfree(data->group.attrs);
accton_i2c_cpld_remove_client(client);
return 0;
}
int accton_i2c_cpld_read(u8 cpld_addr, u8 reg)

View File

@ -1951,12 +1951,11 @@ static int pmbus_probe(struct i2c_client *client,
return _pmbus_do_probe(client, id, info);
}
int _pmbus_do_remove(struct i2c_client *client)
void _pmbus_do_remove(struct i2c_client *client)
{
struct pmbus_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
kfree(data->group.attrs);
return 0;
}
MODULE_DEVICE_TABLE(i2c, pmbus_id);

View File

@ -293,7 +293,7 @@ exit:
return status;
}
static int cpr_4011_4mxx_remove(struct i2c_client *client)
static void cpr_4011_4mxx_remove(struct i2c_client *client)
{
struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client);
@ -301,7 +301,6 @@ static int cpr_4011_4mxx_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group);
kfree(data);
return 0;
}
static const struct i2c_device_id cpr_4011_4mxx_id[] = {

View File

@ -489,7 +489,7 @@ exit:
return status;
}
static int ym2651y_remove(struct i2c_client *client)
static void ym2651y_remove(struct i2c_client *client)
{
struct ym2651y_data *data = i2c_get_clientdata(client);
@ -497,7 +497,6 @@ static int ym2651y_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &ym2651y_group);
kfree(data);
return 0;
}
static const struct i2c_device_id ym2651y_id[] = {

Some files were not shown because too many files have changed in this diff Show More