Is the PCI serial driver code GPL v2 or v3
I notice that many of the files that make up the serial driver are licensed as "either version 2 of the License, or (at your option) any later version". Unfortunatley, I would like to use some of the code from `drivers/serial/8250_pci.c' in grub2, which is a GPL v3 project, but the copyright for this file says:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
The either' in that sentence would lead me to believe that there was a typo and the or later' clause was dropped off but, as it stands, it's just bad English that says version 2 only.
Anyone know what the true intent was and how to resolve this?
Signature · 4 lines
Don Dugger "Censeo Toto nos in Kansa esse decisse." - D. Gale [email protected] Ph: 303/443-3786
Quoted 12 lines · On Thursday 06 November 2008, [email protected] wrote:
I notice that many of the files that make up the serial driver are licensed as "either version 2 of the License, or (at your option) any later version". Unfortunatley, I would like to use some of the code from `drivers/serial/8250_pci.c' in grub2, which is a GPL v3 project, but the copyright for this file says:
* This program is free software; you can redistribute it and/or
modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License.
Quoted 5 lines
The
either' in that sentence would lead me to believe that there was a typo and theor later' clause was dropped off but, as it stands, it's just bad English that says version 2 only.Anyone know what the true intent was and how to resolve this?
It seems like a typo to me to.. That wording has been constant since the file drivers/serial/serial_8250_pci.c was created based on work in drivers/char/serial.c:
http://git.kernel.org/?p=linux/kernel/git/tglx/history.git;a=commitdiff;h=33c0d1b0c3ebb61243d9b19ce70d9063acff2aacserial_8250.c has the "or later" clause there.
But I suppose the best way is to ask the originator of that file. Russell, what say you?
Did you mean to license that file under GPL-2 or GPL-2+?
Signature · 1 line
/PA
Quoted 9 lines · Peter Alfredsen
It seems like a typo to me to.. That wording has been constant since the file
drivers/serial/serial_8250_pci.cwas created based on work indrivers/char/serial.c:
http://git.kernel.org/?p=linux/kernel/git/tglx/history.git;a=commitdiff;h=33c0d1b0c3ebb61243d9b19ce70d9063acff2aacserial_8250.chas the "or later" clause there.But I suppose the best way is to ask the originator of that file. Russell, what say you?
Did you mean to license that file under GPL-2 or GPL-2+?
It was based upon the original serial.c by Ted T'so, but with some reworking to add a separate quirks table, and quite a number of cleanups.
My personal position is that code I author is GPLv2, and not GPLv2 or later. So it's a question whether you consider that I'm the author of the code in that file, or whether you think it's Ted's with my contributions were under Ted's original terms.
BTW, now that you bring this to my attention, I see this hack in there:
struct serial_private *pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board)
{
if (dev->vendor == PCI_VENDOR_ID_OXSEMI ||
dev->vendor == PCI_VENDOR_ID_MAINPINE)
pci_oxsemi_tornado_init(dev, board);
nr_ports = board->num_ports;It's completely unnecessary with the quirk system, which follows these lines:
/*
* Run the new-style initialization function.
* The initialization function returns:
* <0 - error
* 0 - use board->num_ports
* >0 - number of ports
*/
if (quirk->init) {
rc = quirk->init(dev);
if (rc < 0) {
priv = ERR_PTR(rc);
goto err_out;
}
if (rc)
nr_ports = rc;
}So, why they couldn't add a quirk where the init function returns the number of ports, instead of modifying some random board structure and possibly upsetting future allocations is beyond me.
We now have the situation, again, where some random entry in the pci_boards array is being modified which could trip up a future board registration.
This is plainly idiotic and utterly buggy.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of:
Quoted 7 lines · Russell King
It was based upon the original
serial.cby Ted T'so, but with some reworking to add a separate quirks table, and quite a number of cleanups.My personal position is that code I author is GPLv2, and not GPLv2 or later. So it's a question whether you consider that I'm the author of the code in that file, or whether you think it's Ted's with my contributions were under Ted's original terms.
My personal opinion has also always been GPLv2, and not GPLv2 or later. So I'm a bit puzzled as to where the GPLV2+ language came from....
- Ted
(Sorry for the top-post, but Outlook is a pain...)
The "hack" originates from code done by Oxford Semiconductor. I would be happy to have it done with the quirk system, and I am willing to write a patch to that effect. My guess, however, would be that I'll still not do it in your favorite way, and so I'm asking if you would like me to write the code change or will you (or someone else here familiar with the favorite ways) do it?
For what it's worth, I have tested 2.6.28-rc3 and it works vanilla with this hardware. :-)
Thanks,
Lee.
Lee Howard
Mainpine, Inc. Software Development Lead
Tel: +1 866 363 6680 ext 805 | Fax: +1 360 462 8160 [email protected] | www.mainpine.com
-----Original Message-----
From: Russell King [mailto:[email protected]] On Behalf Of Russell King
Sent: Thursday, November 06, 2008 11:13 AM
To: Peter Alfredsen; Alan Cox; Lee Howard
Cc: [email protected]
Subject: Re: Is the PCI serial driver code GPL v2 or v3
BTW, now that you bring this to my attention, I see this hack in there:
struct serial_private *
pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board) {
if (dev->vendor == PCI_VENDOR_ID_OXSEMI ||
dev->vendor == PCI_VENDOR_ID_MAINPINE)
pci_oxsemi_tornado_init(dev, board);
nr_ports = board->num_ports;It's completely unnecessary with the quirk system, which follows these lines:
/*
* Run the new-style initialization function.
* The initialization function returns:
* <0 - error
* 0 - use board->num_ports
* >0 - number of ports
*/
if (quirk->init) {
rc = quirk->init(dev);
if (rc < 0) {
priv = ERR_PTR(rc);
goto err_out;
}
if (rc)
nr_ports = rc;
}So, why they couldn't add a quirk where the init function returns the number of ports, instead of modifying some random board structure and possibly upsetting future allocations is beyond me.
We now have the situation, again, where some random entry in the pci_boards array is being modified which could trip up a future board registration.
This is plainly idiotic and utterly buggy.
Quoted 6 lines · Lee Howard
The "hack" originates from code done by Oxford Semiconductor. I would be happy to have it done with the quirk system, and I am willing to write a patch to that effect. My guess, however, would be that I'll still not do it in your favorite way, and so I'm asking if you would like me to write the code change or will you (or someone else here familiar with the favorite ways) do it?
There's plenty of examples in there, eg, pci_timedia_init, pci_netmos_init, and pci_ite887x_init all have a variable number of ports. Here's a patch which converts it:
drivers/serial/8250_pci.c +51 -40
@@ -737,6 +737,38 @@ static void __devexit pci_ite887x_exit(struct pci_dev *dev)release_region (ioport, ITE_887x_IOSIZE); } +/* +* Oxford Semiconductor Inc. +* Check that device is part of the Tornado range of devices, then determine +* the number of ports available on the device. +*/ +static int pci_oxsemi_tornado_init (struct pci_dev *dev) +{ +u8 __iomem *p; +unsigned long deviceID; +unsigned int number_uarts =0 ; + +/* OxSemi Tornado devices are all 0xCxxx */ +if (dev->vendor ==PCI_VENDOR_ID_OXSEMI && + (dev->device &0xF000 ) !=0xC000 ) +return 0 ; + + p =pci_iomap (dev,0 ,5 ); +if (p ==NULL ) +return -ENOMEM ; + + deviceID =ioread32 (p); +/* Tornado device */ +if (deviceID ==0x07000200 ) { + number_uarts =ioread8 (p +4 ); +printk (KERN_DEBUG +"%d ports detected on Oxford PCI Express device\n" , + number_uarts); + } +pci_iounmap (dev, p); +return number_uarts; +} +static int pci_default_setup (struct serial_private *priv,struct pciserial_board *board,struct uart_port *port,int idx)
@@ -1018,6 +1050,25 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { .setup = pci_default_setup, },/* +* For Oxford Semiconductor and Mainpine +*/ + { + .vendor = PCI_VENDOR_ID_OXSEMI, + .device = PCI_ANY_ID, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_default_setup, + }, + { + .vendor = PCI_VENDOR_ID_MAINPINE, + .device = PCI_ANY_ID, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_default_setup, + }, + /* * Default "match everything" terminator entry */ {
@@ -1854,39 +1905,6 @@ serial_pci_matches(struct pciserial_board *board, board->first_offset == guessed->first_offset; } -/* -* Oxford Semiconductor Inc. -* Check that device is part of the Tornado range of devices, then determine -* the number of ports available on the device. -*/ -static int pci_oxsemi_tornado_init (struct pci_dev *dev,struct pciserial_board *board) -{ -u8 __iomem *p; -unsigned long deviceID; -unsigned int number_uarts; - -/* OxSemi Tornado devices are all 0xCxxx */ -if (dev->vendor ==PCI_VENDOR_ID_OXSEMI && - (dev->device &0xF000 ) !=0xC000 ) -return 0 ; - - p =pci_iomap (dev,0 ,5 ); -if (p ==NULL ) -return -ENOMEM ; - - deviceID =ioread32 (p); -/* Tornado device */ -if (deviceID ==0x07000200 ) { - number_uarts =ioread8 (p +4 ); - board->num_ports = number_uarts; -printk (KERN_DEBUG -"%d ports detected on Oxford PCI Express device\n" , - number_uarts); - } -pci_iounmap (dev, p); -return 0 ; -} -struct serial_private *pciserial_init_ports (struct pci_dev *dev,struct pciserial_board *board) {
@@ -1895,13 +1913,6 @@ pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board)struct pci_serial_quirk *quirk;int rc, nr_ports, i; -/* -* Find number of ports on board -*/ -if (dev->vendor ==PCI_VENDOR_ID_OXSEMI || - dev->vendor ==PCI_VENDOR_ID_MAINPINE ) -pci_oxsemi_tornado_init (dev, board); - nr_ports = board->num_ports;/*
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of:
Quoted 11 lines · Russell King
Quoted 6 lines · Lee Howard
The "hack" originates from code done by Oxford Semiconductor. I would be happy to have it done with the quirk system, and I am willing to write a patch to that effect. My guess, however, would be that I'll still not do it in your favorite way, and so I'm asking if you would like me to write the code change or will you (or someone else here familiar with the favorite ways) do it?
There's plenty of examples in there, eg,
pci_timedia_init,pci_netmos_init, andpci_ite887x_initall have a variable number of ports. Here's a patch which converts it:
And here's a patch (to be applied on top of the last) which prevents this happening again by making use of 'const'.
drivers/serial/8250_pci.c +21 -16
@@ -42,7 +42,8 @@u32 subvendor;u32 subdevice;int (*init)(struct pci_dev *dev); -int (*setup)(struct serial_private *,struct pciserial_board *, +int (*setup)(struct serial_private *, +const struct pciserial_board *,struct uart_port *,int );void (*exit)(struct pci_dev *dev); };
@@ -107,7 +108,7 @@* ADDI-DATA GmbH communication cards <[email protected]> */ static int addidata_apci7800_setup (struct serial_private *priv, -struct pciserial_board *board, +const struct pciserial_board *board,struct uart_port *port,int idx) {unsigned int bar =0 , offset = board->first_offset;
@@ -134,7 +135,7 @@* Not that ugly ;) -- HW */ static int -afavlab_setup (struct serial_private *priv,struct pciserial_board *board, +afavlab_setup (struct serial_private *priv,const struct pciserial_board *board,struct uart_port *port,int idx) {unsigned int bar, offset = board->first_offset;
@@ -188,8 +189,9 @@* some serial ports are supposed to be hidden on certain models. */ static int -pci_hp_diva_setup (struct serial_private *priv,struct pciserial_board *board, -struct uart_port *port,int idx) +pci_hp_diva_setup (struct serial_private *priv, +const struct pciserial_board *board, +struct uart_port *port,int idx) {unsigned int offset = board->first_offset;unsigned int bar =FL_GET_BASE (board->flags);
@@ -306,7 +308,7 @@/* SBS Technologies Inc. PMC-OCTPRO and P-OCTAL cards */ static int -sbs_setup (struct serial_private *priv,struct pciserial_board *board, +sbs_setup (struct serial_private *priv,const struct pciserial_board *board,struct uart_port *port,int idx) {unsigned int bar, offset = board->first_offset;
@@ -463,7 +465,7 @@ }static int pci_siig_setup (struct serial_private *priv, -struct pciserial_board *board, +const struct pciserial_board *board,struct uart_port *port,int idx) {unsigned int bar =FL_GET_BASE (board->flags) + idx, offset =0 ;
@@ -534,7 +536,8 @@* Ugh, this is ugly as all hell --- TYT */ static int -pci_timedia_setup (struct serial_private *priv,struct pciserial_board *board, +pci_timedia_setup (struct serial_private *priv, +const struct pciserial_board *board,struct uart_port *port,int idx) {unsigned int bar =0 , offset = board->first_offset;
@@ -568,7 +571,7 @@*/ static int titan_400l_800l_setup (struct serial_private *priv, -struct pciserial_board *board, +const struct pciserial_board *board,struct uart_port *port,int idx) {unsigned int bar, offset = board->first_offset;
@@ -770,7 +773,8 @@ }static int -pci_default_setup (struct serial_private *priv,struct pciserial_board *board, +pci_default_setup (struct serial_private *priv, +const struct pciserial_board *board,struct uart_port *port,int idx) {unsigned int bar, offset = board->first_offset, maxnr;
@@ -1099,7 +1103,7 @@ }static inline int get_pci_irq (struct pci_dev *dev, -struct pciserial_board *board) +const struct pciserial_board *board) {if (board->flags &FL_NOIRQ )return 0 ;
@@ -1894,8 +1898,8 @@ }static inline int -serial_pci_matches (struct pciserial_board *board, -struct pciserial_board *guessed) +serial_pci_matches (const struct pciserial_board *board, +const struct pciserial_board *guessed) {return board->num_ports == guessed->num_ports &&
@@ -1906,7 +1910,7 @@ }struct serial_private * -pciserial_init_ports (struct pci_dev *dev,struct pciserial_board *board) +pciserial_init_ports (struct pci_dev *dev,const struct pciserial_board *board) {struct uart_port serial_port;struct serial_private *priv;
@@ -2039,7 +2043,8 @@ pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent) { struct serial_private *priv; -struct pciserial_board *board, tmp; +const struct pciserial_board *board; +struct pciserial_board tmp;int rc;if (ent->driver_data >=ARRAY_SIZE (pci_boards)) {
@@ -2066,7 +2071,7 @@* We matched one of our class entries. Try to * determine the parameters of this board. */ - rc =serial_pci_guess_board (dev, board); + rc =serial_pci_guess_board (dev, &tmp);if (rc) goto disable; }else {
only in patch2:
unchanged:
include/linux/8250_pci.h +1 -1
@@ -31,7 +31,7 @@ struct pciserial_board {struct serial_private ;struct serial_private * -pciserial_init_ports (struct pci_dev *dev,struct pciserial_board *board); +pciserial_init_ports (struct pci_dev *dev,const struct pciserial_board *board);void pciserial_remove_ports (struct serial_private *priv);void pciserial_suspend_ports (struct serial_private *priv);void pciserial_resume_ports (struct serial_private *priv);
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of:
This works for me. Do I need to do anything else to see this committed?
Thank you,
Lee.
Lee Howard
Mainpine, Inc. Software Development Lead
Tel: +1 866 363 6680 ext 805 | Fax: +1 360 462 8160 [email protected] | www.mainpine.com
-----Original Message-----
From: Russell King [mailto:[email protected]] On Behalf Of Russell King
Sent: Thursday, November 06, 2008 12:15 PM
To: Lee Howard
Cc: 'Peter Alfredsen'; 'Alan Cox'; [email protected]
Subject: Re: Is the PCI serial driver code GPL v2 or v3
Quoted 7 lines · Lee Howard
The "hack" originates from code done by Oxford Semiconductor. I would be happy to have it done with the quirk system, and I am willing to write a patch to that effect. My guess, however, would be that I'll still not do it in your favorite way, and so I'm asking if you would like me to write the code change or will you (or someone else here familiar with the favorite
ways) do it?
There's plenty of examples in there, eg, pci_timedia_init, pci_netmos_init, and pci_ite887x_init all have a variable number of ports. Here's a patch which converts it:
drivers/serial/8250_pci.c index renamed from drivers/serial/8250_pci.c +0 -0
5450a0e..057b532 100644
drivers/serial/8250_pci.c +0 -0
@@ -737,6 +737,38 @@ static void __devexit pci_ite887x_exit(struct pci_dev
*dev)
release_region(ioport, ITE_887x_IOSIZE); }
+/*
+ * Oxford Semiconductor Inc.
+ * Check that device is part of the Tornado range of devices, then +determine
+ * the number of ports available on the device.
+ */
+static int pci_oxsemi_tornado_init(struct pci_dev *dev) {
+ u8 __iomem *p;
+ unsigned long deviceID;
+ unsigned int number_uarts = 0;
+
+ /* OxSemi Tornado devices are all 0xCxxx */
+ if (dev->vendor == PCI_VENDOR_ID_OXSEMI &&
+ (dev->device & 0xF000) != 0xC000)
+ return 0;
+
+ p = pci_iomap(dev, 0, 5);
+ if (p == NULL)
+ return -ENOMEM;
+
+ deviceID = ioread32(p);
+ /* Tornado device */
+ if (deviceID == 0x07000200) {
+ number_uarts = ioread8(p + 4);
+ printk(KERN_DEBUG
+ "%d ports detected on Oxford PCI Express device\n",
+number_uarts);
+ }
+ pci_iounmap(dev, p);
+ return number_uarts;
+}
+
static int
pci_default_setup(struct serial_private *priv, struct pciserial_board
*board,
struct uart_port *port, int idx)
@@ -1018,6 +1050,25 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
.setup = pci_default_setup,
},
/*
+ * For Oxford Semiconductor and Mainpine
+ */
+ {
+ .vendor = PCI_VENDOR_ID_OXSEMI,
+ .device = PCI_ANY_ID,
+ .subvendor = PCI_ANY_ID,
+ .subdevice = PCI_ANY_ID,
+ .init = pci_oxsemi_tornado_init,
+ .setup = pci_default_setup,
+ },
+ {
+ .vendor = PCI_VENDOR_ID_MAINPINE,
+ .device = PCI_ANY_ID,
+ .subvendor = PCI_ANY_ID,
+ .subdevice = PCI_ANY_ID,
+ .init = pci_oxsemi_tornado_init,
+ .setup = pci_default_setup,
+ },
+ /*
* Default "match everything" terminator entry
*/
{
@@ -1854,39 +1905,6 @@ serial_pci_matches(struct pciserial_board *board,
board->first_offset == guessed->first_offset; }
-/*
- * Oxford Semiconductor Inc.
- * Check that device is part of the Tornado range of devices, then determine
- * the number of ports available on the device.
- */
-static int pci_oxsemi_tornado_init(struct pci_dev *dev, struct pciserial_board *board) -{
- u8 __iomem *p;
- unsigned long deviceID;
- unsigned int number_uarts;
-
- /* OxSemi Tornado devices are all 0xCxxx */
- if (dev->vendor == PCI_VENDOR_ID_OXSEMI &&
- (dev->device & 0xF000) != 0xC000)
- return 0;
-
- p = pci_iomap(dev, 0, 5);
- if (p == NULL)
- return -ENOMEM;
-
- deviceID = ioread32(p);
- /* Tornado device */
- if (deviceID == 0x07000200) {
- number_uarts = ioread8(p + 4);
- board->num_ports = number_uarts;
- printk(KERN_DEBUG
- "%d ports detected on Oxford PCI Express device\n",
-number_uarts);
- }
- pci_iounmap(dev, p);
- return 0;
-}
-
struct serial_private *
pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board) {
@@ -1895,13 +1913,6 @@ pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board)
struct pci_serial_quirk *quirk;
int rc, nr_ports, i;
- /*
- * Find number of ports on board
- */
- if (dev->vendor == PCI_VENDOR_ID_OXSEMI ||
- dev->vendor == PCI_VENDOR_ID_MAINPINE)
- pci_oxsemi_tornado_init(dev, board);
-
nr_ports = board->num_ports;
/*
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
Quoted 11 lines · On Thu, 6 Nov 2008 20:15:01 +0000 Russell King <[email protected]>…
Quoted 6 lines · Lee Howard
The "hack" originates from code done by Oxford Semiconductor. I would be happy to have it done with the quirk system, and I am willing to write a patch to that effect. My guess, however, would be that I'll still not do it in your favorite way, and so I'm asking if you would like me to write the code change or will you (or someone else here familiar with the favorite ways) do it?
There's plenty of examples in there, eg,
pci_timedia_init,pci_netmos_init, andpci_ite887x_initall have a variable number of ports. Here's a patch which converts it:
Looks good to me but needs a Signed-off-by: line
Alan
Quoted 1 line · Alan Cox
Looks good to me but needs a Signed-off-by: line
... found this mail again ... for both patches:
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of:
Quoted 11 lines · Russell King
Quoted 9 lines · Peter Alfredsen
It seems like a typo to me to.. That wording has been constant since the file
drivers/serial/serial_8250_pci.cwas created based on work indrivers/char/serial.c:
http://git.kernel.org/?p=linux/kernel/git/tglx/history.git;a=commitdiff;h=33c0d1b0c3ebb61243d9b19ce70d9063acff2aacserial_8250.chas the "or later" clause there.But I suppose the best way is to ask the originator of that file. Russell, what say you?
Did you mean to license that file under GPL-2 or GPL-2+?
Quoted 7 lines
It was based upon the original
serial.cby Ted T'so, but with some reworking to add a separate quirks table, and quite a number of cleanups.My personal position is that code I author is GPLv2, and not GPLv2 or later. So it's a question whether you consider that I'm the author of the code in that file, or whether you think it's Ted's with my contributions were under Ted's original terms.
Original poster wants GPLv3 version for use in grub-2. Would you be willing to relicense your changes in serial_8250.c, so that he can do that? Would Ted be willing to do that?
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 11 lines · Pavel Machek
Quoted 7 lines
It was based upon the original
serial.cby Ted T'so, but with some reworking to add a separate quirks table, and quite a number of cleanups.My personal position is that code I author is GPLv2, and not GPLv2 or later. So it's a question whether you consider that I'm the author of the code in that file, or whether you think it's Ted's with my contributions were under Ted's original terms.
Original poster wants GPLv3 version for use in grub-2. Would you be willing to relicense your changes in
serial_8250.c, so that he can do that? Would Ted be willing to do that?
I'd much rather have grub-2 relicense itself to GPLv2. :-)
- Ted