* [PATCH] video/fbdev: refactor video= cmdline parsing
@ 2019-01-23 9:38 ` Jani Nikula
0 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2019-01-23 9:38 UTC (permalink / raw)
To: linux-fbdev, dri-devel; +Cc: jani.nikula, Bartlomiej Zolnierkiewicz
Make the video_setup() function slightly easier to read by removing the
repeated checks for !global. Remove the misleading return value comment
while at it.
I'm slightly hesitant to change any of this, but here goes anyway, with
hopes that the next person to have to look at this has it a wee bit
easier.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
drivers/video/fbdev/core/fb_cmdline.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/video/fbdev/core/fb_cmdline.c b/drivers/video/fbdev/core/fb_cmdline.c
index 39509ccd92f1..3b5bd666b952 100644
--- a/drivers/video/fbdev/core/fb_cmdline.c
+++ b/drivers/video/fbdev/core/fb_cmdline.c
@@ -75,36 +75,33 @@ EXPORT_SYMBOL(fb_get_options);
* NOTE: This function is a __setup and __init function.
* It only stores the options. Drivers have to call
* fb_get_options() as necessary.
- *
- * Returns zero.
- *
*/
static int __init video_setup(char *options)
{
- int i, global = 0;
-
if (!options || !*options)
- global = 1;
+ goto out;
- if (!global && !strncmp(options, "ofonly", 6)) {
+ if (!strncmp(options, "ofonly", 6)) {
ofonly = 1;
- global = 1;
+ goto out;
}
- if (!global && !strchr(options, ':')) {
- fb_mode_option = options;
- global = 1;
- }
+ if (strchr(options, ':')) {
+ /* named */
+ int i;
- if (!global) {
for (i = 0; i < FB_MAX; i++) {
if (video_options[i] = NULL) {
video_options[i] = options;
break;
}
}
+ } else {
+ /* global */
+ fb_mode_option = options;
}
+out:
return 1;
}
__setup("video=", video_setup);
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH] video/fbdev: refactor video= cmdline parsing
@ 2019-01-23 9:38 ` Jani Nikula
0 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2019-01-23 9:38 UTC (permalink / raw)
To: linux-fbdev, dri-devel; +Cc: jani.nikula, Bartlomiej Zolnierkiewicz
Make the video_setup() function slightly easier to read by removing the
repeated checks for !global. Remove the misleading return value comment
while at it.
I'm slightly hesitant to change any of this, but here goes anyway, with
hopes that the next person to have to look at this has it a wee bit
easier.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
drivers/video/fbdev/core/fb_cmdline.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/video/fbdev/core/fb_cmdline.c b/drivers/video/fbdev/core/fb_cmdline.c
index 39509ccd92f1..3b5bd666b952 100644
--- a/drivers/video/fbdev/core/fb_cmdline.c
+++ b/drivers/video/fbdev/core/fb_cmdline.c
@@ -75,36 +75,33 @@ EXPORT_SYMBOL(fb_get_options);
* NOTE: This function is a __setup and __init function.
* It only stores the options. Drivers have to call
* fb_get_options() as necessary.
- *
- * Returns zero.
- *
*/
static int __init video_setup(char *options)
{
- int i, global = 0;
-
if (!options || !*options)
- global = 1;
+ goto out;
- if (!global && !strncmp(options, "ofonly", 6)) {
+ if (!strncmp(options, "ofonly", 6)) {
ofonly = 1;
- global = 1;
+ goto out;
}
- if (!global && !strchr(options, ':')) {
- fb_mode_option = options;
- global = 1;
- }
+ if (strchr(options, ':')) {
+ /* named */
+ int i;
- if (!global) {
for (i = 0; i < FB_MAX; i++) {
if (video_options[i] == NULL) {
video_options[i] = options;
break;
}
}
+ } else {
+ /* global */
+ fb_mode_option = options;
}
+out:
return 1;
}
__setup("video=", video_setup);
--
2.20.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH] video/fbdev: refactor video= cmdline parsing
2019-01-23 9:38 ` Jani Nikula
@ 2019-01-23 10:58 ` Daniel Vetter
-1 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2019-01-23 10:58 UTC (permalink / raw)
To: Jani Nikula; +Cc: linux-fbdev, dri-devel, Bartlomiej Zolnierkiewicz
On Wed, Jan 23, 2019 at 11:38:17AM +0200, Jani Nikula wrote:
> Make the video_setup() function slightly easier to read by removing the
> repeated checks for !global. Remove the misleading return value comment
> while at it.
>
> I'm slightly hesitant to change any of this, but here goes anyway, with
> hopes that the next person to have to look at this has it a wee bit
> easier.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/video/fbdev/core/fb_cmdline.c | 23 ++++++++++-------------
> 1 file changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fb_cmdline.c b/drivers/video/fbdev/core/fb_cmdline.c
> index 39509ccd92f1..3b5bd666b952 100644
> --- a/drivers/video/fbdev/core/fb_cmdline.c
> +++ b/drivers/video/fbdev/core/fb_cmdline.c
> @@ -75,36 +75,33 @@ EXPORT_SYMBOL(fb_get_options);
> * NOTE: This function is a __setup and __init function.
> * It only stores the options. Drivers have to call
> * fb_get_options() as necessary.
> - *
> - * Returns zero.
> - *
> */
> static int __init video_setup(char *options)
> {
> - int i, global = 0;
> -
> if (!options || !*options)
> - global = 1;
> + goto out;
>
> - if (!global && !strncmp(options, "ofonly", 6)) {
> + if (!strncmp(options, "ofonly", 6)) {
> ofonly = 1;
> - global = 1;
> + goto out;
> }
>
> - if (!global && !strchr(options, ':')) {
> - fb_mode_option = options;
> - global = 1;
> - }
> + if (strchr(options, ':')) {
> + /* named */
> + int i;
>
> - if (!global) {
> for (i = 0; i < FB_MAX; i++) {
> if (video_options[i] = NULL) {
> video_options[i] = options;
> break;
> }
> }
> + } else {
> + /* global */
> + fb_mode_option = options;
> }
>
> +out:
> return 1;
> }
> __setup("video=", video_setup);
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] video/fbdev: refactor video= cmdline parsing
@ 2019-01-23 10:58 ` Daniel Vetter
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2019-01-23 10:58 UTC (permalink / raw)
To: Jani Nikula; +Cc: linux-fbdev, dri-devel, Bartlomiej Zolnierkiewicz
On Wed, Jan 23, 2019 at 11:38:17AM +0200, Jani Nikula wrote:
> Make the video_setup() function slightly easier to read by removing the
> repeated checks for !global. Remove the misleading return value comment
> while at it.
>
> I'm slightly hesitant to change any of this, but here goes anyway, with
> hopes that the next person to have to look at this has it a wee bit
> easier.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/video/fbdev/core/fb_cmdline.c | 23 ++++++++++-------------
> 1 file changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fb_cmdline.c b/drivers/video/fbdev/core/fb_cmdline.c
> index 39509ccd92f1..3b5bd666b952 100644
> --- a/drivers/video/fbdev/core/fb_cmdline.c
> +++ b/drivers/video/fbdev/core/fb_cmdline.c
> @@ -75,36 +75,33 @@ EXPORT_SYMBOL(fb_get_options);
> * NOTE: This function is a __setup and __init function.
> * It only stores the options. Drivers have to call
> * fb_get_options() as necessary.
> - *
> - * Returns zero.
> - *
> */
> static int __init video_setup(char *options)
> {
> - int i, global = 0;
> -
> if (!options || !*options)
> - global = 1;
> + goto out;
>
> - if (!global && !strncmp(options, "ofonly", 6)) {
> + if (!strncmp(options, "ofonly", 6)) {
> ofonly = 1;
> - global = 1;
> + goto out;
> }
>
> - if (!global && !strchr(options, ':')) {
> - fb_mode_option = options;
> - global = 1;
> - }
> + if (strchr(options, ':')) {
> + /* named */
> + int i;
>
> - if (!global) {
> for (i = 0; i < FB_MAX; i++) {
> if (video_options[i] == NULL) {
> video_options[i] = options;
> break;
> }
> }
> + } else {
> + /* global */
> + fb_mode_option = options;
> }
>
> +out:
> return 1;
> }
> __setup("video=", video_setup);
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://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
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] video/fbdev: refactor video= cmdline parsing
2019-01-23 10:58 ` Daniel Vetter
@ 2019-01-23 11:12 ` Jani Nikula
-1 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2019-01-23 11:12 UTC (permalink / raw)
To: Daniel Vetter; +Cc: linux-fbdev, dri-devel, Bartlomiej Zolnierkiewicz
On Wed, 23 Jan 2019, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Wed, Jan 23, 2019 at 11:38:17AM +0200, Jani Nikula wrote:
>> Make the video_setup() function slightly easier to read by removing the
>> repeated checks for !global. Remove the misleading return value comment
>> while at it.
>>
>> I'm slightly hesitant to change any of this, but here goes anyway, with
>> hopes that the next person to have to look at this has it a wee bit
>> easier.
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Thanks.
Just to be clear, I expect Bartlomiej to queue this via the fb tree
(provided he agrees with the change, of course).
BR,
Jani.
>
>> ---
>> drivers/video/fbdev/core/fb_cmdline.c | 23 ++++++++++-------------
>> 1 file changed, 10 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/video/fbdev/core/fb_cmdline.c b/drivers/video/fbdev/core/fb_cmdline.c
>> index 39509ccd92f1..3b5bd666b952 100644
>> --- a/drivers/video/fbdev/core/fb_cmdline.c
>> +++ b/drivers/video/fbdev/core/fb_cmdline.c
>> @@ -75,36 +75,33 @@ EXPORT_SYMBOL(fb_get_options);
>> * NOTE: This function is a __setup and __init function.
>> * It only stores the options. Drivers have to call
>> * fb_get_options() as necessary.
>> - *
>> - * Returns zero.
>> - *
>> */
>> static int __init video_setup(char *options)
>> {
>> - int i, global = 0;
>> -
>> if (!options || !*options)
>> - global = 1;
>> + goto out;
>>
>> - if (!global && !strncmp(options, "ofonly", 6)) {
>> + if (!strncmp(options, "ofonly", 6)) {
>> ofonly = 1;
>> - global = 1;
>> + goto out;
>> }
>>
>> - if (!global && !strchr(options, ':')) {
>> - fb_mode_option = options;
>> - global = 1;
>> - }
>> + if (strchr(options, ':')) {
>> + /* named */
>> + int i;
>>
>> - if (!global) {
>> for (i = 0; i < FB_MAX; i++) {
>> if (video_options[i] = NULL) {
>> video_options[i] = options;
>> break;
>> }
>> }
>> + } else {
>> + /* global */
>> + fb_mode_option = options;
>> }
>>
>> +out:
>> return 1;
>> }
>> __setup("video=", video_setup);
>> --
>> 2.20.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Jani Nikula, Intel Open Source Graphics Center
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] video/fbdev: refactor video= cmdline parsing
@ 2019-01-23 11:12 ` Jani Nikula
0 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2019-01-23 11:12 UTC (permalink / raw)
To: Daniel Vetter; +Cc: linux-fbdev, dri-devel, Bartlomiej Zolnierkiewicz
On Wed, 23 Jan 2019, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Wed, Jan 23, 2019 at 11:38:17AM +0200, Jani Nikula wrote:
>> Make the video_setup() function slightly easier to read by removing the
>> repeated checks for !global. Remove the misleading return value comment
>> while at it.
>>
>> I'm slightly hesitant to change any of this, but here goes anyway, with
>> hopes that the next person to have to look at this has it a wee bit
>> easier.
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Thanks.
Just to be clear, I expect Bartlomiej to queue this via the fb tree
(provided he agrees with the change, of course).
BR,
Jani.
>
>> ---
>> drivers/video/fbdev/core/fb_cmdline.c | 23 ++++++++++-------------
>> 1 file changed, 10 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/video/fbdev/core/fb_cmdline.c b/drivers/video/fbdev/core/fb_cmdline.c
>> index 39509ccd92f1..3b5bd666b952 100644
>> --- a/drivers/video/fbdev/core/fb_cmdline.c
>> +++ b/drivers/video/fbdev/core/fb_cmdline.c
>> @@ -75,36 +75,33 @@ EXPORT_SYMBOL(fb_get_options);
>> * NOTE: This function is a __setup and __init function.
>> * It only stores the options. Drivers have to call
>> * fb_get_options() as necessary.
>> - *
>> - * Returns zero.
>> - *
>> */
>> static int __init video_setup(char *options)
>> {
>> - int i, global = 0;
>> -
>> if (!options || !*options)
>> - global = 1;
>> + goto out;
>>
>> - if (!global && !strncmp(options, "ofonly", 6)) {
>> + if (!strncmp(options, "ofonly", 6)) {
>> ofonly = 1;
>> - global = 1;
>> + goto out;
>> }
>>
>> - if (!global && !strchr(options, ':')) {
>> - fb_mode_option = options;
>> - global = 1;
>> - }
>> + if (strchr(options, ':')) {
>> + /* named */
>> + int i;
>>
>> - if (!global) {
>> for (i = 0; i < FB_MAX; i++) {
>> if (video_options[i] == NULL) {
>> video_options[i] = options;
>> break;
>> }
>> }
>> + } else {
>> + /* global */
>> + fb_mode_option = options;
>> }
>>
>> +out:
>> return 1;
>> }
>> __setup("video=", video_setup);
>> --
>> 2.20.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] video/fbdev: refactor video= cmdline parsing
2019-01-23 11:12 ` Jani Nikula
@ 2019-02-08 17:31 ` Bartlomiej Zolnierkiewicz
-1 siblings, 0 replies; 8+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-02-08 17:31 UTC (permalink / raw)
To: Jani Nikula; +Cc: linux-fbdev, dri-devel
On 01/23/2019 12:12 PM, Jani Nikula wrote:
> On Wed, 23 Jan 2019, Daniel Vetter <daniel@ffwll.ch> wrote:
>> On Wed, Jan 23, 2019 at 11:38:17AM +0200, Jani Nikula wrote:
>>> Make the video_setup() function slightly easier to read by removing the
>>> repeated checks for !global. Remove the misleading return value comment
>>> while at it.
>>>
>>> I'm slightly hesitant to change any of this, but here goes anyway, with
>>> hopes that the next person to have to look at this has it a wee bit
>>> easier.
>>>
>>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>>
>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> Thanks.
>
> Just to be clear, I expect Bartlomiej to queue this via the fb tree
> (provided he agrees with the change, of course).
Patch queued for v5.1, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] video/fbdev: refactor video= cmdline parsing
@ 2019-02-08 17:31 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 8+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-02-08 17:31 UTC (permalink / raw)
To: Jani Nikula; +Cc: linux-fbdev, dri-devel
On 01/23/2019 12:12 PM, Jani Nikula wrote:
> On Wed, 23 Jan 2019, Daniel Vetter <daniel@ffwll.ch> wrote:
>> On Wed, Jan 23, 2019 at 11:38:17AM +0200, Jani Nikula wrote:
>>> Make the video_setup() function slightly easier to read by removing the
>>> repeated checks for !global. Remove the misleading return value comment
>>> while at it.
>>>
>>> I'm slightly hesitant to change any of this, but here goes anyway, with
>>> hopes that the next person to have to look at this has it a wee bit
>>> easier.
>>>
>>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>>
>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> Thanks.
>
> Just to be clear, I expect Bartlomiej to queue this via the fb tree
> (provided he agrees with the change, of course).
Patch queued for v5.1, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-02-08 17:31 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-23 9:38 [PATCH] video/fbdev: refactor video= cmdline parsing Jani Nikula
2019-01-23 9:38 ` Jani Nikula
2019-01-23 10:58 ` Daniel Vetter
2019-01-23 10:58 ` Daniel Vetter
2019-01-23 11:12 ` Jani Nikula
2019-01-23 11:12 ` Jani Nikula
2019-02-08 17:31 ` Bartlomiej Zolnierkiewicz
2019-02-08 17:31 ` Bartlomiej Zolnierkiewicz
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.