Re: [PATCH] Allow arch to veto PC speaker beeper initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul Mackerras <[email protected]> wrote:
>
> Index: linux-2.6/drivers/input/misc/pcspkr.c
> ===================================================================
> --- linux-2.6.orig/drivers/input/misc/pcspkr.c	2005-10-31 15:16:39.000000000 +1100
> +++ linux-2.6/drivers/input/misc/pcspkr.c	2005-10-31 15:21:13.000000000 +1100
> @@ -66,6 +66,11 @@
>  
>  static int __init pcspkr_init(void)
>  {
> +#ifdef HAS_PCSPKR_ARCH_INIT
> +	int rc = pcspkr_arch_init();
> +	if (rc)
> +		return rc;
> +#endif
>  	pcspkr_dev = input_allocate_device();
>  	if (!pcspkr_dev)
>  		return -ENOMEM;
> Index: linux-2.6/include/asm-powerpc/8253pit.h
> ===================================================================
> --- linux-2.6.orig/include/asm-powerpc/8253pit.h	2005-10-31 15:02:18.000000000 +1100
> +++ linux-2.6/include/asm-powerpc/8253pit.h	2005-10-31 15:20:30.000000000 +1100
> @@ -5,6 +5,19 @@
>   * 8253/8254 Programmable Interval Timer
>   */
>  
> +#include <asm/prom.h>
> +
>  #define PIT_TICK_RATE	1193182UL
>  
> +#define HAS_PCSPKR_ARCH_INIT
> +
> +static inline int pcspkr_arch_init(void)
> +{
> +	struct device_node *np;
> +
> +	np = of_find_compatible_node(NULL, NULL, "pnpPNP,100");
> +	of_node_put(np);
> +	return np ? 0 : -ENODEV;
> +}
> +
>  #endif	/* _ASM_POWERPC_8253PIT_H */

We can avoid all the ifdef nasties by adding

static int pcspkr_arch_init(void) __attribute__((weak))
{
	return 0;
}

in pcspkr.c.

It'll bloat the kernel by a few bytes.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux