aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+lkml@arm.linux.org.uk>2009-01-02 08:44:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 13:19:37 -0500
commit975a1a7d887048d4afc9201383e11b7af991866b (patch)
tree968fc20c260ae529c53f1a3ddd8dbae43536cf45
parent9f2a036aaac8f29bb7c68303b52a9263238b63d2 (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>
-rw-r--r--drivers/serial/8250_pci.c37
-rw-r--r--include/linux/8250_pci.h2
2 files changed, 22 insertions, 17 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 */
109static int addidata_apci7800_setup(struct serial_private *priv, 110static 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 */
136static int 137static int
137afavlab_setup(struct serial_private *priv, struct pciserial_board *board, 138afavlab_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 */
190static int 191static int
191pci_hp_diva_setup(struct serial_private *priv, struct pciserial_board *board, 192pci_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 */
308static int 310static int
309sbs_setup(struct serial_private *priv, struct pciserial_board *board, 311sbs_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
465static int pci_siig_setup(struct serial_private *priv, 467static 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 */
536static int 538static int
537pci_timedia_setup(struct serial_private *priv, struct pciserial_board *board, 539pci_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 */
569static int 572static int
570titan_400l_800l_setup(struct serial_private *priv, 573titan_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
772static int 775static int
773pci_default_setup(struct serial_private *priv, struct pciserial_board *board, 776pci_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
1101static inline int get_pci_irq(struct pci_dev *dev, 1105static 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
1896static inline int 1900static inline int
1897serial_pci_matches(struct pciserial_board *board, 1901serial_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
1908struct serial_private * 1912struct serial_private *
1909pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board) 1913pciserial_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
2039pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent) 2043pciserial_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 {
diff --git a/include/linux/8250_pci.h b/include/linux/8250_pci.h
index 3209dd46ea7d..b24ff086a662 100644
--- a/include/linux/8250_pci.h
+++ b/include/linux/8250_pci.h
@@ -31,7 +31,7 @@ struct pciserial_board {
31struct serial_private; 31struct serial_private;
32 32
33struct serial_private * 33struct serial_private *
34pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board); 34pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board);
35void pciserial_remove_ports(struct serial_private *priv); 35void pciserial_remove_ports(struct serial_private *priv);
36void pciserial_suspend_ports(struct serial_private *priv); 36void pciserial_suspend_ports(struct serial_private *priv);
37void pciserial_resume_ports(struct serial_private *priv); 37void pciserial_resume_ports(struct serial_private *priv);