* [PATCH v2] um: Don't use console_drivers directly
@ 2020-02-12 10:02 Andy Shevchenko
2020-03-12 17:04 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2020-02-12 10:02 UTC (permalink / raw)
To: Jeff Dike, Richard Weinberger, Anton Ivanov, linux-um
Cc: Andy Shevchenko, Thomas Meyer
console_drivers is kind of (semi-)private variable to the console code.
Direct use of it make us stuck with it being exported here and there.
Reduce use of console_drivers by replacing it with for_each_console().
Cc: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: fix condition (we do NOT want to have a console), remove confusing comment
arch/um/kernel/kmsg_dump.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/um/kernel/kmsg_dump.c b/arch/um/kernel/kmsg_dump.c
index 98bdf69e4c2e..e4abac6c9727 100644
--- a/arch/um/kernel/kmsg_dump.c
+++ b/arch/um/kernel/kmsg_dump.c
@@ -9,20 +9,19 @@ static void kmsg_dumper_stdout(struct kmsg_dumper *dumper,
enum kmsg_dump_reason reason)
{
static char line[1024];
-
+ struct console *con;
size_t len = 0;
- bool con_available = false;
/* only dump kmsg when no console is available */
if (!console_trylock())
return;
- if (console_drivers != NULL)
- con_available = true;
+ for_each_console(con)
+ break;
console_unlock();
- if (con_available == true)
+ if (con)
return;
printf("kmsg_dump:\n");
--
2.25.0
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] um: Don't use console_drivers directly
2020-02-12 10:02 [PATCH v2] um: Don't use console_drivers directly Andy Shevchenko
@ 2020-03-12 17:04 ` Andy Shevchenko
2020-03-29 21:34 ` Richard Weinberger
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2020-03-12 17:04 UTC (permalink / raw)
To: Jeff Dike, Richard Weinberger, Anton Ivanov, linux-um; +Cc: Thomas Meyer
On Wed, Feb 12, 2020 at 12:02:59PM +0200, Andy Shevchenko wrote:
> console_drivers is kind of (semi-)private variable to the console code.
> Direct use of it make us stuck with it being exported here and there.
> Reduce use of console_drivers by replacing it with for_each_console().
Any comments?
> Cc: Thomas Meyer <thomas@m3y3r.de>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: fix condition (we do NOT want to have a console), remove confusing comment
> arch/um/kernel/kmsg_dump.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/arch/um/kernel/kmsg_dump.c b/arch/um/kernel/kmsg_dump.c
> index 98bdf69e4c2e..e4abac6c9727 100644
> --- a/arch/um/kernel/kmsg_dump.c
> +++ b/arch/um/kernel/kmsg_dump.c
> @@ -9,20 +9,19 @@ static void kmsg_dumper_stdout(struct kmsg_dumper *dumper,
> enum kmsg_dump_reason reason)
> {
> static char line[1024];
> -
> + struct console *con;
> size_t len = 0;
> - bool con_available = false;
>
> /* only dump kmsg when no console is available */
> if (!console_trylock())
> return;
>
> - if (console_drivers != NULL)
> - con_available = true;
> + for_each_console(con)
> + break;
>
> console_unlock();
>
> - if (con_available == true)
> + if (con)
> return;
>
> printf("kmsg_dump:\n");
> --
> 2.25.0
>
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] um: Don't use console_drivers directly
2020-03-12 17:04 ` Andy Shevchenko
@ 2020-03-29 21:34 ` Richard Weinberger
0 siblings, 0 replies; 3+ messages in thread
From: Richard Weinberger @ 2020-03-29 21:34 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Richard Weinberger, Jeff Dike, linux-um, Thomas Meyer,
Anton Ivanov
On Thu, Mar 12, 2020 at 6:05 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Wed, Feb 12, 2020 at 12:02:59PM +0200, Andy Shevchenko wrote:
> > console_drivers is kind of (semi-)private variable to the console code.
> > Direct use of it make us stuck with it being exported here and there.
> > Reduce use of console_drivers by replacing it with for_each_console().
>
> Any comments?
>
> > Cc: Thomas Meyer <thomas@m3y3r.de>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> > v2: fix condition (we do NOT want to have a console), remove confusing comment
> > arch/um/kernel/kmsg_dump.c | 9 ++++-----
> > 1 file changed, 4 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/um/kernel/kmsg_dump.c b/arch/um/kernel/kmsg_dump.c
> > index 98bdf69e4c2e..e4abac6c9727 100644
> > --- a/arch/um/kernel/kmsg_dump.c
> > +++ b/arch/um/kernel/kmsg_dump.c
> > @@ -9,20 +9,19 @@ static void kmsg_dumper_stdout(struct kmsg_dumper *dumper,
> > enum kmsg_dump_reason reason)
> > {
> > static char line[1024];
> > -
> > + struct console *con;
> > size_t len = 0;
> > - bool con_available = false;
> >
> > /* only dump kmsg when no console is available */
> > if (!console_trylock())
> > return;
> >
> > - if (console_drivers != NULL)
> > - con_available = true;
> > + for_each_console(con)
> > + break;
> >
> > console_unlock();
> >
> > - if (con_available == true)
> > + if (con)
> > return;
> >
> > printf("kmsg_dump:\n");
> > --
Thanks for cleaning this up, applied.
--
Thanks,
//richard
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-29 21:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-12 10:02 [PATCH v2] um: Don't use console_drivers directly Andy Shevchenko
2020-03-12 17:04 ` Andy Shevchenko
2020-03-29 21:34 ` Richard Weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).