strsep(&data,”,”); //字符串切割函数
kstrtoint(first,10,&duty_cycle);//字符串转整形 10:十进制
sprintf(data,”%...d,%d”,duty_cycle,fan_freq);//整型数转字符串
示例代码:
ssize_t dcfan_write(struct file *file, const char __user *...buf, size_t count, loff_t *ppos)
{
int ret;
char *data;
char *first,*second;
printk(KERN_EMERG...ret = kstrtoint(first,10,&duty_cycle);//字符串转整形 10:十进制
if(ret) return -1;
ret = kstrtoint(second...,fan_freq=%d\n",__FUNCTION__,duty_cycle,fan_freq);
sprintf(data,"%d,%d",duty_cycle,fan_freq);//整型数转字符串