public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: "Adam J. Richter" <adam@yggdrasil.com>
Cc: tytso@mit.edu, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, axel@hh59.org
Subject: Re: Linux 2.5.30: [SERIAL] build fails at 8250.c
Date: Sat, 3 Aug 2002 00:56:26 +0100	[thread overview]
Message-ID: <20020803005626.D16963@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20020802154924.A5505@baldur.yggdrasil.com>; from adam@yggdrasil.com on Fri, Aug 02, 2002 at 03:49:24PM -0700

On Fri, Aug 02, 2002 at 03:49:24PM -0700, Adam J. Richter wrote:
> 	linux-2.5.30/include/linux/serialP.h needs struct async_icount,
> which is defined in <linux/serial.h>, causing
> linux-2.5.30/drivers/serial/8250.c not to compile, among other problems.
> In linux-2.5.30, you cannot compile a file that includes <linux/serialP.h>
> without including <linux/serial.h>.  So, I think the solution is for
> serialP.h to #include serial.h.  I have attached a patch that does this.

Ack.  I've just found why I and many other people can build it, and
other people can't.  I can tell you that you're building 8250.c as a
module.

Why?

When I build 8250.c into the kernel, linux/module.h doesn't include
linux/version.h, so when we include linux/serialP.h, the compiler
assumes that LINUX_VERSION_CODE is zero.  So we end up including
linux/serial.h.

However, when building as a module, linux/module.h does include
linux/version.h, so when we don't include linux/serial.h.

Oh, the problems of trying to reduce the includes...  I think we should
re-include linux/serial.h and eliminate linux/serialP.h.

Hmm, I wonder how many other oddities like this are in the tree today.
It sounds like we want to create a rule similar to the one for using
CONFIG_* symbols.  Does this sound reasonable: if you use
LINUX_VERSION_CODE, you must include linux/version.h into that very
same file to guarantee that it is defined.

Well, I took checkconfig.pl and created checkversion.pl (attached).
Oh god, can I please put the worms back in the can?  Now?  I think
there's lots of work to do here; lots of stuff including linux/version.h
for the hell of it, and a comparitively small number not including it
when they use LINUX_VERSION_CODE.

(No, I'm just off to zzz, so this must be a nightmare, maybe it'll go
away by the time I wake up later today.) 8/

> 	Ted (or whowever gathers drivers/serial patches for Linus), do
> you want to shepherd this change to Linus, do you want me to submit it
> directly, or do you want to do something else?

It's more a thing for me than Ted.  One of the things I'd like to
do is to eventually kill off serialP.h

Ok, here's a fix for the 8250.c build problem (please don't send it
to Linus; I've other changes that'll be going via BK and patch to
lkml pending):

--- orig/drivers/serial/8250.c	Fri Aug  2 21:13:31 2002
+++ linux/drivers/serial/8250.c	Sat Aug  3 00:28:47 2002
@@ -31,7 +31,8 @@
 #include <linux/console.h>
 #include <linux/sysrq.h>
 #include <linux/serial_reg.h>
-#include <linux/serialP.h>
+#include <linux/circ_buf.h>
+#include <linux/serial.h>
 #include <linux/delay.h>
 
 #include <asm/io.h>
--- orig/drivers/serial/8250.h	Sat Jul 27 13:55:21 2002
+++ linux/drivers/serial/8250.h	Sat Aug  3 00:28:21 2002
@@ -59,3 +59,15 @@
 #else
 #define SERIAL8250_SHARE_IRQS 0
 #endif
+
+#if defined(__alpha__) && !defined(CONFIG_PCI)
+/*
+ * Digital did something really horribly wrong with the OUT1 and OUT2
+ * lines on at least some ALPHA's.  The failure mode is that if either
+ * is cleared, the machine locks up with endless interrupts.
+ */
+#define ALPHA_KLUDGE_MCR  (UART_MCR_OUT2 | UART_MCR_OUT1)
+#else
+#define ALPHA_KLUDGE_MCR 0
+#endif
+


And here's the (hacked up) checkversion.pl script - its used in the same
way as checkconfig.pl in the makefile, so use like this:

$ cd linux
$ find * -name SCCS -prune -o -name BitKeeper -prune -o -name '*.[chS]' \
 -type f -print | sort | xargs perl -w ../checkversion.pl

I'll clean it up _after_ sleep, unless someone doesn't get there first.

#! /usr/bin/perl
#
# checkconfig: find uses of CONFIG_* names without matching definitions.
# Copyright abandoned, 1998, Michael Elizabeth Chastain <mailto:mec@shout.net>.

use integer;

$| = 1;

foreach $file (@ARGV)
{
    # Open this file.
    open(FILE, $file) || die "Can't open $file: $!\n";

    # Initialize variables.
    my $fInComment    = 0;
    my $fInString     = 0;
    my $fUseKernCode  = 0;
    my $iLinuxVersion = 0;

    LINE: while ( <FILE> )
    {
	# Strip comments.
	$fInComment && (s+^.*?\*/+ +o ? ($fInComment = 0) : next);
	m+/\*+o && (s+/\*.*?\*/+ +go, (s+/\*.*$+ +o && ($fInComment = 1)));

	# Pick up definitions.
	if ( m/^\s*#/o )
	{
	    $iLinuxVersion     = $. if m/^\s*#\s*include\s*"linux\/version\.h"/o;
	}

	# Strip strings.
	$fInString && (s+^.*?"+ +o ? ($fInString = 0) : next);
	m+"+o && (s+".*?"+ +go, (s+".*$+ +o && ($fInString = 1)));

	# Pick up definitions.
	if ( m/^\s*#/o )
	{
	    $iLinuxVersion     = $. if m/^\s*#\s*include\s*<linux\/version\.h>/o;
	}

	# Look for usages.
	next unless m/LINUX_VERSION_CODE/o;
	$fUseKernCode = 1;
	last LINE if $iLinuxVersion;
	print "$file: $.: need linux/version.h\n";
	last LINE
    }

    # Report superfluous includes.
    if ( $iLinuxVersion && ! $fUseKernCode )
	{ print "$file: $iLinuxVersion: linux/version.h not needed.\n"; }

    close(FILE);
}


-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


  reply	other threads:[~2002-08-02 23:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-02 22:49 Linux 2.5.30: [SERIAL] build fails at 8250.c Adam J. Richter
2002-08-02 23:56 ` Russell King [this message]
2002-08-03  0:12   ` Russell King
2002-08-03  1:05   ` Kai Germaschewski
  -- strict thread matches above, loose matches on Subject: below --
2002-08-03  8:42 Adam J. Richter
2002-08-03  0:20 Adam J. Richter
2002-08-03  8:05 ` Russell King
2002-08-01 21:30 Linux 2.5.30 Linus Torvalds
2002-08-02  1:25 ` Linux 2.5.30: [SERIAL] build fails at 8250.c Axel Siebenwirth
2002-08-02 17:13   ` Russell King
2002-08-02 19:19     ` Axel Siebenwirth

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=20020803005626.D16963@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=adam@yggdrasil.com \
    --cc=axel@hh59.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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