diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2012-10-14 03:05:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-24 14:39:48 -0400 |
commit | a1c25f2b98e10038f7d198704d033eb73bad0677 (patch) | |
tree | 54eb3640006ffc5f47a34efc67d139ae4e4c1716 /drivers/tty/serial | |
parent | 7ae75e94ec1128598f91dc56ca2919c45701ec32 (diff) |
serial: clps711x: Cleanup driver
This patch performs cleanup on clps711x serial driver. This include:
- Change functions naming style.
- Removed unused includes.
- Removed unneeded comments.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r-- | drivers/tty/serial/clps711x.c | 105 |
1 files changed, 46 insertions, 59 deletions
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c index 90efe0595718..a0a6db5c32fe 100644 --- a/drivers/tty/serial/clps711x.c +++ b/drivers/tty/serial/clps711x.c | |||
@@ -10,15 +10,6 @@ | |||
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * the Free Software Foundation; either version 2 of the License, or |
12 | * (at your option) any later version. | 12 | * (at your option) any later version. |
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | 13 | */ |
23 | 14 | ||
24 | #if defined(CONFIG_SERIAL_CLPS711X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | 15 | #if defined(CONFIG_SERIAL_CLPS711X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) |
@@ -26,22 +17,18 @@ | |||
26 | #endif | 17 | #endif |
27 | 18 | ||
28 | #include <linux/module.h> | 19 | #include <linux/module.h> |
29 | #include <linux/ioport.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/console.h> | ||
32 | #include <linux/sysrq.h> | ||
33 | #include <linux/spinlock.h> | ||
34 | #include <linux/device.h> | 20 | #include <linux/device.h> |
35 | #include <linux/tty.h> | 21 | #include <linux/console.h> |
36 | #include <linux/tty_flip.h> | ||
37 | #include <linux/serial_core.h> | 22 | #include <linux/serial_core.h> |
38 | #include <linux/serial.h> | 23 | #include <linux/serial.h> |
39 | #include <linux/io.h> | 24 | #include <linux/io.h> |
40 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
26 | #include <linux/tty.h> | ||
27 | #include <linux/tty_flip.h> | ||
28 | #include <linux/ioport.h> | ||
41 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
42 | 30 | ||
43 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
44 | #include <asm/irq.h> | ||
45 | 32 | ||
46 | #define UART_CLPS711X_NAME "uart-clps711x" | 33 | #define UART_CLPS711X_NAME "uart-clps711x" |
47 | #define UART_CLPS711X_NR 2 | 34 | #define UART_CLPS711X_NR 2 |
@@ -65,7 +52,7 @@ struct clps711x_port { | |||
65 | #endif | 52 | #endif |
66 | }; | 53 | }; |
67 | 54 | ||
68 | static void clps711xuart_stop_tx(struct uart_port *port) | 55 | static void uart_clps711x_stop_tx(struct uart_port *port) |
69 | { | 56 | { |
70 | struct clps711x_port *s = dev_get_drvdata(port->dev); | 57 | struct clps711x_port *s = dev_get_drvdata(port->dev); |
71 | 58 | ||
@@ -75,7 +62,7 @@ static void clps711xuart_stop_tx(struct uart_port *port) | |||
75 | } | 62 | } |
76 | } | 63 | } |
77 | 64 | ||
78 | static void clps711xuart_start_tx(struct uart_port *port) | 65 | static void uart_clps711x_start_tx(struct uart_port *port) |
79 | { | 66 | { |
80 | struct clps711x_port *s = dev_get_drvdata(port->dev); | 67 | struct clps711x_port *s = dev_get_drvdata(port->dev); |
81 | 68 | ||
@@ -85,13 +72,14 @@ static void clps711xuart_start_tx(struct uart_port *port) | |||
85 | } | 72 | } |
86 | } | 73 | } |
87 | 74 | ||
88 | static void clps711xuart_stop_rx(struct uart_port *port) | 75 | static void uart_clps711x_stop_rx(struct uart_port *port) |
89 | { | 76 | { |
90 | disable_irq(RX_IRQ(port)); | 77 | disable_irq(RX_IRQ(port)); |
91 | } | 78 | } |
92 | 79 | ||
93 | static void clps711xuart_enable_ms(struct uart_port *port) | 80 | static void uart_clps711x_enable_ms(struct uart_port *port) |
94 | { | 81 | { |
82 | /* Do nothing */ | ||
95 | } | 83 | } |
96 | 84 | ||
97 | static irqreturn_t uart_clps711x_int_rx(int irq, void *dev_id) | 85 | static irqreturn_t uart_clps711x_int_rx(int irq, void *dev_id) |
@@ -156,7 +144,7 @@ static irqreturn_t uart_clps711x_int_tx(int irq, void *dev_id) | |||
156 | struct circ_buf *xmit = &port->state->xmit; | 144 | struct circ_buf *xmit = &port->state->xmit; |
157 | 145 | ||
158 | if (port->x_char) { | 146 | if (port->x_char) { |
159 | clps_writel(port->x_char, UARTDR(port)); | 147 | clps_writew(port->x_char, UARTDR(port)); |
160 | port->icount.tx++; | 148 | port->icount.tx++; |
161 | port->x_char = 0; | 149 | port->x_char = 0; |
162 | return IRQ_HANDLED; | 150 | return IRQ_HANDLED; |
@@ -182,13 +170,12 @@ static irqreturn_t uart_clps711x_int_tx(int irq, void *dev_id) | |||
182 | return IRQ_HANDLED; | 170 | return IRQ_HANDLED; |
183 | } | 171 | } |
184 | 172 | ||
185 | static unsigned int clps711xuart_tx_empty(struct uart_port *port) | 173 | static unsigned int uart_clps711x_tx_empty(struct uart_port *port) |
186 | { | 174 | { |
187 | unsigned int status = clps_readl(SYSFLG(port)); | 175 | return (clps_readl(SYSFLG(port) & SYSFLG_UBUSY)) ? 0 : TIOCSER_TEMT; |
188 | return status & SYSFLG_UBUSY ? 0 : TIOCSER_TEMT; | ||
189 | } | 176 | } |
190 | 177 | ||
191 | static unsigned int clps711xuart_get_mctrl(struct uart_port *port) | 178 | static unsigned int uart_clps711x_get_mctrl(struct uart_port *port) |
192 | { | 179 | { |
193 | unsigned int status, result = 0; | 180 | unsigned int status, result = 0; |
194 | 181 | ||
@@ -206,12 +193,12 @@ static unsigned int clps711xuart_get_mctrl(struct uart_port *port) | |||
206 | return result; | 193 | return result; |
207 | } | 194 | } |
208 | 195 | ||
209 | static void | 196 | static void uart_clps711x_set_mctrl(struct uart_port *port, unsigned int mctrl) |
210 | clps711xuart_set_mctrl_null(struct uart_port *port, unsigned int mctrl) | ||
211 | { | 197 | { |
198 | /* Do nothing */ | ||
212 | } | 199 | } |
213 | 200 | ||
214 | static void clps711xuart_break_ctl(struct uart_port *port, int break_state) | 201 | static void uart_clps711x_break_ctl(struct uart_port *port, int break_state) |
215 | { | 202 | { |
216 | unsigned long flags; | 203 | unsigned long flags; |
217 | unsigned int ubrlcr; | 204 | unsigned int ubrlcr; |
@@ -228,7 +215,7 @@ static void clps711xuart_break_ctl(struct uart_port *port, int break_state) | |||
228 | spin_unlock_irqrestore(&port->lock, flags); | 215 | spin_unlock_irqrestore(&port->lock, flags); |
229 | } | 216 | } |
230 | 217 | ||
231 | static int clps711xuart_startup(struct uart_port *port) | 218 | static int uart_clps711x_startup(struct uart_port *port) |
232 | { | 219 | { |
233 | struct clps711x_port *s = dev_get_drvdata(port->dev); | 220 | struct clps711x_port *s = dev_get_drvdata(port->dev); |
234 | int ret; | 221 | int ret; |
@@ -256,7 +243,7 @@ static int clps711xuart_startup(struct uart_port *port) | |||
256 | return 0; | 243 | return 0; |
257 | } | 244 | } |
258 | 245 | ||
259 | static void clps711xuart_shutdown(struct uart_port *port) | 246 | static void uart_clps711x_shutdown(struct uart_port *port) |
260 | { | 247 | { |
261 | /* Free the interrupts */ | 248 | /* Free the interrupts */ |
262 | devm_free_irq(port->dev, TX_IRQ(port), port); | 249 | devm_free_irq(port->dev, TX_IRQ(port), port); |
@@ -266,9 +253,9 @@ static void clps711xuart_shutdown(struct uart_port *port) | |||
266 | clps_writel(clps_readl(SYSCON(port)) & ~SYSCON_UARTEN, SYSCON(port)); | 253 | clps_writel(clps_readl(SYSCON(port)) & ~SYSCON_UARTEN, SYSCON(port)); |
267 | } | 254 | } |
268 | 255 | ||
269 | static void | 256 | static void uart_clps711x_set_termios(struct uart_port *port, |
270 | clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios, | 257 | struct ktermios *termios, |
271 | struct ktermios *old) | 258 | struct ktermios *old) |
272 | { | 259 | { |
273 | unsigned int ubrlcr, baud, quot; | 260 | unsigned int ubrlcr, baud, quot; |
274 | unsigned long flags; | 261 | unsigned long flags; |
@@ -292,7 +279,8 @@ clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
292 | case CS7: | 279 | case CS7: |
293 | ubrlcr = UBRLCR_WRDLEN7; | 280 | ubrlcr = UBRLCR_WRDLEN7; |
294 | break; | 281 | break; |
295 | default: // CS8 | 282 | case CS8: |
283 | default: | ||
296 | ubrlcr = UBRLCR_WRDLEN8; | 284 | ubrlcr = UBRLCR_WRDLEN8; |
297 | break; | 285 | break; |
298 | } | 286 | } |
@@ -329,45 +317,44 @@ clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
329 | spin_unlock_irqrestore(&port->lock, flags); | 317 | spin_unlock_irqrestore(&port->lock, flags); |
330 | } | 318 | } |
331 | 319 | ||
332 | static const char *clps711xuart_type(struct uart_port *port) | 320 | static const char *uart_clps711x_type(struct uart_port *port) |
333 | { | 321 | { |
334 | return port->type == PORT_CLPS711X ? "CLPS711x" : NULL; | 322 | return (port->type == PORT_CLPS711X) ? "CLPS711X" : NULL; |
335 | } | 323 | } |
336 | 324 | ||
337 | /* | 325 | static void uart_clps711x_config_port(struct uart_port *port, int flags) |
338 | * Configure/autoconfigure the port. | ||
339 | */ | ||
340 | static void clps711xuart_config_port(struct uart_port *port, int flags) | ||
341 | { | 326 | { |
342 | if (flags & UART_CONFIG_TYPE) | 327 | if (flags & UART_CONFIG_TYPE) |
343 | port->type = PORT_CLPS711X; | 328 | port->type = PORT_CLPS711X; |
344 | } | 329 | } |
345 | 330 | ||
346 | static void clps711xuart_release_port(struct uart_port *port) | 331 | static void uart_clps711x_release_port(struct uart_port *port) |
347 | { | 332 | { |
333 | /* Do nothing */ | ||
348 | } | 334 | } |
349 | 335 | ||
350 | static int clps711xuart_request_port(struct uart_port *port) | 336 | static int uart_clps711x_request_port(struct uart_port *port) |
351 | { | 337 | { |
338 | /* Do nothing */ | ||
352 | return 0; | 339 | return 0; |
353 | } | 340 | } |
354 | 341 | ||
355 | static struct uart_ops uart_clps711x_ops = { | 342 | static const struct uart_ops uart_clps711x_ops = { |
356 | .tx_empty = clps711xuart_tx_empty, | 343 | .tx_empty = uart_clps711x_tx_empty, |
357 | .set_mctrl = clps711xuart_set_mctrl_null, | 344 | .set_mctrl = uart_clps711x_set_mctrl, |
358 | .get_mctrl = clps711xuart_get_mctrl, | 345 | .get_mctrl = uart_clps711x_get_mctrl, |
359 | .stop_tx = clps711xuart_stop_tx, | 346 | .stop_tx = uart_clps711x_stop_tx, |
360 | .start_tx = clps711xuart_start_tx, | 347 | .start_tx = uart_clps711x_start_tx, |
361 | .stop_rx = clps711xuart_stop_rx, | 348 | .stop_rx = uart_clps711x_stop_rx, |
362 | .enable_ms = clps711xuart_enable_ms, | 349 | .enable_ms = uart_clps711x_enable_ms, |
363 | .break_ctl = clps711xuart_break_ctl, | 350 | .break_ctl = uart_clps711x_break_ctl, |
364 | .startup = clps711xuart_startup, | 351 | .startup = uart_clps711x_startup, |
365 | .shutdown = clps711xuart_shutdown, | 352 | .shutdown = uart_clps711x_shutdown, |
366 | .set_termios = clps711xuart_set_termios, | 353 | .set_termios = uart_clps711x_set_termios, |
367 | .type = clps711xuart_type, | 354 | .type = uart_clps711x_type, |
368 | .config_port = clps711xuart_config_port, | 355 | .config_port = uart_clps711x_config_port, |
369 | .release_port = clps711xuart_release_port, | 356 | .release_port = uart_clps711x_release_port, |
370 | .request_port = clps711xuart_request_port, | 357 | .request_port = uart_clps711x_request_port, |
371 | }; | 358 | }; |
372 | 359 | ||
373 | #ifdef CONFIG_SERIAL_CLPS711X_CONSOLE | 360 | #ifdef CONFIG_SERIAL_CLPS711X_CONSOLE |