aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via
diff options
context:
space:
mode:
authorWang Shaoyan <wangshaoyan.pt@taobao.com>2011-08-07 22:18:15 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-08-17 16:13:13 -0400
commit4ce36bbb0497bdd3d6b8682175e5c58745b7acdd (patch)
tree6015a8add4208b3f35ea0be703855a458d116f86 /drivers/video/via
parent94bd217e2d683719ab21a4ac117d8a1b91cbedc9 (diff)
viafb: replace strict_strtoul to kstrto* and check return value
This commit replace the function strict_strtoul(becasue commit 33ee3b2e), and check the return value to avoid such warning: drivers/video/via/viafbdev.c:1992: warning: ignoring return value of 'kstrtoul', declared with attribute warn_unused_result Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/via')
-rw-r--r--drivers/video/via/viafbdev.c126
1 files changed, 68 insertions, 58 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index a1c4a39485f9..a13c258bd32f 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -1158,7 +1158,8 @@ static ssize_t viafb_dvp0_proc_write(struct file *file,
1158 for (i = 0; i < 3; i++) { 1158 for (i = 0; i < 3; i++) {
1159 value = strsep(&pbuf, " "); 1159 value = strsep(&pbuf, " ");
1160 if (value != NULL) { 1160 if (value != NULL) {
1161 strict_strtoul(value, 0, (unsigned long *)&reg_val); 1161 if (kstrtou8(value, 0, &reg_val) < 0)
1162 return -EINVAL;
1162 DEBUG_MSG(KERN_INFO "DVP0:reg_val[%l]=:%x\n", i, 1163 DEBUG_MSG(KERN_INFO "DVP0:reg_val[%l]=:%x\n", i,
1163 reg_val); 1164 reg_val);
1164 switch (i) { 1165 switch (i) {
@@ -1228,7 +1229,8 @@ static ssize_t viafb_dvp1_proc_write(struct file *file,
1228 for (i = 0; i < 3; i++) { 1229 for (i = 0; i < 3; i++) {
1229 value = strsep(&pbuf, " "); 1230 value = strsep(&pbuf, " ");
1230 if (value != NULL) { 1231 if (value != NULL) {
1231 strict_strtoul(value, 0, (unsigned long *)&reg_val); 1232 if (kstrtou8(value, 0, &reg_val) < 0)
1233 return -EINVAL;
1232 switch (i) { 1234 switch (i) {
1233 case 0: 1235 case 0:
1234 viafb_write_reg_mask(CR9B, VIACR, 1236 viafb_write_reg_mask(CR9B, VIACR,
@@ -1286,7 +1288,8 @@ static ssize_t viafb_dfph_proc_write(struct file *file,
1286 if (copy_from_user(&buf[0], buffer, length)) 1288 if (copy_from_user(&buf[0], buffer, length))
1287 return -EFAULT; 1289 return -EFAULT;
1288 buf[length - 1] = '\0'; /*Ensure end string */ 1290 buf[length - 1] = '\0'; /*Ensure end string */
1289 strict_strtoul(&buf[0], 0, (unsigned long *)&reg_val); 1291 if (kstrtou8(buf, 0, &reg_val) < 0)
1292 return -EINVAL;
1290 viafb_write_reg_mask(CR97, VIACR, reg_val, 0x0f); 1293 viafb_write_reg_mask(CR97, VIACR, reg_val, 0x0f);
1291 return count; 1294 return count;
1292} 1295}
@@ -1325,7 +1328,8 @@ static ssize_t viafb_dfpl_proc_write(struct file *file,
1325 if (copy_from_user(&buf[0], buffer, length)) 1328 if (copy_from_user(&buf[0], buffer, length))
1326 return -EFAULT; 1329 return -EFAULT;
1327 buf[length - 1] = '\0'; /*Ensure end string */ 1330 buf[length - 1] = '\0'; /*Ensure end string */
1328 strict_strtoul(&buf[0], 0, (unsigned long *)&reg_val); 1331 if (kstrtou8(buf, 0, &reg_val) < 0)
1332 return -EINVAL;
1329 viafb_write_reg_mask(CR99, VIACR, reg_val, 0x0f); 1333 viafb_write_reg_mask(CR99, VIACR, reg_val, 0x0f);
1330 return count; 1334 return count;
1331} 1335}
@@ -1394,8 +1398,8 @@ static ssize_t viafb_vt1636_proc_write(struct file *file,
1394 for (i = 0; i < 2; i++) { 1398 for (i = 0; i < 2; i++) {
1395 value = strsep(&pbuf, " "); 1399 value = strsep(&pbuf, " ");
1396 if (value != NULL) { 1400 if (value != NULL) {
1397 strict_strtoul(value, 0, 1401 if (kstrtou8(value, 0, &reg_val.Data) < 0)
1398 (unsigned long *)&reg_val.Data); 1402 return -EINVAL;
1399 switch (i) { 1403 switch (i) {
1400 case 0: 1404 case 0:
1401 reg_val.Index = 0x08; 1405 reg_val.Index = 0x08;
@@ -1431,8 +1435,8 @@ static ssize_t viafb_vt1636_proc_write(struct file *file,
1431 for (i = 0; i < 2; i++) { 1435 for (i = 0; i < 2; i++) {
1432 value = strsep(&pbuf, " "); 1436 value = strsep(&pbuf, " ");
1433 if (value != NULL) { 1437 if (value != NULL) {
1434 strict_strtoul(value, 0, 1438 if (kstrtou8(value, 0, &reg_val.Data) < 0)
1435 (unsigned long *)&reg_val.Data); 1439 return -EINVAL;
1436 switch (i) { 1440 switch (i) {
1437 case 0: 1441 case 0:
1438 reg_val.Index = 0x08; 1442 reg_val.Index = 0x08;
@@ -1946,61 +1950,67 @@ static int __init viafb_setup(void)
1946 if (!*this_opt) 1950 if (!*this_opt)
1947 continue; 1951 continue;
1948 1952
1949 if (!strncmp(this_opt, "viafb_mode1=", 12)) 1953 if (!strncmp(this_opt, "viafb_mode1=", 12)) {
1950 viafb_mode1 = kstrdup(this_opt + 12, GFP_KERNEL); 1954 viafb_mode1 = kstrdup(this_opt + 12, GFP_KERNEL);
1951 else if (!strncmp(this_opt, "viafb_mode=", 11)) 1955 } else if (!strncmp(this_opt, "viafb_mode=", 11)) {
1952 viafb_mode = kstrdup(this_opt + 11, GFP_KERNEL); 1956 viafb_mode = kstrdup(this_opt + 11, GFP_KERNEL);
1953 else if (!strncmp(this_opt, "viafb_bpp1=", 11)) 1957 } else if (!strncmp(this_opt, "viafb_bpp1=", 11)) {
1954 strict_strtoul(this_opt + 11, 0, 1958 if (kstrtouint(this_opt + 11, 0, &viafb_bpp1) < 0)
1955 (unsigned long *)&viafb_bpp1); 1959 return -EINVAL;
1956 else if (!strncmp(this_opt, "viafb_bpp=", 10)) 1960 } else if (!strncmp(this_opt, "viafb_bpp=", 10)) {
1957 strict_strtoul(this_opt + 10, 0, 1961 if (kstrtouint(this_opt + 10, 0, &viafb_bpp) < 0)
1958 (unsigned long *)&viafb_bpp); 1962 return -EINVAL;
1959 else if (!strncmp(this_opt, "viafb_refresh1=", 15)) 1963 } else if (!strncmp(this_opt, "viafb_refresh1=", 15)) {
1960 strict_strtoul(this_opt + 15, 0, 1964 if (kstrtoint(this_opt + 15, 0, &viafb_refresh1) < 0)
1961 (unsigned long *)&viafb_refresh1); 1965 return -EINVAL;
1962 else if (!strncmp(this_opt, "viafb_refresh=", 14)) 1966 } else if (!strncmp(this_opt, "viafb_refresh=", 14)) {
1963 strict_strtoul(this_opt + 14, 0, 1967 if (kstrtoint(this_opt + 14, 0, &viafb_refresh) < 0)
1964 (unsigned long *)&viafb_refresh); 1968 return -EINVAL;
1965 else if (!strncmp(this_opt, "viafb_lcd_dsp_method=", 21)) 1969 } else if (!strncmp(this_opt, "viafb_lcd_dsp_method=", 21)) {
1966 strict_strtoul(this_opt + 21, 0, 1970 if (kstrtoint(this_opt + 21, 0,
1967 (unsigned long *)&viafb_lcd_dsp_method); 1971 &viafb_lcd_dsp_method) < 0)
1968 else if (!strncmp(this_opt, "viafb_lcd_panel_id=", 19)) 1972 return -EINVAL;
1969 strict_strtoul(this_opt + 19, 0, 1973 } else if (!strncmp(this_opt, "viafb_lcd_panel_id=", 19)) {
1970 (unsigned long *)&viafb_lcd_panel_id); 1974 if (kstrtoint(this_opt + 19, 0,
1971 else if (!strncmp(this_opt, "viafb_accel=", 12)) 1975 &viafb_lcd_panel_id) < 0)
1972 strict_strtoul(this_opt + 12, 0, 1976 return -EINVAL;
1973 (unsigned long *)&viafb_accel); 1977 } else if (!strncmp(this_opt, "viafb_accel=", 12)) {
1974 else if (!strncmp(this_opt, "viafb_SAMM_ON=", 14)) 1978 if (kstrtoint(this_opt + 12, 0, &viafb_accel) < 0)
1975 strict_strtoul(this_opt + 14, 0, 1979 return -EINVAL;
1976 (unsigned long *)&viafb_SAMM_ON); 1980 } else if (!strncmp(this_opt, "viafb_SAMM_ON=", 14)) {
1977 else if (!strncmp(this_opt, "viafb_active_dev=", 17)) 1981 if (kstrtoint(this_opt + 14, 0, &viafb_SAMM_ON) < 0)
1982 return -EINVAL;
1983 } else if (!strncmp(this_opt, "viafb_active_dev=", 17)) {
1978 viafb_active_dev = kstrdup(this_opt + 17, GFP_KERNEL); 1984 viafb_active_dev = kstrdup(this_opt + 17, GFP_KERNEL);
1979 else if (!strncmp(this_opt, 1985 } else if (!strncmp(this_opt,
1980 "viafb_display_hardware_layout=", 30)) 1986 "viafb_display_hardware_layout=", 30)) {
1981 strict_strtoul(this_opt + 30, 0, 1987 if (kstrtoint(this_opt + 30, 0,
1982 (unsigned long *)&viafb_display_hardware_layout); 1988 &viafb_display_hardware_layout) < 0)
1983 else if (!strncmp(this_opt, "viafb_second_size=", 18)) 1989 return -EINVAL;
1984 strict_strtoul(this_opt + 18, 0, 1990 } else if (!strncmp(this_opt, "viafb_second_size=", 18)) {
1985 (unsigned long *)&viafb_second_size); 1991 if (kstrtoint(this_opt + 18, 0, &viafb_second_size) < 0)
1986 else if (!strncmp(this_opt, 1992 return -EINVAL;
1987 "viafb_platform_epia_dvi=", 24)) 1993 } else if (!strncmp(this_opt,
1988 strict_strtoul(this_opt + 24, 0, 1994 "viafb_platform_epia_dvi=", 24)) {
1989 (unsigned long *)&viafb_platform_epia_dvi); 1995 if (kstrtoint(this_opt + 24, 0,
1990 else if (!strncmp(this_opt, 1996 &viafb_platform_epia_dvi) < 0)
1991 "viafb_device_lcd_dualedge=", 26)) 1997 return -EINVAL;
1992 strict_strtoul(this_opt + 26, 0, 1998 } else if (!strncmp(this_opt,
1993 (unsigned long *)&viafb_device_lcd_dualedge); 1999 "viafb_device_lcd_dualedge=", 26)) {
1994 else if (!strncmp(this_opt, "viafb_bus_width=", 16)) 2000 if (kstrtoint(this_opt + 26, 0,
1995 strict_strtoul(this_opt + 16, 0, 2001 &viafb_device_lcd_dualedge) < 0)
1996 (unsigned long *)&viafb_bus_width); 2002 return -EINVAL;
1997 else if (!strncmp(this_opt, "viafb_lcd_mode=", 15)) 2003 } else if (!strncmp(this_opt, "viafb_bus_width=", 16)) {
1998 strict_strtoul(this_opt + 15, 0, 2004 if (kstrtoint(this_opt + 16, 0, &viafb_bus_width) < 0)
1999 (unsigned long *)&viafb_lcd_mode); 2005 return -EINVAL;
2000 else if (!strncmp(this_opt, "viafb_lcd_port=", 15)) 2006 } else if (!strncmp(this_opt, "viafb_lcd_mode=", 15)) {
2007 if (kstrtoint(this_opt + 15, 0, &viafb_lcd_mode) < 0)
2008 return -EINVAL;
2009 } else if (!strncmp(this_opt, "viafb_lcd_port=", 15)) {
2001 viafb_lcd_port = kstrdup(this_opt + 15, GFP_KERNEL); 2010 viafb_lcd_port = kstrdup(this_opt + 15, GFP_KERNEL);
2002 else if (!strncmp(this_opt, "viafb_dvi_port=", 15)) 2011 } else if (!strncmp(this_opt, "viafb_dvi_port=", 15)) {
2003 viafb_dvi_port = kstrdup(this_opt + 15, GFP_KERNEL); 2012 viafb_dvi_port = kstrdup(this_opt + 15, GFP_KERNEL);
2013 }
2004 } 2014 }
2005 return 0; 2015 return 0;
2006} 2016}