diff options
author | Russell King <rmk+lkml@arm.linux.org.uk> | 2009-01-02 08:44:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-02 13:19:37 -0500 |
commit | 975a1a7d887048d4afc9201383e11b7af991866b (patch) | |
tree | 968fc20c260ae529c53f1a3ddd8dbae43536cf45 /drivers/serial/8250_pci.c | |
parent | 9f2a036aaac8f29bb7c68303b52a9263238b63d2 (diff) |
And here's a patch (to be applied on top of the last) which prevents
this happening again by making use of 'const'.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial/8250_pci.c')
-rw-r--r-- | drivers/serial/8250_pci.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 057b532ccaad..0b794138f686 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -42,7 +42,8 @@ struct pci_serial_quirk { | |||
42 | u32 subvendor; | 42 | u32 subvendor; |
43 | u32 subdevice; | 43 | u32 subdevice; |
44 | int (*init)(struct pci_dev *dev); | 44 | int (*init)(struct pci_dev *dev); |
45 | int (*setup)(struct serial_private *, struct pciserial_board *, | 45 | int (*setup)(struct serial_private *, |
46 | const struct pciserial_board *, | ||
46 | struct uart_port *, int); | 47 | struct uart_port *, int); |
47 | void (*exit)(struct pci_dev *dev); | 48 | void (*exit)(struct pci_dev *dev); |
48 | }; | 49 | }; |
@@ -107,7 +108,7 @@ setup_port(struct serial_private *priv, struct uart_port *port, | |||
107 | * ADDI-DATA GmbH communication cards <info@addi-data.com> | 108 | * ADDI-DATA GmbH communication cards <info@addi-data.com> |
108 | */ | 109 | */ |
109 | static int addidata_apci7800_setup(struct serial_private *priv, | 110 | static int addidata_apci7800_setup(struct serial_private *priv, |
110 | struct pciserial_board *board, | 111 | const struct pciserial_board *board, |
111 | struct uart_port *port, int idx) | 112 | struct uart_port *port, int idx) |
112 | { | 113 | { |
113 | unsigned int bar = 0, offset = board->first_offset; | 114 | unsigned int bar = 0, offset = board->first_offset; |
@@ -134,7 +135,7 @@ static int addidata_apci7800_setup(struct serial_private *priv, | |||
134 | * Not that ugly ;) -- HW | 135 | * Not that ugly ;) -- HW |
135 | */ | 136 | */ |
136 | static int | 137 | static int |
137 | afavlab_setup(struct serial_private *priv, struct pciserial_board *board, | 138 | afavlab_setup(struct serial_private *priv, const struct pciserial_board *board, |
138 | struct uart_port *port, int idx) | 139 | struct uart_port *port, int idx) |
139 | { | 140 | { |
140 | unsigned int bar, offset = board->first_offset; | 141 | unsigned int bar, offset = board->first_offset; |
@@ -188,8 +189,9 @@ static int pci_hp_diva_init(struct pci_dev *dev) | |||
188 | * some serial ports are supposed to be hidden on certain models. | 189 | * some serial ports are supposed to be hidden on certain models. |
189 | */ | 190 | */ |
190 | static int | 191 | static int |
191 | pci_hp_diva_setup(struct serial_private *priv, struct pciserial_board *board, | 192 | pci_hp_diva_setup(struct serial_private *priv, |
192 | struct uart_port *port, int idx) | 193 | const struct pciserial_board *board, |
194 | struct uart_port *port, int idx) | ||
193 | { | 195 | { |
194 | unsigned int offset = board->first_offset; | 196 | unsigned int offset = board->first_offset; |
195 | unsigned int bar = FL_GET_BASE(board->flags); | 197 | unsigned int bar = FL_GET_BASE(board->flags); |
@@ -306,7 +308,7 @@ static void __devexit pci_plx9050_exit(struct pci_dev *dev) | |||
306 | 308 | ||
307 | /* SBS Technologies Inc. PMC-OCTPRO and P-OCTAL cards */ | 309 | /* SBS Technologies Inc. PMC-OCTPRO and P-OCTAL cards */ |
308 | static int | 310 | static int |
309 | sbs_setup(struct serial_private *priv, struct pciserial_board *board, | 311 | sbs_setup(struct serial_private *priv, const struct pciserial_board *board, |
310 | struct uart_port *port, int idx) | 312 | struct uart_port *port, int idx) |
311 | { | 313 | { |
312 | unsigned int bar, offset = board->first_offset; | 314 | unsigned int bar, offset = board->first_offset; |
@@ -463,7 +465,7 @@ static int pci_siig_init(struct pci_dev *dev) | |||
463 | } | 465 | } |
464 | 466 | ||
465 | static int pci_siig_setup(struct serial_private *priv, | 467 | static int pci_siig_setup(struct serial_private *priv, |
466 | struct pciserial_board *board, | 468 | const struct pciserial_board *board, |
467 | struct uart_port *port, int idx) | 469 | struct uart_port *port, int idx) |
468 | { | 470 | { |
469 | unsigned int bar = FL_GET_BASE(board->flags) + idx, offset = 0; | 471 | unsigned int bar = FL_GET_BASE(board->flags) + idx, offset = 0; |
@@ -534,7 +536,8 @@ static int pci_timedia_init(struct pci_dev *dev) | |||
534 | * Ugh, this is ugly as all hell --- TYT | 536 | * Ugh, this is ugly as all hell --- TYT |
535 | */ | 537 | */ |
536 | static int | 538 | static int |
537 | pci_timedia_setup(struct serial_private *priv, struct pciserial_board *board, | 539 | pci_timedia_setup(struct serial_private *priv, |
540 | const struct pciserial_board *board, | ||
538 | struct uart_port *port, int idx) | 541 | struct uart_port *port, int idx) |
539 | { | 542 | { |
540 | unsigned int bar = 0, offset = board->first_offset; | 543 | unsigned int bar = 0, offset = board->first_offset; |
@@ -568,7 +571,7 @@ pci_timedia_setup(struct serial_private *priv, struct pciserial_board *board, | |||
568 | */ | 571 | */ |
569 | static int | 572 | static int |
570 | titan_400l_800l_setup(struct serial_private *priv, | 573 | titan_400l_800l_setup(struct serial_private *priv, |
571 | struct pciserial_board *board, | 574 | const struct pciserial_board *board, |
572 | struct uart_port *port, int idx) | 575 | struct uart_port *port, int idx) |
573 | { | 576 | { |
574 | unsigned int bar, offset = board->first_offset; | 577 | unsigned int bar, offset = board->first_offset; |
@@ -770,7 +773,8 @@ static int pci_oxsemi_tornado_init(struct pci_dev *dev) | |||
770 | } | 773 | } |
771 | 774 | ||
772 | static int | 775 | static int |
773 | pci_default_setup(struct serial_private *priv, struct pciserial_board *board, | 776 | pci_default_setup(struct serial_private *priv, |
777 | const struct pciserial_board *board, | ||
774 | struct uart_port *port, int idx) | 778 | struct uart_port *port, int idx) |
775 | { | 779 | { |
776 | unsigned int bar, offset = board->first_offset, maxnr; | 780 | unsigned int bar, offset = board->first_offset, maxnr; |
@@ -1099,7 +1103,7 @@ static struct pci_serial_quirk *find_quirk(struct pci_dev *dev) | |||
1099 | } | 1103 | } |
1100 | 1104 | ||
1101 | static inline int get_pci_irq(struct pci_dev *dev, | 1105 | static inline int get_pci_irq(struct pci_dev *dev, |
1102 | struct pciserial_board *board) | 1106 | const struct pciserial_board *board) |
1103 | { | 1107 | { |
1104 | if (board->flags & FL_NOIRQ) | 1108 | if (board->flags & FL_NOIRQ) |
1105 | return 0; | 1109 | return 0; |
@@ -1894,8 +1898,8 @@ serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board) | |||
1894 | } | 1898 | } |
1895 | 1899 | ||
1896 | static inline int | 1900 | static inline int |
1897 | serial_pci_matches(struct pciserial_board *board, | 1901 | serial_pci_matches(const struct pciserial_board *board, |
1898 | struct pciserial_board *guessed) | 1902 | const struct pciserial_board *guessed) |
1899 | { | 1903 | { |
1900 | return | 1904 | return |
1901 | board->num_ports == guessed->num_ports && | 1905 | board->num_ports == guessed->num_ports && |
@@ -1906,7 +1910,7 @@ serial_pci_matches(struct pciserial_board *board, | |||
1906 | } | 1910 | } |
1907 | 1911 | ||
1908 | struct serial_private * | 1912 | struct serial_private * |
1909 | pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board) | 1913 | pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board) |
1910 | { | 1914 | { |
1911 | struct uart_port serial_port; | 1915 | struct uart_port serial_port; |
1912 | struct serial_private *priv; | 1916 | struct serial_private *priv; |
@@ -2039,7 +2043,8 @@ static int __devinit | |||
2039 | pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent) | 2043 | pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent) |
2040 | { | 2044 | { |
2041 | struct serial_private *priv; | 2045 | struct serial_private *priv; |
2042 | struct pciserial_board *board, tmp; | 2046 | const struct pciserial_board *board; |
2047 | struct pciserial_board tmp; | ||
2043 | int rc; | 2048 | int rc; |
2044 | 2049 | ||
2045 | if (ent->driver_data >= ARRAY_SIZE(pci_boards)) { | 2050 | if (ent->driver_data >= ARRAY_SIZE(pci_boards)) { |
@@ -2066,7 +2071,7 @@ pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent) | |||
2066 | * We matched one of our class entries. Try to | 2071 | * We matched one of our class entries. Try to |
2067 | * determine the parameters of this board. | 2072 | * determine the parameters of this board. |
2068 | */ | 2073 | */ |
2069 | rc = serial_pci_guess_board(dev, board); | 2074 | rc = serial_pci_guess_board(dev, &tmp); |
2070 | if (rc) | 2075 | if (rc) |
2071 | goto disable; | 2076 | goto disable; |
2072 | } else { | 2077 | } else { |