mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yinghai Lu" <yinghai@kernel.org>
To: "KOSAKI Motohiro" <kosaki.motohiro@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>, "Ingo Molnar" <mingo@elte.hu>
Subject: Re: [PATCH for -tip 3/4] proc: remove ifdef CONFIG_SPARSE_IRQ from stat.c
Date: Thu, 25 Dec 2008 21:59:56 -0800	[thread overview]
Message-ID: <86802c440812252159v6129a385qb900be42845ac90a@mail.gmail.com> (raw)
In-Reply-To: <20081226141743.5CB5.KOSAKI.MOTOHIRO@jp.fujitsu.com>

On Thu, Dec 25, 2008 at 9:24 PM, KOSAKI Motohiro
<kosaki.motohiro@jp.fujitsu.com> wrote:
>> On Thu, Dec 25, 2008 at 8:21 PM, KOSAKI Motohiro
>> <kosaki.motohiro@jp.fujitsu.com> wrote:
>> >> > Subject: [PATCH] proc: remove ifdef CONFIG_SPARSE_IRQ from stat.c
>> >> > Impact: cleanup
>> >> >
>> >> > introduce irq_inuse() macro and remove ifdef in stat.c
>> >>
>> >> should have a good name... irq_inuse is some confusing.
>> >
>> > Why?
>> > May I ask your perfered name?
>>
>> after freeing msi with dynamic_irq_cleanup(), that irq_desc is not used.
>
> hm, instead, How about following patch?
>
>
>
> =======
> Subject: [PATCH] proc: remove ifdef CONFIG_SPARSE_IRQ from stat.c
> Impact: cleanup
>
> irq_desc can be NULL when CONFIG_SPARSE_IRQ=y only.
> therefore, NULL checking can move into kstat_irqs_cpu() of SPARSE_IRQ version.
>
>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> ---
>  fs/proc/stat.c      |   11 +----------
>  kernel/irq/handle.c |    2 +-
>  2 files changed, 2 insertions(+), 11 deletions(-)
>
> Index: b/fs/proc/stat.c
> ===================================================================
> --- a/fs/proc/stat.c
> +++ b/fs/proc/stat.c
> @@ -9,6 +9,7 @@
>  #include <linux/seq_file.h>
>  #include <linux/slab.h>
>  #include <linux/time.h>
> +#include <linux/irqnr.h>
>  #include <asm/cputime.h>
>
>  #ifndef arch_irq_stat_cpu
> @@ -45,10 +46,6 @@ static int show_stat(struct seq_file *p,
>                steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
>                guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
>                for_each_irq_nr(j) {
> -#ifdef CONFIG_SPARSE_IRQ
> -                       if (!irq_to_desc(j))
> -                               continue;
> -#endif
>                        sum += kstat_irqs_cpu(j, i);
>                }
>                sum += arch_irq_stat_cpu(i);
> @@ -95,12 +92,6 @@ static int show_stat(struct seq_file *p,
>        /* sum again ? it could be updated? */
>        for_each_irq_nr(j) {
>                per_irq_sum = 0;
> -#ifdef CONFIG_SPARSE_IRQ
> -               if (!irq_to_desc(j)) {
> -                       seq_printf(p, " %u", per_irq_sum);
> -                       continue;
> -               }
> -#endif
>                for_each_possible_cpu(i)
>                        per_irq_sum += kstat_irqs_cpu(j, i);
>
> Index: b/kernel/irq/handle.c
> ===================================================================
> --- a/kernel/irq/handle.c
> +++ b/kernel/irq/handle.c
> @@ -445,7 +445,7 @@ void early_init_irq_lock_class(void)
>  unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
>  {
>        struct irq_desc *desc = irq_to_desc(irq);
> -       return desc->kstat_irqs[cpu];
> +       return desc ? desc->kstat_irqs[cpu] : 0;
>  }
>  #endif
>  EXPORT_SYMBOL(kstat_irqs_cpu);
>
>

nice. much clean.

YH

  reply	other threads:[~2008-12-26  6:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-26  3:21 [PATCH for -tip 0/4] various irq cleanups KOSAKI Motohiro
2008-12-26  3:23 ` [PATCH for -tip 1/4] hrtimer: remove #include <linux/irq.h> KOSAKI Motohiro
2008-12-26  3:24 ` [PATCH for -tip 2/4] irq: for_each_irq_desc() move to irqnr.h KOSAKI Motohiro
2008-12-26  3:28 ` [PATCH for -tip 3/4] proc: remove ifdef CONFIG_SPARSE_IRQ from stat.c KOSAKI Motohiro
2008-12-26  4:18   ` Yinghai Lu
2008-12-26  4:21     ` KOSAKI Motohiro
2008-12-26  4:36       ` Yinghai Lu
2008-12-26  5:24         ` KOSAKI Motohiro
2008-12-26  5:59           ` Yinghai Lu [this message]
2008-12-26  8:49             ` Ingo Molnar
2008-12-26  3:29 ` [PATCH for -tip 4/4] irq: for_each_irq_desc() makes simplify KOSAKI Motohiro
2008-12-26  4:23   ` Yinghai Lu
2009-01-01 18:05   ` Raja R Harinath
2009-01-02  5:56     ` KOSAKI Motohiro
2009-01-03 18:11       ` KOSAKI Motohiro
2009-01-07 22:18         ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86802c440812252159v6129a385qb900be42845ac90a@mail.gmail.com \
    --to=yinghai@kernel.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®