Re: [PATCH] BRe: mmapr.c compile problem

Marc Aurele La France <[email protected]>
Newsgroups gmane.comp.xfree86.devel
Message-ID <[email protected]>
On Tue, 5 Apr 2005, Marc Aurele La France wrote:
> On Tue, 5 Apr 2005, Jeff Chua wrote:

>> Here's a patch to fix mmapr.c and mmapw.c so that compile under linux.

>> Thanks,
>> Jeff.
>> [ jchua AT fedex DOT com ]

>> --- xfree86/xc/programs/Xserver/hw/xfree86/etc/mmapr.c.org	Tue Apr  5 
>> 13:58:21 2005
>> +++ xfree86/xc/programs/Xserver/hw/xfree86/etc/mmapr.c	Tue Apr  5 
>> 14:01:16 2005
>> @@ -1,4 +1,4 @@
>> -/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/mmapr.c,v 1.11 2005/03/29 
>> 18:41:45 tsi Exp $ */
>> +/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/mmapr.c,v 1.10 2004/12/31 
>> 16:07:09 tsi Exp $ */
>> /*
>>  * Copyright 2002 through 2005 by Marc Aurele La France (TSI @ UQV), 
>> [email protected]
>>  *
>> @@ -51,12 +51,11 @@
>> #endif
>> 
>> #ifdef linux
>> -# include <sys/ioctl.h>
>> -# include <linux/pci.h>
>> +#include <sys/ioctl.h>
>> 
>> # ifndef PCIIOC_BASE
>>    /* Selected ioctls for /proc/bus/pci/<bus>/<dfn> nodes */
>> -#  define PCIIOC_BASE		(('P') << 24) | ('C' << 16) | ('I' << 
>> 8))
>> +#  define PCIIOC_BASE		(('P' << 24) | ('C' << 16) | ('I' << 
>> 8))
>> 
>>    /* Set mmap state to I/O space */
>> #  define PCIIOC_MMAP_IS_IO	(PCIIOC_BASE | 0x01)
>> @@ -159,6 +158,7 @@
>>                 case 'q':
>>                     Size = sizeof(dataq);
>>                     break;
>> +
>> #ifdef linux
>> 		case 'i':
>> 		    mmap_ioctl = PCIIOC_MMAP_IS_IO;
>> @@ -168,6 +168,7 @@
>> 		    mmap_ioctl = PCIIOC_MMAP_IS_MEM;
>> 		    break;
>> #endif
>> +
>>                 default:
>>                     usage();
>>             }
>> --- /v6/src2/xfree86/xc/programs/Xserver/hw/xfree86/etc/mmapw.c.org	Tue 
>> Apr  5 13:21:33 2005
>> +++ /v6/src2/xfree86/xc/programs/Xserver/hw/xfree86/etc/mmapw.c	Tue 
>> Apr  5 14:02:43 2005
>> @@ -51,7 +51,6 @@
>> 
>> #ifdef linux
>> # include <sys/ioctl.h>
>> -# include <linux/pci.h>
>> 
>> # ifndef PCIIOC_BASE
>>    /* Selected ioctls for /proc/bus/pci/<bus>/<dfn> nodes */

> I agree with the typo fix (blush), but not with the removal of 
> <linux/pci.h>'s inclusion.  Instead try

> 	cd <whereever>/xc/programs/Xserver/hw/xfree86/etc
> 	touch mmap?.c
> 	make EXTRA_DEFINES=-DLINUX_MOD_DEVICETABLE_H mmapr mmapw

> If this works (and it does for me), then this is a kernel bug, introduced in 
> 2.5.62.  Report it there.  <linux/pci.h> should only #include 
> <linux/mod_devicetable.h> when __KERNEL__ is #define'd.

> In the meantime, the work-around for mmap?.c would be to #define 
> LINUX_MOD_DEVICETABLE_H before #include <linux/pci.h>, but that might cause 
> other issues later on.

FWIW, this problem also shows up in linuxPci.c on alpha and sparc64.

Marc.

+----------------------------------+-----------------------------------+
|  Marc Aurele La France           |  work:   1-780-492-9310           |
|  Computing and Network Services  |  fax:    1-780-492-1729           |
|  352 General Services Building   |  email:  [email protected]          |
|  University of Alberta           +-----------------------------------+
|  Edmonton, Alberta               |                                   |
|  T6G 2H1                         |     Standard disclaimers apply    |
|  CANADA                          |                                   |
+----------------------------------+-----------------------------------+
XFree86 developer and VP.  ATI driver and X server internals.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.