Skip to content

Commit

Permalink
Removing commented code as per the latest review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
FuzailBrcm committed Dec 11, 2019
1 parent 8e8cf2f commit 33ab9b7
Show file tree
Hide file tree
Showing 38 changed files with 13 additions and 197 deletions.
1 change: 0 additions & 1 deletion platform/pddf/i2c/modules/client/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
obj-m:= pddf_client_module.o
#GCOV_PROFILE := y

ccflags-y := -I$(M)/modules/include
8 changes: 0 additions & 8 deletions platform/pddf/i2c/modules/client/pddf_client_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,47 +152,39 @@ ssize_t store_pddf_data(struct device *dev, struct device_attribute *da, const c
{
int ret = 0, num = 0;

/*pddf_dbg(KERN_ERR "%s: %s", __FUNCTION__, buf);*/

PDDF_ATTR *ptr = (PDDF_ATTR *)da;
/*pddf_dbg(KERN_ERR "[ WRITE ] ATTR PTR TYPE:%d, ADDR=%p\n", ptr->type, ptr->addr);*/

switch(ptr->type)
{
case PDDF_CHAR:
strncpy(ptr->addr, buf, strlen(buf)-1); // to discard newline char form buf
ptr->addr[strlen(buf)-1] = '\0';
/*pddf_dbg(KERN_ERR "Stored value: %s\n", ptr->addr);*/
break;
case PDDF_UCHAR:
ret = kstrtoint(buf,10,&num);
if (ret==0)
*(unsigned char *)(ptr->addr) = (unsigned char)num;
/*pddf_dbg(KERN_ERR "Stored value: %d, num: %d\n", *(int*)(ptr->addr), num);*/
break;
case PDDF_INT_DEC:
ret = kstrtoint(buf,10,&num);
if (ret==0)
*(int *)(ptr->addr) = num;
/*pddf_dbg(KERN_ERR "Stored value: %d, num: %d\n", *(int*)(ptr->addr), num);*/
break;
case PDDF_INT_HEX:
ret = kstrtoint(buf,16,&num);
if (ret==0)
*(int *)(ptr->addr) = num;
/*pddf_dbg(KERN_ERR "Stored value: 0x%x, num: 0x%x\n", *(int*)(ptr->addr), num);*/
break;
case PDDF_USHORT:
ret = kstrtoint(buf,16,&num);
if (ret==0)
*(unsigned short *)(ptr->addr) = (unsigned short)num;
/*pddf_dbg(KERN_ERR "Stored value: 0x%x, num: 0x%x\n", *(int*)(ptr->addr), num);*/
break;
case PDDF_UINT32:
ret = kstrtoint(buf,16,&num);
if (ret==0)
*(uint32_t *)(ptr->addr) = (uint32_t)num;
/*pddf_dbg(KERN_ERR "Stored value: 0x%x, num: 0x%x\n", *(int*)(ptr->addr), num);*/
break;
default:
break;
Expand Down
9 changes: 0 additions & 9 deletions platform/pddf/i2c/modules/cpld/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
subdir-m := driver
obj-m := pddf_cpld_module.o
#GCOV_PROFILE := y

#$(info ===========$(M)=========)
CFLAGS_$(obj-m):= -I$(M)/modules/include

#all:
#$(MAKE) -C /projects/slxos_dev/fk410167/18.2.01X/slxos_main/build/swbd4000/linux_4_9/ M=$(PWD) modules ;

#clean:
#$(MAKE) -C /projects/slxos_dev/fk410167/18.2.01X/slxos_main/build/swbd4000/linux_4_9/ M=$(PWD) clean ;

5 changes: 0 additions & 5 deletions platform/pddf/i2c/modules/cpld/driver/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
TARGET = pddf_cpld_driver


obj-m := $(TARGET).o
#GCOV_PROFILE := y


ccflags-y := -I$(M)/modules/include
#ccflags-y += -I$(M)/modules/cpld
7 changes: 0 additions & 7 deletions platform/pddf/i2c/modules/cpld/driver/pddf_cpld_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
#include <linux/dmi.h>


//extern int hw_preaccess_func_cpld_mux_default(uint32_t unit, void *data);


static LIST_HEAD(cpld_client_list);
static struct mutex list_lock;

Expand Down Expand Up @@ -129,8 +126,6 @@ int board_i2c_cpld_read(unsigned short cpld_addr, u8 reg)
struct cpld_client_node *cpld_node = NULL;
int ret = -EPERM;

//hw_preaccess_func_cpld_mux_default((uint32_t)cpld_addr, NULL);

mutex_lock(&list_lock);

list_for_each(list_node, &cpld_client_list)
Expand All @@ -155,8 +150,6 @@ int board_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value)
struct cpld_client_node *cpld_node = NULL;
int ret = -EIO;

//hw_preaccess_func_cpld_mux_default((uint32_t)cpld_addr, NULL);

mutex_lock(&list_lock);

list_for_each(list_node, &cpld_client_list)
Expand Down
6 changes: 0 additions & 6 deletions platform/pddf/i2c/modules/cpld/pddf_cpld_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ static const struct attribute_group pddf_cpld_client_data_group = {
};


/*PDDF_DATA_ATTR(dev_ops, S_IWUSR, NULL, do_device_operation, PDDF_CHAR, 8, (void*)&pddf_attr, (void*)NULL);*/
static ssize_t do_device_operation(struct device *dev, struct device_attribute *da, const char *buf, size_t count)
{
PDDF_ATTR *ptr = (PDDF_ATTR *)da;
Expand All @@ -62,8 +61,6 @@ static ssize_t do_device_operation(struct device *dev, struct device_attribute *
static struct i2c_board_info board_info;
struct i2c_client *client_ptr;

/*pddf_dbg(KERN_ERR "%s: %s", __FUNCTION__, buf);*/
/*pddf_dbg(KERN_ERR "Creating an I2C MUX client with parent_bus:0x%x, dev_type:%s, dev_addr:0x%x\n", device_ptr->parent_bus, device_ptr->dev_type, device_ptr->dev_addr);*/
if (strncmp(buf, "add", strlen(buf)-1)==0)
{
adapter = i2c_get_adapter(device_ptr->parent_bus);
Expand All @@ -77,7 +74,6 @@ static ssize_t do_device_operation(struct device *dev, struct device_attribute *
board_info.addr = device_ptr->dev_addr;
strcpy(board_info.type, device_ptr->dev_type);

/*pddf_dbg(KERN_ERR "Creating a client %s on 0x%x, platform_data 0x%x\n", board_info.type, board_info.addr, board_info.platform_data);*/
client_ptr = i2c_new_device(adapter, &board_info);

if (client_ptr != NULL) {
Expand Down Expand Up @@ -178,5 +174,3 @@ module_exit(cpld_data_exit);
MODULE_AUTHOR("Broadcom");
MODULE_DESCRIPTION("cpld platform data");
MODULE_LICENSE("GPL");

/*#endif*/
1 change: 0 additions & 1 deletion platform/pddf/i2c/modules/fan/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
subdir-m := driver
obj-m := pddf_fan_module.o
#GCOV_PROFILE := y

CFLAGS_$(obj-m):= -I$(M)/modules/include

2 changes: 0 additions & 2 deletions platform/pddf/i2c/modules/fan/driver/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
TARGET := pddf_fan_driver_module

obj-m := $(TARGET).o

$(TARGET)-objs := pddf_fan_api.o pddf_fan_driver.o
#GCOV_PROFILE := y

ccflags-y := -I$(M)/modules/include
3 changes: 0 additions & 3 deletions platform/pddf/i2c/modules/fan/driver/pddf_fan_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ ssize_t fan_show_default(struct device *dev, struct device_attribute *da, char *
get_fan_duplicate_sysfs(ptr->index , new_str);
if (strcmp(attr->dev_attr.attr.name, pdata->fan_attrs[i].aname) == 0 || strcmp(attr->dev_attr.attr.name, new_str) == 0)
{
/*printk(KERN_ERR "%s's show func: access_data from %s, idx %d, new_str=%s\n", attr->dev_attr.attr.name, pdata->fan_attrs[i].aname, ptr->index, new_str);*/
attr_info = &data->attr_info[i];
usr_data = &pdata->fan_attrs[i];
strcpy(new_str, "");
Expand Down Expand Up @@ -312,7 +311,6 @@ int sonic_i2c_get_fan_present_default(void *client, FAN_DATA_ATTR *udata, void *
val = i2c_smbus_read_byte_data((struct i2c_client *)client, udata->offset);
painfo->val.intval = ((val & udata->mask) == udata->cmpval);

/*fan_dbg(KERN_ERR "presence: val:0x%x, mask:0x%x, present_value = 0x%x\n", val, udata->mask, painfo->val.intval);*/

return status;
}
Expand Down Expand Up @@ -350,7 +348,6 @@ int sonic_i2c_get_fan_direction_default(void *client, FAN_DATA_ATTR *udata, void

val = i2c_smbus_read_byte_data((struct i2c_client *)client, udata->offset);
painfo->val.intval = ((val & udata->mask) == udata->cmpval);
/*fan_dbg(KERN_ERR "direction: val:0x%x, mask:0x%x, final val:0x%x\n", val, udata->mask, painfo->val.intval);*/

return status;
}
Expand Down
1 change: 0 additions & 1 deletion platform/pddf/i2c/modules/fan/driver/pddf_fan_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,4 +418,3 @@ module_exit(pddf_fan_exit);
MODULE_AUTHOR("Broadcom");
MODULE_DESCRIPTION("pddf_fan driver");
MODULE_LICENSE("GPL");

28 changes: 0 additions & 28 deletions platform/pddf/i2c/modules/fan/pddf_fan_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,12 @@ static ssize_t do_attr_operation(struct device *dev, struct device_attribute *da
FAN_DATA *fdata = (FAN_DATA *)(ptr->addr);
FAN_SYSFS_ATTR_DATA_ENTRY *entry_ptr;

/*pddf_dbg(KERN_ERR "%s: %s", __FUNCTION__, buf);*/

fdata->fan_attrs[fdata->len] = fdata->fan_attr;
entry_ptr = get_fan_access_data(fdata->fan_attrs[fdata->len].aname);
if (entry_ptr != NULL && entry_ptr->a_ptr != NULL)
{
fdata->fan_attrs[fdata->len].access_data = entry_ptr->a_ptr ;
/*pddf_dbg(KERN_ERR "Attr:%s, access_data_ptr: 0x%x\n",fdata->fan_attrs[fdata->len].aname, fdata->fan_attrs[fdata->len].access_data);*/
}

fdata->len++;
Expand Down Expand Up @@ -125,28 +123,6 @@ struct i2c_board_info *i2c_get_fan_board_info(FAN_DATA *fdata, NEW_DEV_ATTR *cda
fan_platform_data->fan_attrs[i] = fdata->fan_attrs[i];
}

/* Verify that the data is written properly */
#if 0
pddf_dbg(FAN, KERN_ERR "\n\n########### fan_platform_data - start ##########\n");
pddf_dbg(FAN, KERN_ERR "num_of_fans: %d\n", fan_platform_data->num_fan);
pddf_dbg(FAN, KERN_ERR "no_of_usr_attr: %d\n", fan_platform_data->len);

for (i=0; i<num; i++)
{
pddf_dbg(FAN, KERN_ERR "attr: %d\n", i);
pddf_dbg(FAN, KERN_ERR "usr_attr_name: %s\n", fan_platform_data->fan_attrs[i].aname);
pddf_dbg(FAN, KERN_ERR "usr_attr_client_type: %s\n", fan_platform_data->fan_attrs[i].devtype);
pddf_dbg(FAN, KERN_ERR "usr_attr_client_offset: 0x%x\n", fan_platform_data->fan_attrs[i].offset);
pddf_dbg(FAN, KERN_ERR "usr_attr_client_mask: 0x%x\n", fan_platform_data->fan_attrs[i].mask);
pddf_dbg(FAN, KERN_ERR "usr_attr_client_exp_val: 0x%x\n", fan_platform_data->fan_attrs[i].cmpval);
pddf_dbg(FAN, KERN_ERR "usr_attr_len: %d\n", fan_platform_data->fan_attrs[i].len);
pddf_dbg(FAN, KERN_ERR "usr_attr_mult: %d\n", fan_platform_data->fan_attrs[i].mult);
pddf_dbg(FAN, KERN_ERR "usr_attr_is_divisor: %d\n", fan_platform_data->fan_attrs[i].is_divisor);
}
pddf_dbg(FAN, KERN_ERR "########### fan_platform_data - end ##########\n\n");
#endif


board_info = (struct i2c_board_info) {
.platform_data = fan_platform_data,
};
Expand All @@ -163,7 +139,6 @@ struct i2c_board_info *i2c_get_fan_board_info(FAN_DATA *fdata, NEW_DEV_ATTR *cda
}


/*PDDF_DATA_ATTR(dev_ops, S_IWUSR, NULL, do_device_operation, PDDF_CHAR, 8, (void*)&pddf_attr, (void*)NULL);*/
static ssize_t do_device_operation(struct device *dev, struct device_attribute *da, const char *buf, size_t count)
{
PDDF_ATTR *ptr = (PDDF_ATTR *)da;
Expand All @@ -173,14 +148,12 @@ static ssize_t do_device_operation(struct device *dev, struct device_attribute *
struct i2c_board_info *board_info;
struct i2c_client *client_ptr;

/*pddf_dbg(KERN_ERR "Creating an I2C client with parent_bus:0x%x, dev_type:%s, dev_addr:0x%x\n", cdata->parent_bus, cdata->dev_type, cdata->dev_addr);*/
if (strncmp(buf, "add", strlen(buf)-1)==0)
{
adapter = i2c_get_adapter(cdata->parent_bus);
board_info = i2c_get_fan_board_info(fdata, cdata);

/* Populate the platform data for fan */
/*pddf_dbg(KERN_ERR "Creating a client %s on 0x%x, platform_data 0x%x\n", board_info->type, board_info->addr, board_info->platform_data);*/
client_ptr = i2c_new_device(adapter, board_info);

if(client_ptr != NULL)
Expand Down Expand Up @@ -300,4 +273,3 @@ module_exit(pddf_data_exit);
MODULE_AUTHOR("Broadcom");
MODULE_DESCRIPTION("fan platform data");
MODULE_LICENSE("GPL");

6 changes: 1 addition & 5 deletions platform/pddf/i2c/modules/include/pddf_client_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
#endif


/*#define MAX_NUM_PSU 5*/
/*#define MAX_PSU_ATTRS 20*/
#define GEN_NAME_SIZE 32
#define ERR_STR_SIZE 128

Expand Down Expand Up @@ -77,8 +75,6 @@ enum attribute_data_type {



// PSU Specific details

typedef struct NEW_DEV_ATTR
{
char i2c_type[GEN_NAME_SIZE];
Expand Down Expand Up @@ -134,4 +130,4 @@ typedef struct PDEVICE
void add_device_table(char *name, void *ptr);


#endif //__PDDF_CLIENT_DEFS_H__
#endif
8 changes: 2 additions & 6 deletions platform/pddf/i2c/modules/include/pddf_cpld_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
#ifndef __PDDF_CPLD_DEFS_H__
#define __PDDF_CPLD_DEFS_H__

/**//* CPLD CLIENT DATA - PLATFORM DATA FOR PSU CLIENT */
/*typedef struct CPLD_DATA*/
/*{*/
/*int virt_bus;*/
/*}CPLD_DATA;*/
/* CPLD CLIENT DATA - PLATFORM DATA FOR PSU CLIENT */

#endif //__PDDF_CPLD_DEFS_H__
#endif
2 changes: 1 addition & 1 deletion platform/pddf/i2c/modules/include/pddf_fan_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ extern int sonic_i2c_get_fan_pwm_default(void *client, FAN_DATA_ATTR *adata, voi
extern int sonic_i2c_get_fan_fault_default(void *client, FAN_DATA_ATTR *adata, void *data);
extern int sonic_i2c_set_fan_pwm_default(void *client, FAN_DATA_ATTR *adata, void *data);

#endif //__PDDF_FAN_API_H__
#endif
2 changes: 1 addition & 1 deletion platform/pddf/i2c/modules/include/pddf_fan_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ typedef struct FAN_PDATA
extern int board_i2c_cpld_read(unsigned short cpld_addr, u8 reg);
extern int board_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value);

#endif //__PDDF_FAN_DEFS_H__
#endif
2 changes: 1 addition & 1 deletion platform/pddf/i2c/modules/include/pddf_fan_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ struct fan_data {
struct fan_attr_info attr_info[MAX_FAN_ATTRS];
};

#endif //__PDDF_FAN_DRIVER_H__
#endif
2 changes: 1 addition & 1 deletion platform/pddf/i2c/modules/include/pddf_mux_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ typedef struct MUX_DATA
int virt_bus; // Virtual base bus number of the mux channels
}MUX_DATA;

#endif //__PAL_MUX_DEFS_H__
#endif
2 changes: 1 addition & 1 deletion platform/pddf/i2c/modules/include/pddf_psu_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ extern int sonic_i2c_get_psu_i_out_default(void *client, PSU_DATA_ATTR *adata, v
extern int sonic_i2c_get_psu_p_out_default(void *client, PSU_DATA_ATTR *adata, void *data);
extern int sonic_i2c_get_psu_fan1_speed_rpm_default(void *client, PSU_DATA_ATTR *adata, void *data);

#endif //__PDDF_PSU_API_H__
#endif
2 changes: 1 addition & 1 deletion platform/pddf/i2c/modules/include/pddf_psu_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ typedef struct PSU_PDATA
extern int board_i2c_cpld_read(unsigned short cpld_addr, u8 reg);
extern int board_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value);

#endif //__PDDF_PSU_DEFS_H__
#endif
2 changes: 1 addition & 1 deletion platform/pddf/i2c/modules/include/pddf_psu_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ struct psu_data {
};


#endif //__PDDF_PSU_DRIVER_H__
#endif
2 changes: 1 addition & 1 deletion platform/pddf/i2c/modules/include/pddf_sysstatus_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ typedef struct SYSSTATUS_DATA



#endif //__PDDF_SYSSTATUS_DEFS_H__
#endif
2 changes: 1 addition & 1 deletion platform/pddf/i2c/modules/include/pddf_xcvr_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ extern ssize_t get_module_txdisable(struct device *dev, struct device_attribute
extern ssize_t set_module_txdisable(struct device *dev, struct device_attribute *da, const char *buf, size_t count);
extern ssize_t get_module_txfault(struct device *dev, struct device_attribute *da, char *buf);

#endif //__PDDF_XCVR_API_H__
#endif
3 changes: 1 addition & 2 deletions platform/pddf/i2c/modules/include/pddf_xcvr_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ typedef enum xcvr_port_type_e {
PDDF_PORT_TYPE_QSFP28
} xcvr_port_type_t;

/*static int data_parsing_complete = 0;*/
/* Each client has this additional data
*/
struct xcvr_data {
Expand Down Expand Up @@ -118,4 +117,4 @@ enum xcvr_sysfs_attributes {
extern int board_i2c_cpld_read(unsigned short cpld_addr, u8 reg);
extern int board_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value);

#endif //__PDDF_XCVR_DEFS_H__
#endif
1 change: 0 additions & 1 deletion platform/pddf/i2c/modules/led/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
TARGET := pddf_led_module
obj-m := $(TARGET).o
#GCOV_PROFILE := y

CFLAGS_$(obj-m):= -I$(M)/modules/include
1 change: 0 additions & 1 deletion platform/pddf/i2c/modules/led/pddf_led_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ ssize_t show_pddf_data(struct device *dev, struct device_attribute *da,
ssize_t store_pddf_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count)
{
int ret = 0, num = 0;
//pddf_dbg(KERN_ERR "%s: %s", __FUNCTION__, buf);
struct pddf_data_attribute *ptr = (struct pddf_data_attribute *)da;
switch(ptr->type)
{
Expand Down
1 change: 0 additions & 1 deletion platform/pddf/i2c/modules/mux/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

obj-m := pddf_mux_module.o

#GCOV_PROFILE := y
CFLAGS_$(obj-m):= -I$(M)/modules/include
Loading

0 comments on commit 33ab9b7

Please sign in to comment.