#define PPMGR_CLASS_NAME "ppmgr"
static int parse_para(const char *para, int para_num, int *result)
{
- char *endp = NULL;
- const char *startp = para;
+ char *token = NULL;
+ char *params, *params_base;
int *out = result;
int len = 0, count = 0;
- long tmp;
- int ret;
+ int res = 0;
+ int ret = 0;
- if (!startp)
+ if (!para)
return 0;
- len = strlen(startp);
-
+ params = kstrdup(para, GFP_KERNEL);
+ params_base = params;
+ token = params;
+ len = strlen(token);
do {
- /*filter space out*/
- while (startp && (isspace(*startp) || !isgraph(*startp))
- && len) {
- startp++;
+ token = strsep(¶ms, " ");
+ while (token && (isspace(*token)
+ || !isgraph(*token)) && len) {
+ token++;
len--;
}
-
- if (len == 0)
+ if ((len == 0) || (!token))
+ break;
+ ret = kstrtoint(token, 0, &res);
+ if (ret < 0) {
+ PPMGRDRV_ERR("ERR convert %s to long int!\n", token);
break;
-
- /* *out++ = simple_strtol(startp, &endp, 0); */
-
- ret = kstrtol(startp, 0, &tmp);
- if (ret != 0) {
- PPMGRDRV_ERR("ERR convert %s to long int!\n", startp);
- return ret;
}
- *out++ = tmp;
- len -= endp - startp;
- startp = endp;
+ len = strlen(token);
+ *out++ = res;
count++;
+ } while ((token) && (count < para_num) && (len > 0));
- } while ((endp) && (count < para_num) && (len > 0));
-
+ kfree(params_base);
return count;
}
static ssize_t angle_write(struct class *cla, struct class_attribute *attr,
const char *buf, size_t count)
{
+ /*
ssize_t size;
char *endp;
- /* unsigned long angle = simple_strtoul(buf, &endp, 0); */
- unsigned long angle;
+ unsigned long angle = simple_strtoul(buf, &endp, 0);
+ */
+ long angle;
int ret = kstrtoul(buf, 0, &angle);
if (ret != 0) {
return ret;
}
if (angle > 3 || angle < 0) {
- size = endp - buf;
+ /* size = endp - buf; */
return count;
}
if (_ppmgr_angle_write(angle) < 0)
return -EINVAL;
- size = endp - buf;
+ /* size = endp - buf; */
return count;
}
struct class_attribute *attr,
const char *buf, size_t count)
{
- ssize_t ret = -EINVAL, size;
- char *endp;
+ ssize_t ret = -EINVAL; /* , size; */
+ /* char *endp; */
unsigned long tmp;
/* unsigned angle = simple_strtoul(buf, &endp, 0); */
unsigned int angle;
PPMGRDRV_INFO("angle:%d,orientation:%d,videoangle:%d\n",
ppmgr_device.angle, ppmgr_device.orientation,
ppmgr_device.videoangle);
- size = endp - buf;
+ /* size = endp - buf; */
return count;
}
static ssize_t bypass_write(struct class *cla, struct class_attribute *attr,
const char *buf, size_t count)
{
+ /*
ssize_t size;
char *endp;
+ */
long tmp;
/* ppmgr_device.bypass = simple_strtoul(buf, &endp, 0); */
return ret;
}
ppmgr_device.bypass = tmp;
- size = endp - buf;
+ /* size = endp - buf; */
return count;
}
static ssize_t ppscaler_write(struct class *cla, struct class_attribute *attr,
const char *buf, size_t count)
{
+ /*
ssize_t size;
char *endp;
+ */
long tmp;
/* int flag simple_strtoul(buf, &endp, 0); */
int flag;
if (ppmgr_device.ppscaler_flag == 0)
set_scaler_pos_reset(true);
}
- size = endp - buf;
+ /* size = endp - buf; */
return count;
}
static ssize_t receiver_write(struct class *cla, struct class_attribute *attr,
const char *buf, size_t count)
{
+ /*
ssize_t size;
char *endp;
+ */
long tmp;
int ret;
}
ppmgr_device.receiver = tmp;
vf_ppmgr_reset(0);
- size = endp - buf;
+ /* size = endp - buf; */
return count;
}
struct class_attribute *attr,
const char *buf, size_t count)
{
+ /*
ssize_t size;
char *endp;
+ */
long tmp;
/* platform_type = simple_strtoul(buf, &endp, 0); */
int ret = kstrtoul(buf, 0, &tmp);
return ret;
}
platform_type = tmp;
- size = endp - buf;
+ /* size = endp - buf; */
return count;
}
struct class_attribute *attr,
const char *buf, size_t count)
{
+ /*
ssize_t size;
char *endp;
+ */
unsigned long tmp;
int ret = kstrtoul(buf, 0, &tmp);
return ret;
}
ppmgr_device.tb_detect = tmp;
- size = endp - buf;
+ /* size = endp - buf; */
return count;
}
struct class_attribute *attr,
const char *buf, size_t count)
{
+ /*
ssize_t size;
char *endp;
+ */
unsigned long tmp;
/* platform_type = simple_strtoul(buf, &endp, 0); */
int ret = kstrtoul(buf, 0, &tmp);
return ret;
}
ppmgr_device.tb_detect_period = tmp;
- size = endp - buf;
+ /* size = endp - buf; */
return count;
}
struct class_attribute *attr,
const char *buf, size_t count)
{
+ /*
ssize_t size;
char *endp;
+ */
unsigned long tmp;
/* platform_type = simple_strtoul(buf, &endp, 0); */
int ret = kstrtoul(buf, 0, &tmp);
tmp = 6;
}
ppmgr_device.tb_detect_buf_len = tmp;
- size = endp - buf;
+ /* size = endp - buf; */
return count;
}
struct class_attribute *attr,
const char *buf, size_t count)
{
+ /*
ssize_t size;
char *endp;
+ */
unsigned long tmp;
/* platform_type = simple_strtoul(buf, &endp, 0); */
int ret = kstrtoul(buf, 0, &tmp);
PPMGRDRV_INFO(
"tb detect init mute is %ld\n", tmp);
ppmgr_device.tb_detect_init_mute = tmp;
- size = endp - buf;
+ /* size = endp - buf; */
return count;
}
static ssize_t mirror_write(struct class *cla, struct class_attribute *attr,
const char *buf, size_t count)
{
+ /*
ssize_t size;
char *endp;
+ */
long tmp;
int ret = kstrtol(buf, 0, &tmp);
/* ppmgr_device.mirror_flag = simple_strtoul(buf, &endp, 0); */
ppmgr_device.mirror_flag = tmp;
if (ppmgr_device.mirror_flag > 2)
ppmgr_device.mirror_flag = 0;
- size = endp - buf;
+ /* size = endp - buf; */
return count;
}