lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081113095345.GM25479@elte.hu>
Date:	Thu, 13 Nov 2008 10:53:45 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Yinghai Lu <yinghai@...nel.org>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sparse_irq aka dyn_irq v13


* Yinghai Lu <yinghai@...nel.org> wrote:

> reduce the #ifdef numbers

> Index: linux-2.6/arch/x86/include/asm/hpet.h
> ===================================================================
> --- linux-2.6.orig/arch/x86/include/asm/hpet.h
> +++ linux-2.6/arch/x86/include/asm/hpet.h
> @@ -72,8 +72,15 @@ extern void hpet_disable(void);
>  extern unsigned long hpet_readl(unsigned long a);
>  extern void force_hpet_resume(void);
>  
> +#ifdef CONFIG_SPARSE_IRQ
> +extern void hpet_msi_unmaskx(unsigned int irq, struct irq_desc **descp);
> +extern void hpet_msi_maskx(unsigned int irq, struct irq_desc **descp);
> +#define hpet_msi_unmask hpet_msi_unmaskx
> +#define hpet_msi_mask hpet_msi_maskx
> +#else
>  extern void hpet_msi_unmask(unsigned int irq);
>  extern void hpet_msi_mask(unsigned int irq);
> +#endif
>  extern void hpet_msi_write(unsigned int irq, struct msi_msg *msg);
>  extern void hpet_msi_read(unsigned int irq, struct msi_msg *msg);

please use inlines instead of #define's.

> Index: linux-2.6/arch/x86/kernel/hpet.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/hpet.c
> +++ linux-2.6/arch/x86/kernel/hpet.c
> @@ -347,7 +347,7 @@ static int hpet_legacy_next_event(unsign
>  static DEFINE_PER_CPU(struct hpet_dev *, cpu_hpet_dev);
>  static struct hpet_dev	*hpet_devs;
>  
> -void hpet_msi_unmask(unsigned int irq)
> +void hpet_msi_unmaskx(unsigned int irq, struct irq_desc **descp)
>  {
>  	struct hpet_dev *hdev = get_irq_data(irq);
>  	unsigned long cfg;
> @@ -358,7 +358,7 @@ void hpet_msi_unmask(unsigned int irq)
>  	hpet_writel(cfg, HPET_Tn_CFG(hdev->num));
>  }
>  
> -void hpet_msi_mask(unsigned int irq)
> +void hpet_msi_maskx(unsigned int irq, struct irq_desc **descp)

please name it hpet_msi_mask_desc() - 'maskx' sounds quirky.

>  {
>  	unsigned long cfg;
>  	struct hpet_dev *hdev = get_irq_data(irq);
> @@ -369,6 +369,21 @@ void hpet_msi_mask(unsigned int irq)
>  	hpet_writel(cfg, HPET_Tn_CFG(hdev->num));
>  }
>  
> +#ifndef CONFIG_SPARSE_IRQ
> +void hpet_msi_unmask(unsigned int irq)
> +{
> +	struct irq_desc *desc = irq_to_desc(irq);
> +
> +	hpet_msi_unmaskx(irq, &desc);
> +}
> +void hpet_msi_mask(unsigned int irq)
> +{
> +	struct irq_desc *desc = irq_to_desc(irq);
> +
> +	hpet_msi_maskx(irq, &desc);
> +}
> +#endif
> +
>  void hpet_msi_write(unsigned int irq, struct msi_msg *msg)
>  {
>  	struct hpet_dev *hdev = get_irq_data(irq);

it still looks ugly to me: couldnt we make it completely #ifdef-free, 
by just adding the new API variants?

i.e. leave these present unconditionally:

>  extern void hpet_msi_unmask(unsigned int irq);
>  extern void hpet_msi_mask(unsigned int irq);

and just _add_ these (unconditionally):

> +extern void hpet_msi_unmask_desc(unsigned int irq, struct irq_desc **descp);
> +extern void hpet_msi_mask_desc(unsigned int irq, struct irq_desc **descp);

that gives us zero #ifdefs and much nicer to read patches. Am i 
missing something why this isnt possible?

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ