All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: modes: replace simple_strtoul by kstrtouint
@ 2015-11-05  9:33 LABBE Corentin
  2015-11-16 16:15   ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: LABBE Corentin @ 2015-11-05  9:33 UTC (permalink / raw)
  To: airlied; +Cc: LABBE Corentin, dri-devel, linux-kernel

The simple_strtoul function is marked as obsolete.
This patch replace it by kstrtouint.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
 drivers/gpu/drm/drm_modes.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index cd74a09..bde9b29 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1230,7 +1230,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 	unsigned int xres = 0, yres = 0, bpp = 32, refresh = 0;
 	bool yres_specified = false, cvt = false, rb = false;
 	bool interlace = false, margins = false, was_digit = false;
-	int i;
+	int i, err;
 	enum drm_connector_force force = DRM_FORCE_UNSPECIFIED;
 
 #ifdef CONFIG_FB
@@ -1250,7 +1250,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 		case '@':
 			if (!refresh_specified && !bpp_specified &&
 			    !yres_specified && !cvt && !rb && was_digit) {
-				refresh = simple_strtol(&name[i+1], NULL, 10);
+				err = kstrtouint(&name[i + 1], 10, &refresh);
+				if (err)
+					return false;
 				refresh_specified = true;
 				was_digit = false;
 			} else
@@ -1259,7 +1261,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 		case '-':
 			if (!bpp_specified && !yres_specified && !cvt &&
 			    !rb && was_digit) {
-				bpp = simple_strtol(&name[i+1], NULL, 10);
+				err = kstrtouint(&name[i + 1], 10, &bpp);
+				if (err)
+					return false;
 				bpp_specified = true;
 				was_digit = false;
 			} else
@@ -1267,7 +1271,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 			break;
 		case 'x':
 			if (!yres_specified && was_digit) {
-				yres = simple_strtol(&name[i+1], NULL, 10);
+				err = kstrtouint(&name[i + 1], 10, &yres);
+				if (err)
+					return false;
 				yres_specified = true;
 				was_digit = false;
 			} else
@@ -1491,4 +1497,4 @@ int drm_mode_convert_umode(struct drm_display_mode *out,
 
 out:
 	return ret;
-}
\ No newline at end of file
+}
-- 
2.4.10


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm: modes: replace simple_strtoul by kstrtouint
  2015-11-05  9:33 [PATCH] drm: modes: replace simple_strtoul by kstrtouint LABBE Corentin
@ 2015-11-16 16:15   ` Daniel Vetter
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2015-11-16 16:15 UTC (permalink / raw)
  To: LABBE Corentin; +Cc: airlied, linux-kernel, dri-devel

On Thu, Nov 05, 2015 at 10:33:54AM +0100, LABBE Corentin wrote:
> The simple_strtoul function is marked as obsolete.
> This patch replace it by kstrtouint.
> 
> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>

Applied to drm-misc, thanks.
-Daniel

> ---
>  drivers/gpu/drm/drm_modes.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index cd74a09..bde9b29 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -1230,7 +1230,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
>  	unsigned int xres = 0, yres = 0, bpp = 32, refresh = 0;
>  	bool yres_specified = false, cvt = false, rb = false;
>  	bool interlace = false, margins = false, was_digit = false;
> -	int i;
> +	int i, err;
>  	enum drm_connector_force force = DRM_FORCE_UNSPECIFIED;
>  
>  #ifdef CONFIG_FB
> @@ -1250,7 +1250,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
>  		case '@':
>  			if (!refresh_specified && !bpp_specified &&
>  			    !yres_specified && !cvt && !rb && was_digit) {
> -				refresh = simple_strtol(&name[i+1], NULL, 10);
> +				err = kstrtouint(&name[i + 1], 10, &refresh);
> +				if (err)
> +					return false;
>  				refresh_specified = true;
>  				was_digit = false;
>  			} else
> @@ -1259,7 +1261,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
>  		case '-':
>  			if (!bpp_specified && !yres_specified && !cvt &&
>  			    !rb && was_digit) {
> -				bpp = simple_strtol(&name[i+1], NULL, 10);
> +				err = kstrtouint(&name[i + 1], 10, &bpp);
> +				if (err)
> +					return false;
>  				bpp_specified = true;
>  				was_digit = false;
>  			} else
> @@ -1267,7 +1271,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
>  			break;
>  		case 'x':
>  			if (!yres_specified && was_digit) {
> -				yres = simple_strtol(&name[i+1], NULL, 10);
> +				err = kstrtouint(&name[i + 1], 10, &yres);
> +				if (err)
> +					return false;
>  				yres_specified = true;
>  				was_digit = false;
>  			} else
> @@ -1491,4 +1497,4 @@ int drm_mode_convert_umode(struct drm_display_mode *out,
>  
>  out:
>  	return ret;
> -}
> \ No newline at end of file
> +}
> -- 
> 2.4.10
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm: modes: replace simple_strtoul by kstrtouint
@ 2015-11-16 16:15   ` Daniel Vetter
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2015-11-16 16:15 UTC (permalink / raw)
  To: LABBE Corentin; +Cc: linux-kernel, dri-devel

On Thu, Nov 05, 2015 at 10:33:54AM +0100, LABBE Corentin wrote:
> The simple_strtoul function is marked as obsolete.
> This patch replace it by kstrtouint.
> 
> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>

Applied to drm-misc, thanks.
-Daniel

> ---
>  drivers/gpu/drm/drm_modes.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index cd74a09..bde9b29 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -1230,7 +1230,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
>  	unsigned int xres = 0, yres = 0, bpp = 32, refresh = 0;
>  	bool yres_specified = false, cvt = false, rb = false;
>  	bool interlace = false, margins = false, was_digit = false;
> -	int i;
> +	int i, err;
>  	enum drm_connector_force force = DRM_FORCE_UNSPECIFIED;
>  
>  #ifdef CONFIG_FB
> @@ -1250,7 +1250,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
>  		case '@':
>  			if (!refresh_specified && !bpp_specified &&
>  			    !yres_specified && !cvt && !rb && was_digit) {
> -				refresh = simple_strtol(&name[i+1], NULL, 10);
> +				err = kstrtouint(&name[i + 1], 10, &refresh);
> +				if (err)
> +					return false;
>  				refresh_specified = true;
>  				was_digit = false;
>  			} else
> @@ -1259,7 +1261,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
>  		case '-':
>  			if (!bpp_specified && !yres_specified && !cvt &&
>  			    !rb && was_digit) {
> -				bpp = simple_strtol(&name[i+1], NULL, 10);
> +				err = kstrtouint(&name[i + 1], 10, &bpp);
> +				if (err)
> +					return false;
>  				bpp_specified = true;
>  				was_digit = false;
>  			} else
> @@ -1267,7 +1271,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
>  			break;
>  		case 'x':
>  			if (!yres_specified && was_digit) {
> -				yres = simple_strtol(&name[i+1], NULL, 10);
> +				err = kstrtouint(&name[i + 1], 10, &yres);
> +				if (err)
> +					return false;
>  				yres_specified = true;
>  				was_digit = false;
>  			} else
> @@ -1491,4 +1497,4 @@ int drm_mode_convert_umode(struct drm_display_mode *out,
>  
>  out:
>  	return ret;
> -}
> \ No newline at end of file
> +}
> -- 
> 2.4.10
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-16 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-05  9:33 [PATCH] drm: modes: replace simple_strtoul by kstrtouint LABBE Corentin
2015-11-16 16:15 ` Daniel Vetter
2015-11-16 16:15   ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.