Re: [PATCH] Adeos nanokernel for 2.5.38 1/2: no-arch code

Arnaldo Carvalho de Melo (acme@conectiva.com.br)
Mon, 23 Sep 2002 00:03:12 -0300


Em Sun, Sep 22, 2002 at 10:58:57PM -0400, Karim Yaghmour escreveu:
> diff -urpN linux-2.5.38/kernel/printk.c linux-2.5.38-adeos/kernel/printk.c
> --- linux-2.5.38/kernel/printk.c Sun Sep 22 00:25:31 2002
> +++ linux-2.5.38-adeos/kernel/printk.c Sun Sep 22 21:57:19 2002
> @@ -194,17 +194,33 @@ int do_syslog(int type, char * buf, int
> if (error)
> goto out;
> i = 0;
> +#ifdef CONFIG_ADEOS
> + ipipe_hw_spin_lock_disable(&logbuf_lock);
> +#else /* !CONFIG_ADEOS */
> spin_lock_irq(&logbuf_lock);
> +#endif /* CONFIG_ADEOS */
> while ((log_start != log_end) && i < len) {
> c = LOG_BUF(log_start);
> log_start++;
> +#ifdef CONFIG_ADEOS
> + ipipe_hw_spin_unlock_enable(&logbuf_lock);
> +#else /* !CONFIG_ADEOS */
> spin_unlock_irq(&logbuf_lock);
> +#endif /* CONFIG_ADEOS */
> __put_user(c,buf);
> buf++;
> i++;
> +#ifdef CONFIG_ADEOS
> + ipipe_hw_spin_lock_disable(&logbuf_lock);
> +#else /* !CONFIG_ADEOS */
> spin_lock_irq(&logbuf_lock);
> +#endif /* CONFIG_ADEOS */
> }
> +#ifdef CONFIG_ADEOS
> + ipipe_hw_spin_unlock_enable(&logbuf_lock);
> +#else /* !CONFIG_ADEOS */
> spin_unlock_irq(&logbuf_lock);
> +#endif /* CONFIG_ADEOS */
> error = i;

Why this ifdef hell and not something like:

lockbuf_lock();
bla
logbuf_unlock();

and have this defined in a header, say printk.h or whatever, with the
ifdefs?

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