TTY/Serial changes for 6.8-rc1

Here is the big set of tty and serial driver changes for 6.8-rc1.
 
 As usual, Jiri has a bunch of refactoring and cleanups for the tty core
 and drivers in here, along with the usual set of rs485 updates (someday
 this might work properly...)  Along with those, in here are changes for:
   - sc16is7xx serial driver updates
   - platform driver removal api updates
   - amba-pl011 driver updates
   - tty driver binding updates
   - other small tty/serial driver updates and changes
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZaeUaw8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ykyOgCgp1uhP/b9iW6qM7qL6OYEG6idI0kAnj0VASNm
 vSI69HmdKKwo69YLOSBp
 =14n1
 -----END PGP SIGNATURE-----

Merge tag 'tty-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty / serial updates from Greg KH:
 "Here is the big set of tty and serial driver changes for 6.8-rc1.

  As usual, Jiri has a bunch of refactoring and cleanups for the tty
  core and drivers in here, along with the usual set of rs485 updates
  (someday this might work properly...)

  Along with those, in here are changes for:

   - sc16is7xx serial driver updates

   - platform driver removal api updates

   - amba-pl011 driver updates

   - tty driver binding updates

   - other small tty/serial driver updates and changes

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'tty-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (197 commits)
  serial: sc16is7xx: refactor EFR lock
  serial: sc16is7xx: reorder code to remove prototype declarations
  serial: sc16is7xx: refactor FIFO access functions to increase commonality
  serial: sc16is7xx: drop unneeded MODULE_ALIAS
  serial: sc16is7xx: replace hardcoded divisor value with BIT() macro
  serial: sc16is7xx: add explicit return for some switch default cases
  serial: sc16is7xx: add macro for max number of UART ports
  serial: sc16is7xx: add driver name to struct uart_driver
  serial: sc16is7xx: use i2c_get_match_data()
  serial: sc16is7xx: use spi_get_device_match_data()
  serial: sc16is7xx: use DECLARE_BITMAP for sc16is7xx_lines bitfield
  serial: sc16is7xx: improve do/while loop in sc16is7xx_irq()
  serial: sc16is7xx: remove obsolete loop in sc16is7xx_port_irq()
  serial: sc16is7xx: set safe default SPI clock frequency
  serial: sc16is7xx: add check for unsupported SPI modes during probe
  serial: sc16is7xx: fix invalid sc16is7xx_lines bitfield in case of probe error
  serial: 8250_exar: Set missing rs485_supported flag
  serial: omap: do not override settings for RS485 support
  serial: core, imx: do not set RS485 enabled if it is not supported
  serial: core: make sure RS485 cannot be enabled when it is not supported
  ...
This commit is contained in:
Linus Torvalds 2024-01-18 11:37:24 -08:00
commit bd736f38c0
172 changed files with 1661 additions and 1556 deletions

View File

@ -2704,6 +2704,9 @@
...
185 = /dev/ttyNX15 Hilscher netX serial port 15
186 = /dev/ttyJ0 JTAG1 DCC protocol based serial port emulation
If maximum number of uartlite serial ports is more than 4, then the driver
uses dynamic allocation instead of static allocation for major number.
187 = /dev/ttyUL0 Xilinx uartlite - port 0
...
190 = /dev/ttyUL3 Xilinx uartlite - port 3

View File

@ -75,10 +75,19 @@ On other
submit a patch to be included in this section.
On all
Write a character to /proc/sysrq-trigger. e.g.::
Write a single character to /proc/sysrq-trigger.
Only the first character is processed, the rest of the string is
ignored. However, it is not recommended to write any extra characters
as the behavior is undefined and might change in the future versions.
E.g.::
echo t > /proc/sysrq-trigger
Alternatively, write multiple characters prepended by underscore.
This way, all characters will be processed. E.g.::
echo _reisub > /proc/sysrq-trigger
The :kbd:`<command key>` is case sensitive.
What are the 'command' keys?

View File

@ -0,0 +1,30 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/serial/arm,dcc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: ARM DCC (Data communication channel) serial emulation
maintainers:
- Michal Simek <michal.simek@amd.com>
description: |
ARM DCC (Data communication channel) serial emulation interface available
via JTAG can be also used as one of serial line tightly coupled with every
ARM CPU available in the system.
properties:
compatible:
const: arm,dcc
required:
- compatible
additionalProperties: false
examples:
- |
serial {
compatible = "arm,dcc";
};

View File

@ -13,7 +13,7 @@ description: |
https://www.nxp.com/webapp/Download?colCode=S32V234RM.
maintainers:
- Chester Lin <clin@suse.com>
- Chester Lin <chester62515@gmail.com>
allOf:
- $ref: serial.yaml#

View File

@ -9,10 +9,6 @@ title: Freescale i.MX Universal Asynchronous Receiver/Transmitter (UART)
maintainers:
- Fabio Estevam <festevam@gmail.com>
allOf:
- $ref: serial.yaml#
- $ref: rs485.yaml#
properties:
compatible:
oneOf:
@ -68,7 +64,11 @@ properties:
- const: tx
interrupts:
maxItems: 1
items:
- description: UART RX Interrupt
- description: UART TX Interrupt
- description: UART RTS Interrupt
minItems: 1
wakeup-source: true
@ -110,6 +110,25 @@ required:
- clock-names
- interrupts
allOf:
- $ref: serial.yaml#
- $ref: rs485.yaml#
- if:
properties:
compatible:
contains:
const: fsl,imx1-uart
then:
properties:
interrupts:
minItems: 3
maxItems: 3
else:
properties:
interrupts:
maxItems: 1
unevaluatedProperties: false
examples:

View File

@ -48,9 +48,17 @@ properties:
- const: tx
- const: rx
interconnects:
maxItems: 1
interrupts:
maxItems: 1
operating-points-v2: true
power-domains:
maxItems: 1
qcom,rx-crci:
$ref: /schemas/types.yaml#/definitions/uint32
description:
@ -99,7 +107,9 @@ unevaluatedProperties: false
examples:
- |
#include <dt-bindings/interconnect/qcom,msm8996.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/power/qcom-rpmpd.h>
serial@f991e000 {
compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
@ -109,4 +119,7 @@ examples:
clock-names = "core", "iface";
dmas = <&dma0 0>, <&dma0 1>;
dma-names = "tx", "rx";
power-domains = <&rpmpd MSM8996_VDDCX>;
operating-points-v2 = <&uart_opp_table>;
interconnects = <&pnoc MASTER_BLSP_1 &bimc SLAVE_EBI_CH0>;
};

View File

@ -17,7 +17,7 @@ properties:
oneOf:
- items:
- enum:
- renesas,r9a07g043-sci # RZ/G2UL
- renesas,r9a07g043-sci # RZ/G2UL and RZ/Five
- renesas,r9a07g044-sci # RZ/G2{L,LC}
- renesas,r9a07g054-sci # RZ/V2L
- const: renesas,sci # generic SCI compatible UART

View File

@ -11,6 +11,7 @@ maintainers:
allOf:
- $ref: serial.yaml#
- $ref: rs485.yaml#
properties:
compatible:

View File

@ -20,6 +20,7 @@ properties:
- sprd,sc9860-uart
- sprd,sc9863a-uart
- sprd,ums512-uart
- sprd,ums9620-uart
- const: sprd,sc9836-uart
- const: sprd,sc9836-uart

View File

@ -23185,7 +23185,6 @@ M: Amit Shah <amit@kernel.org>
L: virtualization@lists.linux.dev
S: Maintained
F: drivers/char/virtio_console.c
F: include/linux/virtio_console.h
F: include/uapi/linux/virtio_console.h
VIRTIO CORE AND NET DRIVERS

View File

@ -53,7 +53,7 @@ srmcons_do_receive_chars(struct tty_port *port)
do {
result.as_long = callback_getc(0);
if (result.bits.status < 2) {
tty_insert_flip_char(port, (char)result.bits.c, 0);
tty_insert_flip_char(port, (u8)result.bits.c, 0);
count++;
}
} while((result.bits.status & 1) && (++loops < 10));
@ -88,30 +88,27 @@ srmcons_receive_chars(struct timer_list *t)
}
/* called with callback_lock held */
static int
srmcons_do_write(struct tty_port *port, const char *buf, int count)
static void
srmcons_do_write(struct tty_port *port, const u8 *buf, size_t count)
{
static char str_cr[1] = "\r";
long c, remaining = count;
size_t c;
srmcons_result result;
char *cur;
int need_cr;
for (cur = (char *)buf; remaining > 0; ) {
need_cr = 0;
while (count > 0) {
bool need_cr = false;
/*
* Break it up into reasonable size chunks to allow a chance
* for input to get in
*/
for (c = 0; c < min_t(long, 128L, remaining) && !need_cr; c++)
if (cur[c] == '\n')
need_cr = 1;
for (c = 0; c < min_t(size_t, 128U, count) && !need_cr; c++)
if (buf[c] == '\n')
need_cr = true;
while (c > 0) {
result.as_long = callback_puts(0, cur, c);
result.as_long = callback_puts(0, buf, c);
c -= result.bits.c;
remaining -= result.bits.c;
cur += result.bits.c;
count -= result.bits.c;
buf += result.bits.c;
/*
* Check for pending input iff a tty port was provided
@ -121,12 +118,11 @@ srmcons_do_write(struct tty_port *port, const char *buf, int count)
}
while (need_cr) {
result.as_long = callback_puts(0, str_cr, 1);
result.as_long = callback_puts(0, "\r", 1);
if (result.bits.c > 0)
need_cr = 0;
need_cr = false;
}
}
return count;
}
static ssize_t
@ -135,7 +131,7 @@ srmcons_write(struct tty_struct *tty, const u8 *buf, size_t count)
unsigned long flags;
spin_lock_irqsave(&srmcons_callback_lock, flags);
srmcons_do_write(tty->port, (const char *) buf, count);
srmcons_do_write(tty->port, buf, count);
spin_unlock_irqrestore(&srmcons_callback_lock, flags);
return count;

View File

@ -23,9 +23,9 @@ static int stderr_id;
static struct tty_port nfcon_tty_port;
static struct tty_driver *nfcon_tty_driver;
static void nfputs(const char *str, unsigned int count)
static void nfputs(const u8 *str, size_t count)
{
char buf[68];
u8 buf[68];
unsigned long phys = virt_to_phys(buf);
buf[64] = 0;

View File

@ -21,8 +21,8 @@
* Vio firmware always attempts to fetch MAX_VIO_GET_CHARS chars. The 'count'
* parm is included to conform to put_chars() function pointer template
*/
extern int hvc_get_chars(uint32_t vtermno, char *buf, int count);
extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count);
extern ssize_t hvc_get_chars(uint32_t vtermno, u8 *buf, size_t count);
extern ssize_t hvc_put_chars(uint32_t vtermno, const u8 *buf, size_t count);
/* Provided by HVC VIO */
void hvc_vio_init_early(void);

View File

@ -64,7 +64,7 @@ struct hvsi_priv {
unsigned int inbuf_len; /* data in input buffer */
unsigned char inbuf[HVSI_INBUF_SIZE];
unsigned int inbuf_cur; /* Cursor in input buffer */
unsigned int inbuf_pktlen; /* packet length from cursor */
size_t inbuf_pktlen; /* packet length from cursor */
atomic_t seqno; /* packet sequence number */
unsigned int opened:1; /* driver opened */
unsigned int established:1; /* protocol established */
@ -72,24 +72,26 @@ struct hvsi_priv {
unsigned int mctrl_update:1; /* modem control updated */
unsigned short mctrl; /* modem control */
struct tty_struct *tty; /* tty structure */
int (*get_chars)(uint32_t termno, char *buf, int count);
int (*put_chars)(uint32_t termno, const char *buf, int count);
ssize_t (*get_chars)(uint32_t termno, u8 *buf, size_t count);
ssize_t (*put_chars)(uint32_t termno, const u8 *buf, size_t count);
uint32_t termno;
};
/* hvsi lib functions */
struct hvc_struct;
extern void hvsilib_init(struct hvsi_priv *pv,
int (*get_chars)(uint32_t termno, char *buf, int count),
int (*put_chars)(uint32_t termno, const char *buf,
int count),
ssize_t (*get_chars)(uint32_t termno, u8 *buf,
size_t count),
ssize_t (*put_chars)(uint32_t termno, const u8 *buf,
size_t count),
int termno, int is_console);
extern int hvsilib_open(struct hvsi_priv *pv, struct hvc_struct *hp);
extern void hvsilib_close(struct hvsi_priv *pv, struct hvc_struct *hp);
extern int hvsilib_read_mctrl(struct hvsi_priv *pv);
extern int hvsilib_write_mctrl(struct hvsi_priv *pv, int dtr);
extern void hvsilib_establish(struct hvsi_priv *pv);
extern int hvsilib_get_chars(struct hvsi_priv *pv, char *buf, int count);
extern int hvsilib_put_chars(struct hvsi_priv *pv, const char *buf, int count);
extern ssize_t hvsilib_get_chars(struct hvsi_priv *pv, u8 *buf, size_t count);
extern ssize_t hvsilib_put_chars(struct hvsi_priv *pv, const u8 *buf,
size_t count);
#endif /* _HVSI_H */

View File

@ -313,9 +313,11 @@ extern int early_init_dt_scan_recoverable_ranges(unsigned long node,
const char *uname, int depth, void *data);
void __init opal_configure_cores(void);
extern int opal_get_chars(uint32_t vtermno, char *buf, int count);
extern int opal_put_chars(uint32_t vtermno, const char *buf, int total_len);
extern int opal_put_chars_atomic(uint32_t vtermno, const char *buf, int total_len);
extern ssize_t opal_get_chars(uint32_t vtermno, u8 *buf, size_t count);
extern ssize_t opal_put_chars(uint32_t vtermno, const u8 *buf,
size_t total_len);
extern ssize_t opal_put_chars_atomic(uint32_t vtermno, const u8 *buf,
size_t total_len);
extern int opal_flush_chars(uint32_t vtermno, bool wait);
extern int opal_flush_console(uint32_t vtermno);

View File

@ -424,7 +424,7 @@ static int __init opal_message_init(struct device_node *opal_node)
return 0;
}
int opal_get_chars(uint32_t vtermno, char *buf, int count)
ssize_t opal_get_chars(uint32_t vtermno, u8 *buf, size_t count)
{
s64 rc;
__be64 evt, len;
@ -441,10 +441,11 @@ int opal_get_chars(uint32_t vtermno, char *buf, int count)
return 0;
}
static int __opal_put_chars(uint32_t vtermno, const char *data, int total_len, bool atomic)
static ssize_t __opal_put_chars(uint32_t vtermno, const u8 *data,
size_t total_len, bool atomic)
{
unsigned long flags = 0 /* shut up gcc */;
int written;
ssize_t written;
__be64 olen;
s64 rc;
@ -484,7 +485,7 @@ static int __opal_put_chars(uint32_t vtermno, const char *data, int total_len, b
if (atomic) {
/* Should not happen */
pr_warn("atomic console write returned partial "
"len=%d written=%d\n", total_len, written);
"len=%zu written=%zd\n", total_len, written);
}
if (!written)
written = -EAGAIN;
@ -497,7 +498,7 @@ static int __opal_put_chars(uint32_t vtermno, const char *data, int total_len, b
return written;
}
int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
ssize_t opal_put_chars(uint32_t vtermno, const u8 *data, size_t total_len)
{
return __opal_put_chars(vtermno, data, total_len, false);
}
@ -508,7 +509,8 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
* true at the moment because console space can race with OPAL's console
* writes.
*/
int opal_put_chars_atomic(uint32_t vtermno, const char *data, int total_len)
ssize_t opal_put_chars_atomic(uint32_t vtermno, const u8 *data,
size_t total_len)
{
return __opal_put_chars(vtermno, data, total_len, true);
}

View File

@ -25,7 +25,7 @@
* firmware.
* @count: not used?
*/
int hvc_get_chars(uint32_t vtermno, char *buf, int count)
ssize_t hvc_get_chars(uint32_t vtermno, u8 *buf, size_t count)
{
long ret;
unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
@ -52,7 +52,7 @@ EXPORT_SYMBOL(hvc_get_chars);
* firmware. Must be at least 16 bytes, even if count is less than 16.
* @count: Send this number of characters.
*/
int hvc_put_chars(uint32_t vtermno, const char *buf, int count)
ssize_t hvc_put_chars(uint32_t vtermno, const u8 *buf, size_t count)
{
unsigned long *lbuf = (unsigned long *) buf;
long ret;

View File

@ -30,7 +30,7 @@ struct chan {
extern void chan_interrupt(struct line *line, int irq);
extern int parse_chan_pair(char *str, struct line *line, int device,
const struct chan_opts *opts, char **error_out);
extern int write_chan(struct chan *chan, const char *buf, int len,
extern int write_chan(struct chan *chan, const u8 *buf, size_t len,
int write_irq);
extern int console_write_chan(struct chan *chan, const char *buf,
int len);

View File

@ -33,14 +33,14 @@ static void not_configged_close(int fd, void *data)
"UML\n");
}
static int not_configged_read(int fd, char *c_out, void *data)
static int not_configged_read(int fd, u8 *c_out, void *data)
{
printk(KERN_ERR "Using a channel type which is configured out of "
"UML\n");
return -EIO;
}
static int not_configged_write(int fd, const char *buf, int len, void *data)
static int not_configged_write(int fd, const u8 *buf, size_t len, void *data)
{
printk(KERN_ERR "Using a channel type which is configured out of "
"UML\n");
@ -247,8 +247,7 @@ void deactivate_chan(struct chan *chan, int irq)
deactivate_fd(chan->fd, irq);
}
int write_chan(struct chan *chan, const char *buf, int len,
int write_irq)
int write_chan(struct chan *chan, const u8 *buf, size_t len, int write_irq)
{
int n, ret = 0;
@ -540,7 +539,7 @@ void chan_interrupt(struct line *line, int irq)
struct tty_port *port = &line->port;
struct chan *chan = line->chan_in;
int err;
char c;
u8 c;
if (!chan || !chan->ops->read)
goto out;

View File

@ -19,7 +19,7 @@ void generic_close(int fd, void *unused)
close(fd);
}
int generic_read(int fd, char *c_out, void *unused)
int generic_read(int fd, __u8 *c_out, void *unused)
{
int n;
@ -35,7 +35,7 @@ int generic_read(int fd, char *c_out, void *unused)
/* XXX Trivial wrapper around write */
int generic_write(int fd, const char *buf, int n, void *unused)
int generic_write(int fd, const __u8 *buf, size_t n, void *unused)
{
int err;

View File

@ -7,6 +7,7 @@
#define __CHAN_USER_H__
#include <init.h>
#include <linux/types.h>
struct chan_opts {
void (*const announce)(char *dev_name, int dev);
@ -19,8 +20,8 @@ struct chan_ops {
void *(*init)(char *, int, const struct chan_opts *);
int (*open)(int, int, int, void *, char **);
void (*close)(int, void *);
int (*read)(int, char *, void *);
int (*write)(int, const char *, int, void *);
int (*read)(int, __u8 *, void *);
int (*write)(int, const __u8 *, size_t, void *);
int (*console_write)(int, const char *, int);
int (*window_size)(int, void *, unsigned short *, unsigned short *);
void (*free)(void *);
@ -31,8 +32,8 @@ extern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops,
tty_ops, xterm_ops;
extern void generic_close(int fd, void *unused);
extern int generic_read(int fd, char *c_out, void *unused);
extern int generic_write(int fd, const char *buf, int n, void *unused);
extern int generic_read(int fd, __u8 *c_out, void *unused);
extern int generic_write(int fd, const __u8 *buf, size_t n, void *unused);
extern int generic_console_write(int fd, const char *buf, int n);
extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
unsigned short *cols_out);

View File

@ -83,7 +83,7 @@ unsigned int line_chars_in_buffer(struct tty_struct *tty)
*
* Must be called while holding line->lock!
*/
static int buffer_data(struct line *line, const char *buf, int len)
static int buffer_data(struct line *line, const u8 *buf, size_t len)
{
int end, room;

View File

@ -47,9 +47,9 @@ struct line {
*
* buffer points to a buffer allocated on demand, of length
* LINE_BUFSIZE, head to the start of the ring, tail to the end.*/
char *buffer;
char *head;
char *tail;
u8 *buffer;
u8 *head;
u8 *tail;
int sigio;
struct delayed_work task;

View File

@ -28,7 +28,7 @@ static int null_open(int input, int output, int primary, void *d,
return (fd < 0) ? -errno : fd;
}
static int null_read(int fd, char *c_out, void *unused)
static int null_read(int fd, __u8 *c_out, void *unused)
{
return -ENODEV;
}

View File

@ -65,7 +65,7 @@ static void rs_poll(struct timer_list *unused)
struct tty_port *port = &serial_port;
int i = 0;
int rd = 1;
unsigned char c;
u8 c;
while (simc_poll(0)) {
rd = simc_read(0, &c, 1);

View File

@ -383,8 +383,8 @@ static void btmtkuart_recv(struct hci_dev *hdev, const u8 *data, size_t count)
}
}
static int btmtkuart_receive_buf(struct serdev_device *serdev, const u8 *data,
size_t count)
static ssize_t btmtkuart_receive_buf(struct serdev_device *serdev,
const u8 *data, size_t count)
{
struct btmtkuart_dev *bdev = serdev_device_get_drvdata(serdev);

View File

@ -1264,8 +1264,8 @@ static const struct h4_recv_pkt nxp_recv_pkts[] = {
{ NXP_RECV_FW_REQ_V3, .recv = nxp_recv_fw_req_v3 },
};
static int btnxpuart_receive_buf(struct serdev_device *serdev, const u8 *data,
size_t count)
static ssize_t btnxpuart_receive_buf(struct serdev_device *serdev,
const u8 *data, size_t count)
{
struct btnxpuart_dev *nxpdev = serdev_device_get_drvdata(serdev);

View File

@ -271,8 +271,8 @@ static void hci_uart_write_wakeup(struct serdev_device *serdev)
*
* Return: number of processed bytes
*/
static int hci_uart_receive_buf(struct serdev_device *serdev, const u8 *data,
size_t count)
static ssize_t hci_uart_receive_buf(struct serdev_device *serdev,
const u8 *data, size_t count)
{
struct hci_uart *hu = serdev_device_get_drvdata(serdev);

View File

@ -40,7 +40,7 @@ static struct ttyprintk_port tpk_port;
static int tpk_curr;
static char tpk_buffer[TPK_STR_SIZE + 4];
static u8 tpk_buffer[TPK_STR_SIZE + 4];
static void tpk_flush(void)
{
@ -51,9 +51,9 @@ static void tpk_flush(void)
}
}
static int tpk_printk(const u8 *buf, int count)
static int tpk_printk(const u8 *buf, size_t count)
{
int i;
size_t i;
for (i = 0; i < count; i++) {
if (tpk_curr >= TPK_STR_SIZE) {

View File

@ -230,9 +230,6 @@ struct port {
bool guest_connected;
};
/* This is the very early arch-specified put chars function. */
static int (*early_put_chars)(u32, const char *, int);
static struct port *find_port_by_vtermno(u32 vtermno)
{
struct port *port;
@ -653,7 +650,7 @@ static ssize_t __send_to_port(struct port *port, struct scatterlist *sg,
* Give out the data that's requested from the buffer that we have
* queued up.
*/
static ssize_t fill_readbuf(struct port *port, char __user *out_buf,
static ssize_t fill_readbuf(struct port *port, u8 __user *out_buf,
size_t out_count, bool to_user)
{
struct port_buffer *buf;
@ -672,7 +669,7 @@ static ssize_t fill_readbuf(struct port *port, char __user *out_buf,
if (ret)
return -EFAULT;
} else {
memcpy((__force char *)out_buf, buf->buf + buf->offset,
memcpy((__force u8 *)out_buf, buf->buf + buf->offset,
out_count);
}
@ -1107,16 +1104,13 @@ static const struct file_operations port_fops = {
* it to finish: inefficient in theory, but in practice
* implementations will do it immediately.
*/
static int put_chars(u32 vtermno, const char *buf, int count)
static ssize_t put_chars(u32 vtermno, const u8 *buf, size_t count)
{
struct port *port;
struct scatterlist sg[1];
void *data;
int ret;
if (unlikely(early_put_chars))
return early_put_chars(vtermno, buf, count);
port = find_port_by_vtermno(vtermno);
if (!port)
return -EPIPE;
@ -1138,14 +1132,10 @@ static int put_chars(u32 vtermno, const char *buf, int count)
* We call out to fill_readbuf that gets us the required data from the
* buffers that are queued up.
*/
static int get_chars(u32 vtermno, char *buf, int count)
static ssize_t get_chars(u32 vtermno, u8 *buf, size_t count)
{
struct port *port;
/* If we've not set up the port yet, we have no input to give. */
if (unlikely(early_put_chars))
return 0;
port = find_port_by_vtermno(vtermno);
if (!port)
return -EPIPE;
@ -1153,7 +1143,7 @@ static int get_chars(u32 vtermno, char *buf, int count)
/* If we don't have an input queue yet, we can't get input. */
BUG_ON(!port->in_vq);
return fill_readbuf(port, (__force char __user *)buf, count, false);
return fill_readbuf(port, (__force u8 __user *)buf, count, false);
}
static void resize_console(struct port *port)
@ -1201,21 +1191,6 @@ static const struct hv_ops hv_ops = {
.notifier_hangup = notifier_del_vio,
};
/*
* Console drivers are initialized very early so boot messages can go
* out, so we do things slightly differently from the generic virtio
* initialization of the net and block drivers.
*
* At this stage, the console is output-only. It's too early to set
* up a virtqueue, so we let the drivers do some boutique early-output
* thing.
*/
int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int))
{
early_put_chars = put_chars;
return hvc_instantiate(0, 0, &hv_ops);
}
static int init_port_console(struct port *port)
{
int ret;
@ -1256,13 +1231,6 @@ static int init_port_console(struct port *port)
spin_unlock_irq(&pdrvdata_lock);
port->guest_connected = true;
/*
* Start using the new console output if this is the first
* console to come up.
*/
if (early_put_chars)
early_put_chars = NULL;
/* Notify host of port being opened */
send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 1);
@ -1999,7 +1967,6 @@ static int virtcons_probe(struct virtio_device *vdev)
struct ports_device *portdev;
int err;
bool multiport;
bool early = early_put_chars != NULL;
/* We only need a config space if features are offered */
if (!vdev->config->get &&
@ -2010,9 +1977,6 @@ static int virtcons_probe(struct virtio_device *vdev)
return -EINVAL;
}
/* Ensure to read early_put_chars now */
barrier();
portdev = kmalloc(sizeof(*portdev), GFP_KERNEL);
if (!portdev) {
err = -ENOMEM;
@ -2100,18 +2064,6 @@ static int virtcons_probe(struct virtio_device *vdev)
__send_control_msg(portdev, VIRTIO_CONSOLE_BAD_ID,
VIRTIO_CONSOLE_DEVICE_READY, 1);
/*
* If there was an early virtio console, assume that there are no
* other consoles. We need to wait until the hvc_alloc matches the
* hvc_instantiate, otherwise tty_open will complain, resulting in
* a "Warning: unable to open an initial console" boot failure.
* Without multiport this is done in add_port above. With multiport
* this might take some host<->guest communication - thus we have to
* wait.
*/
if (multiport && early)
wait_for_completion(&early_console_added);
return 0;
free_chrdev:

View File

@ -80,8 +80,8 @@ static const struct gnss_operations gnss_serial_gnss_ops = {
.write_raw = gnss_serial_write_raw,
};
static int gnss_serial_receive_buf(struct serdev_device *serdev,
const unsigned char *buf, size_t count)
static ssize_t gnss_serial_receive_buf(struct serdev_device *serdev,
const u8 *buf, size_t count)
{
struct gnss_serial *gserial = serdev_device_get_drvdata(serdev);
struct gnss_device *gdev = gserial->gdev;

View File

@ -160,8 +160,8 @@ static const struct gnss_operations sirf_gnss_ops = {
.write_raw = sirf_write_raw,
};
static int sirf_receive_buf(struct serdev_device *serdev,
const unsigned char *buf, size_t count)
static ssize_t sirf_receive_buf(struct serdev_device *serdev,
const u8 *buf, size_t count)
{
struct sirf_data *data = serdev_device_get_drvdata(serdev);
struct gnss_device *gdev = data->gdev;

View File

@ -271,7 +271,7 @@ static void hdlc_rx_frame(struct gb_beagleplay *bg)
}
}
static int hdlc_rx(struct gb_beagleplay *bg, const u8 *data, size_t count)
static ssize_t hdlc_rx(struct gb_beagleplay *bg, const u8 *data, size_t count)
{
size_t i;
u8 c;
@ -331,7 +331,8 @@ static void hdlc_deinit(struct gb_beagleplay *bg)
flush_work(&bg->tx_work);
}
static int gb_tty_receive(struct serdev_device *sd, const unsigned char *data, size_t count)
static ssize_t gb_tty_receive(struct serdev_device *sd, const u8 *data,
size_t count)
{
struct gb_beagleplay *bg = serdev_device_get_drvdata(sd);

View File

@ -211,13 +211,13 @@ static bool pms7003_frame_is_okay(struct pms7003_frame *frame)
return checksum == pms7003_calc_checksum(frame);
}
static int pms7003_receive_buf(struct serdev_device *serdev,
const unsigned char *buf, size_t size)
static ssize_t pms7003_receive_buf(struct serdev_device *serdev, const u8 *buf,
size_t size)
{
struct iio_dev *indio_dev = serdev_device_get_drvdata(serdev);
struct pms7003_state *state = iio_priv(indio_dev);
struct pms7003_frame *frame = &state->frame;
int num;
size_t num;
if (!frame->expected_length) {
u16 magic;

View File

@ -174,13 +174,13 @@ static int scd30_serdev_command(struct scd30_state *state, enum scd30_cmd cmd, u
return 0;
}
static int scd30_serdev_receive_buf(struct serdev_device *serdev,
const unsigned char *buf, size_t size)
static ssize_t scd30_serdev_receive_buf(struct serdev_device *serdev,
const u8 *buf, size_t size)
{
struct iio_dev *indio_dev = serdev_device_get_drvdata(serdev);
struct scd30_serdev_priv *priv;
struct scd30_state *state;
int num;
size_t num;
if (!indio_dev)
return 0;

View File

@ -74,8 +74,8 @@ static int sps30_serial_xfer(struct sps30_state *state, const unsigned char *buf
}
static const struct {
unsigned char byte;
unsigned char byte2;
u8 byte;
u8 byte2;
} sps30_serial_bytes[] = {
{ 0x11, 0x31 },
{ 0x13, 0x33 },
@ -83,7 +83,7 @@ static const struct {
{ 0x7d, 0x5d },
};
static int sps30_serial_put_byte(unsigned char *buf, unsigned char byte)
static int sps30_serial_put_byte(u8 *buf, u8 byte)
{
int i;
@ -102,7 +102,7 @@ static int sps30_serial_put_byte(unsigned char *buf, unsigned char byte)
return 1;
}
static char sps30_serial_get_byte(bool escaped, unsigned char byte2)
static u8 sps30_serial_get_byte(bool escaped, u8 byte2)
{
int i;
@ -130,8 +130,8 @@ static unsigned char sps30_serial_calc_chksum(const unsigned char *buf, size_t n
return ~chksum;
}
static int sps30_serial_prep_frame(unsigned char *buf, unsigned char cmd,
const unsigned char *arg, size_t arg_size)
static int sps30_serial_prep_frame(u8 *buf, u8 cmd, const u8 *arg,
size_t arg_size)
{
unsigned char chksum;
int num = 0;
@ -210,14 +210,14 @@ static int sps30_serial_command(struct sps30_state *state, unsigned char cmd,
return rsp_size;
}
static int sps30_serial_receive_buf(struct serdev_device *serdev,
const unsigned char *buf, size_t size)
static ssize_t sps30_serial_receive_buf(struct serdev_device *serdev,
const u8 *buf, size_t size)
{
struct iio_dev *indio_dev = dev_get_drvdata(&serdev->dev);
struct sps30_serial_priv *priv;
struct sps30_state *state;
unsigned char byte;
size_t i;
u8 byte;
if (!indio_dev)
return 0;

View File

@ -378,12 +378,12 @@ static void bno055_ser_handle_rx(struct bno055_ser_priv *priv, int status)
* Also, we assume to RX one pkt per time (i.e. the HW doesn't send anything
* unless we require to AND we don't queue more than one request per time).
*/
static int bno055_ser_receive_buf(struct serdev_device *serdev,
const unsigned char *buf, size_t size)
static ssize_t bno055_ser_receive_buf(struct serdev_device *serdev,
const u8 *buf, size_t size)
{
int status;
struct bno055_ser_priv *priv = serdev_device_get_drvdata(serdev);
int remaining = size;
size_t remaining = size;
if (size == 0)
return 0;

View File

@ -158,9 +158,7 @@ static int ipoctal_get_icount(struct tty_struct *tty,
static void ipoctal_irq_rx(struct ipoctal_channel *channel, u8 sr)
{
struct tty_port *port = &channel->tty_port;
unsigned char value;
unsigned char flag;
u8 isr;
u8 isr, value, flag;
do {
value = ioread8(&channel->regs->r.rhr);
@ -202,8 +200,8 @@ static void ipoctal_irq_rx(struct ipoctal_channel *channel, u8 sr)
static void ipoctal_irq_tx(struct ipoctal_channel *channel)
{
unsigned char value;
unsigned int *pointer_write = &channel->pointer_write;
u8 value;
if (channel->nb_bytes == 0)
return;
@ -436,11 +434,11 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
return res;
}
static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel,
const u8 *buf, int count)
static inline size_t ipoctal_copy_write_buffer(struct ipoctal_channel *channel,
const u8 *buf, size_t count)
{
unsigned long flags;
int i;
size_t i;
unsigned int *pointer_read = &channel->pointer_read;
/* Copy the bytes from the user buffer to the internal one */
@ -462,7 +460,7 @@ static ssize_t ipoctal_write_tty(struct tty_struct *tty, const u8 *buf,
size_t count)
{
struct ipoctal_channel *channel = tty->driver_data;
unsigned int char_copied;
size_t char_copied;
char_copied = ipoctal_copy_write_buffer(channel, buf, count);

View File

@ -1231,9 +1231,9 @@ static void capinc_tty_hangup(struct tty_struct *tty)
tty_port_hangup(&mp->port);
}
static void capinc_tty_send_xchar(struct tty_struct *tty, char ch)
static void capinc_tty_send_xchar(struct tty_struct *tty, u8 ch)
{
pr_debug("capinc_tty_send_xchar(%d)\n", ch);
pr_debug("capinc_tty_send_xchar(%u)\n", ch);
}
static const struct tty_operations capinc_ops = {

View File

@ -471,17 +471,17 @@ static void rave_sp_receive_frame(struct rave_sp *sp,
rave_sp_receive_reply(sp, data, length);
}
static int rave_sp_receive_buf(struct serdev_device *serdev,
const unsigned char *buf, size_t size)
static ssize_t rave_sp_receive_buf(struct serdev_device *serdev,
const u8 *buf, size_t size)
{
struct device *dev = &serdev->dev;
struct rave_sp *sp = dev_get_drvdata(dev);
struct rave_sp_deframer *deframer = &sp->deframer;
const unsigned char *src = buf;
const unsigned char *end = buf + size;
const u8 *src = buf;
const u8 *end = buf + size;
while (src < end) {
const unsigned char byte = *src++;
const u8 byte = *src++;
switch (deframer->state) {
case RAVE_SP_EXPECT_SOF:

View File

@ -64,9 +64,9 @@ static void bcm_vk_tty_wq_handler(struct work_struct *work)
struct bcm_vk_tty *vktty;
int card_status;
int count;
unsigned char c;
int i;
int wr;
u8 c;
card_status = vkread32(vk, BAR_0, BAR_CARD_STATUS);
if (BCM_VK_INTF_IS_DOWN(card_status))
@ -192,7 +192,7 @@ static ssize_t bcm_vk_tty_write(struct tty_struct *tty, const u8 *buffer,
int index;
struct bcm_vk *vk;
struct bcm_vk_tty *vktty;
int i;
size_t i;
index = tty->index;
vk = dev_get_drvdata(tty->dev);

View File

@ -178,11 +178,9 @@ static inline void sdio_uart_release_func(struct sdio_uart_port *port)
sdio_release_host(port->func);
}
static inline unsigned int sdio_in(struct sdio_uart_port *port, int offset)
static inline u8 sdio_in(struct sdio_uart_port *port, int offset)
{
unsigned char c;
c = sdio_readb(port->func, port->regs_offset + offset, NULL);
return c;
return sdio_readb(port->func, port->regs_offset + offset, NULL);
}
static inline void sdio_out(struct sdio_uart_port *port, int offset, int value)
@ -192,8 +190,8 @@ static inline void sdio_out(struct sdio_uart_port *port, int offset, int value)
static unsigned int sdio_uart_get_mctrl(struct sdio_uart_port *port)
{
unsigned char status;
unsigned int ret;
u8 status;
/* FIXME: What stops this losing the delta bits and breaking
sdio_uart_check_modem_status ? */
@ -354,15 +352,13 @@ static void sdio_uart_stop_rx(struct sdio_uart_port *port)
sdio_out(port, UART_IER, port->ier);
}
static void sdio_uart_receive_chars(struct sdio_uart_port *port,
unsigned int *status)
static void sdio_uart_receive_chars(struct sdio_uart_port *port, u8 *status)
{
unsigned int ch, flag;
int max_count = 256;
do {
ch = sdio_in(port, UART_RX);
flag = TTY_NORMAL;
u8 ch = sdio_in(port, UART_RX);
u8 flag = TTY_NORMAL;
port->icount.rx++;
if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE |
@ -449,8 +445,8 @@ static void sdio_uart_transmit_chars(struct sdio_uart_port *port)
static void sdio_uart_check_modem_status(struct sdio_uart_port *port)
{
int status;
struct tty_struct *tty;
u8 status;
status = sdio_in(port, UART_MSR);
@ -499,7 +495,7 @@ static void sdio_uart_check_modem_status(struct sdio_uart_port *port)
static void sdio_uart_irq(struct sdio_func *func)
{
struct sdio_uart_port *port = sdio_get_drvdata(func);
unsigned int iir, lsr;
u8 iir, lsr;
/*
* In a few places sdio_uart_irq() is called directly instead of
@ -795,7 +791,7 @@ static unsigned int sdio_uart_chars_in_buffer(struct tty_struct *tty)
return kfifo_len(&port->xmit_fifo);
}
static void sdio_uart_send_xchar(struct tty_struct *tty, char ch)
static void sdio_uart_send_xchar(struct tty_struct *tty, u8 ch)
{
struct sdio_uart_port *port = tty->driver_data;

View File

@ -58,9 +58,8 @@ struct qcauart {
unsigned char *tx_buffer;
};
static int
qca_tty_receive(struct serdev_device *serdev, const unsigned char *data,
size_t count)
static ssize_t
qca_tty_receive(struct serdev_device *serdev, const u8 *data, size_t count)
{
struct qcauart *qca = serdev_device_get_drvdata(serdev);
struct net_device *netdev = qca->net_dev;

View File

@ -363,7 +363,6 @@ static int disable_net;
/* driver info */
static const char driver_name[] = "hso";
static const char tty_filename[] = "ttyHS";
static const char *version = __FILE__ ": " MOD_AUTHOR;
/* the usb driver itself (registered in hso_init) */
static struct usb_driver hso_driver;
/* serial structures */
@ -3228,16 +3227,8 @@ static struct usb_driver hso_driver = {
static int __init hso_init(void)
{
int i;
int result;
/* put it in the log */
pr_info("%s\n", version);
/* Initialise the serial table semaphore and table */
for (i = 0; i < HSO_SERIAL_TTY_MINORS; i++)
serial_table[i] = NULL;
/* allocate our driver using the proper amount of supported minors */
tty_drv = tty_alloc_driver(HSO_SERIAL_TTY_MINORS, TTY_DRIVER_REAL_RAW |
TTY_DRIVER_DYNAMIC_DEV);
@ -3285,8 +3276,6 @@ static int __init hso_init(void)
static void __exit hso_exit(void)
{
pr_info("unloaded\n");
tty_unregister_driver(tty_drv);
/* deregister the usb driver */
usb_deregister(&hso_driver);

View File

@ -203,8 +203,8 @@ static int pn532_uart_rx_is_frame(struct sk_buff *skb)
return 0;
}
static int pn532_receive_buf(struct serdev_device *serdev,
const unsigned char *data, size_t count)
static ssize_t pn532_receive_buf(struct serdev_device *serdev,
const u8 *data, size_t count)
{
struct pn532_uart_phy *dev = serdev_device_get_drvdata(serdev);
size_t i;

View File

@ -51,9 +51,8 @@ static const struct s3fwrn5_phy_ops uart_phy_ops = {
.write = s3fwrn82_uart_write,
};
static int s3fwrn82_uart_read(struct serdev_device *serdev,
const unsigned char *data,
size_t count)
static ssize_t s3fwrn82_uart_read(struct serdev_device *serdev,
const u8 *data, size_t count)
{
struct s3fwrn82_uart_phy *phy = serdev_device_get_drvdata(serdev);
size_t i;

View File

@ -81,9 +81,8 @@ struct cros_ec_uart {
struct response_info response;
};
static int cros_ec_uart_rx_bytes(struct serdev_device *serdev,
const u8 *data,
size_t count)
static ssize_t cros_ec_uart_rx_bytes(struct serdev_device *serdev,
const u8 *data, size_t count)
{
struct ec_host_response *host_response;
struct cros_ec_device *ec_dev = serdev_device_get_drvdata(serdev);

View File

@ -238,8 +238,8 @@ struct ssam_controller {
* layer of the controller has been shut down, %-ESHUTDOWN.
*/
static inline
int ssam_controller_receive_buf(struct ssam_controller *ctrl,
const unsigned char *buf, size_t n)
ssize_t ssam_controller_receive_buf(struct ssam_controller *ctrl, const u8 *buf,
size_t n)
{
return ssh_ptl_rx_rcvbuf(&ctrl->rtl.ptl, buf, n);
}

View File

@ -227,8 +227,8 @@ EXPORT_SYMBOL_GPL(ssam_client_bind);
/* -- Glue layer (serdev_device -> ssam_controller). ------------------------ */
static int ssam_receive_buf(struct serdev_device *dev, const unsigned char *buf,
size_t n)
static ssize_t ssam_receive_buf(struct serdev_device *dev, const u8 *buf,
size_t n)
{
struct ssam_controller *ctrl;
int ret;

View File

@ -1887,9 +1887,9 @@ int ssh_ptl_rx_stop(struct ssh_ptl *ptl)
* Return: Returns the number of bytes transferred (positive or zero) on
* success. Returns %-ESHUTDOWN if the packet layer has been shut down.
*/
int ssh_ptl_rx_rcvbuf(struct ssh_ptl *ptl, const u8 *buf, size_t n)
ssize_t ssh_ptl_rx_rcvbuf(struct ssh_ptl *ptl, const u8 *buf, size_t n)
{
int used;
size_t used;
if (test_bit(SSH_PTL_SF_SHUTDOWN_BIT, &ptl->state))
return -ESHUTDOWN;

View File

@ -162,7 +162,7 @@ void ssh_ptl_shutdown(struct ssh_ptl *ptl);
int ssh_ptl_submit(struct ssh_ptl *ptl, struct ssh_packet *p);
void ssh_ptl_cancel(struct ssh_packet *p);
int ssh_ptl_rx_rcvbuf(struct ssh_ptl *ptl, const u8 *buf, size_t n);
ssize_t ssh_ptl_rx_rcvbuf(struct ssh_ptl *ptl, const u8 *buf, size_t n);
/**
* ssh_ptl_tx_wakeup_transfer() - Wake up packet transmitter thread for

View File

@ -79,8 +79,8 @@ struct raw3215_info {
struct ccw_device *cdev; /* device for tty driver */
spinlock_t *lock; /* pointer to irq lock */
int flags; /* state flags */
char *buffer; /* pointer to output buffer */
char *inbuf; /* pointer to input buffer */
u8 *buffer; /* pointer to output buffer */
u8 *inbuf; /* pointer to input buffer */
int head; /* first free byte in output buffer */
int count; /* number of bytes in output buffer */
int written; /* number of bytes in write requests */
@ -89,7 +89,6 @@ struct raw3215_info {
wait_queue_head_t empty_wait; /* wait queue for flushing */
struct timer_list timer; /* timer for delayed output */
int line_pos; /* position on the line (for tabs) */
char ubuffer[80]; /* copy_from_user buffer */
};
/* array of 3215 devices structures */
@ -523,12 +522,14 @@ static unsigned int raw3215_make_room(struct raw3215_info *raw,
* string without blocking.
* Return value is the number of bytes copied.
*/
static unsigned int raw3215_addtext(const char *str, unsigned int length,
static unsigned int raw3215_addtext(const u8 *str, size_t length,
struct raw3215_info *raw, int opmode,
unsigned int todrop)
{
unsigned int c, ch, i, blanks, expanded_size = 0;
unsigned int i, blanks, expanded_size = 0;
unsigned int column = raw->line_pos;
size_t c;
u8 ch;
if (opmode == RAW3215_COUNT)
todrop = 0;
@ -559,7 +560,7 @@ static unsigned int raw3215_addtext(const char *str, unsigned int length,
if (todrop && expanded_size < todrop) /* Drop head data */
continue;
for (i = 0; i < blanks; i++) {
raw->buffer[raw->head] = (char)_ascebc[(int)ch];
raw->buffer[raw->head] = _ascebc[ch];
raw->head = (raw->head + 1) & (RAW3215_BUFFER_SIZE - 1);
raw->count++;
}
@ -571,8 +572,8 @@ static unsigned int raw3215_addtext(const char *str, unsigned int length,
/*
* String write routine for 3215 devices
*/
static void raw3215_write(struct raw3215_info *raw, const char *str,
unsigned int length)
static void raw3215_write(struct raw3215_info *raw, const u8 *str,
size_t length)
{
unsigned int count, avail;
unsigned long flags;
@ -597,7 +598,7 @@ static void raw3215_write(struct raw3215_info *raw, const char *str,
/*
* Put character routine for 3215 devices
*/
static void raw3215_putchar(struct raw3215_info *raw, unsigned char ch)
static void raw3215_putchar(struct raw3215_info *raw, u8 ch)
{
raw3215_write(raw, &ch, 1);
}
@ -824,12 +825,10 @@ static struct ccw_driver raw3215_ccw_driver = {
.int_class = IRQIO_C15,
};
static void handle_write(struct raw3215_info *raw, const char *str, int count)
static void handle_write(struct raw3215_info *raw, const u8 *str, size_t count)
{
int i;
while (count > 0) {
i = min_t(int, count, RAW3215_BUFFER_SIZE - 1);
size_t i = min_t(size_t, count, RAW3215_BUFFER_SIZE - 1);
raw3215_write(raw, str, i);
count -= i;
str += i;

View File

@ -54,7 +54,7 @@ struct tty3270_attribute {
};
struct tty3270_cell {
unsigned char character;
u8 character;
struct tty3270_attribute attributes;
};
@ -123,7 +123,7 @@ struct tty3270 {
/* Character array for put_char/flush_chars. */
unsigned int char_count;
char char_buf[TTY3270_CHAR_BUF_SIZE];
u8 char_buf[TTY3270_CHAR_BUF_SIZE];
};
/* tty3270->update_flags. See tty3270_update for details. */
@ -1255,7 +1255,7 @@ static unsigned int tty3270_write_room(struct tty_struct *tty)
* Insert character into the screen at the current position with the
* current color and highlight. This function does NOT do cursor movement.
*/
static void tty3270_put_character(struct tty3270 *tp, char ch)
static void tty3270_put_character(struct tty3270 *tp, u8 ch)
{
struct tty3270_line *line;
struct tty3270_cell *cell;
@ -1561,7 +1561,7 @@ static void tty3270_goto_xy(struct tty3270 *tp, int cx, int cy)
* Pn is a numeric parameter, a string of zero or more decimal digits.
* Ps is a selective parameter.
*/
static void tty3270_escape_sequence(struct tty3270 *tp, char ch)
static void tty3270_escape_sequence(struct tty3270 *tp, u8 ch)
{
enum { ES_NORMAL, ES_ESC, ES_SQUARE, ES_PAREN, ES_GETPARS };
@ -1726,7 +1726,7 @@ static void tty3270_escape_sequence(struct tty3270 *tp, char ch)
* String write routine for 3270 ttys
*/
static void tty3270_do_write(struct tty3270 *tp, struct tty_struct *tty,
const unsigned char *buf, int count)
const u8 *buf, size_t count)
{
int i_msg, i;
@ -2052,7 +2052,7 @@ con3270_write(struct console *co, const char *str, unsigned int count)
{
struct tty3270 *tp = co->data;
unsigned long flags;
char c;
u8 c;
spin_lock_irqsave(&tp->view.lock, flags);
while (count--) {

View File

@ -81,7 +81,7 @@ struct serial_state {
int quot;
int IER; /* Interrupt Enable Register */
int MCR; /* Modem control register */
int x_char; /* xon/xoff character */
u8 x_char; /* xon/xoff character */
};
static struct tty_driver *serial_driver;
@ -178,9 +178,9 @@ static void receive_chars(struct serial_state *info)
{
int status;
int serdatr;
unsigned char ch, flag;
u8 ch, flag;
struct async_icount *icount;
int oe = 0;
bool overrun = false;
icount = &info->icount;
@ -230,7 +230,7 @@ static void receive_chars(struct serial_state *info)
* should be ignored.
*/
if (status & info->ignore_status_mask)
goto out;
return;
status &= info->read_status_mask;
@ -251,15 +251,13 @@ static void receive_chars(struct serial_state *info)
* reported immediately, and doesn't
* affect the current character
*/
oe = 1;
overrun = true;
}
}
tty_insert_flip_char(&info->tport, ch, flag);
if (oe == 1)
if (overrun)
tty_insert_flip_char(&info->tport, 0, TTY_OVERRUN);
tty_flip_buffer_push(&info->tport);
out:
return;
}
static void transmit_chars(struct serial_state *info)
@ -813,7 +811,7 @@ static void rs_flush_buffer(struct tty_struct *tty)
* This function is used to send a high-priority XON/XOFF character to
* the device
*/
static void rs_send_xchar(struct tty_struct *tty, char ch)
static void rs_send_xchar(struct tty_struct *tty, u8 ch)
{
struct serial_state *info = tty->driver_data;
unsigned long flags;

View File

@ -49,7 +49,7 @@ struct ehv_bc_data {
unsigned int tx_irq;
spinlock_t lock; /* lock for transmit buffer */
unsigned char buf[BUF_SIZE]; /* transmit circular buffer */
u8 buf[BUF_SIZE]; /* transmit circular buffer */
unsigned int head; /* circular buffer head */
unsigned int tail; /* circular buffer tail */
@ -138,14 +138,17 @@ static int find_console_handle(void)
static unsigned int local_ev_byte_channel_send(unsigned int handle,
unsigned int *count,
const char *p)
const u8 *p)
{
char buffer[EV_BYTE_CHANNEL_MAX_BYTES];
u8 buffer[EV_BYTE_CHANNEL_MAX_BYTES];
unsigned int c = *count;
/*
* ev_byte_channel_send() expects at least EV_BYTE_CHANNEL_MAX_BYTES
* (16 B) in the buffer. Fake it using a local buffer if needed.
*/
if (c < sizeof(buffer)) {
memcpy(buffer, p, c);
memset(&buffer[c], 0, sizeof(buffer) - c);
memcpy_and_pad(buffer, sizeof(buffer), p, c, 0);
p = buffer;
}
return ev_byte_channel_send(handle, count, p);
@ -163,7 +166,7 @@ static unsigned int local_ev_byte_channel_send(unsigned int handle,
* has been sent, or if some error has occurred.
*
*/
static void byte_channel_spin_send(const char data)
static void byte_channel_spin_send(const u8 data)
{
int ret, count;
@ -471,8 +474,7 @@ static ssize_t ehv_bc_tty_write(struct tty_struct *ttys, const u8 *s,
{
struct ehv_bc_data *bc = ttys->driver_data;
unsigned long flags;
unsigned int len;
unsigned int written = 0;
size_t len, written = 0;
while (1) {
spin_lock_irqsave(&bc->lock, flags);

View File

@ -50,10 +50,8 @@ static u32 goldfish_tty_line_count = 8;
static u32 goldfish_tty_current_line_count;
static struct goldfish_tty *goldfish_ttys;
static void do_rw_io(struct goldfish_tty *qtty,
unsigned long address,
unsigned int count,
int is_write)
static void do_rw_io(struct goldfish_tty *qtty, unsigned long address,
size_t count, bool is_write)
{
unsigned long irq_flags;
void __iomem *base = qtty->base;
@ -73,10 +71,8 @@ static void do_rw_io(struct goldfish_tty *qtty,
spin_unlock_irqrestore(&qtty->lock, irq_flags);
}
static void goldfish_tty_rw(struct goldfish_tty *qtty,
unsigned long addr,
unsigned int count,
int is_write)
static void goldfish_tty_rw(struct goldfish_tty *qtty, unsigned long addr,
size_t count, bool is_write)
{
dma_addr_t dma_handle;
enum dma_data_direction dma_dir;
@ -125,20 +121,18 @@ static void goldfish_tty_rw(struct goldfish_tty *qtty,
}
}
static void goldfish_tty_do_write(int line, const u8 *buf, unsigned int count)
static void goldfish_tty_do_write(int line, const u8 *buf, size_t count)
{
struct goldfish_tty *qtty = &goldfish_ttys[line];
unsigned long address = (unsigned long)(void *)buf;
goldfish_tty_rw(qtty, address, count, 1);
goldfish_tty_rw(qtty, (unsigned long)buf, count, true);
}
static irqreturn_t goldfish_tty_interrupt(int irq, void *dev_id)
{
struct goldfish_tty *qtty = dev_id;
void __iomem *base = qtty->base;
unsigned long address;
unsigned char *buf;
u8 *buf;
u32 count;
count = gf_ioread32(base + GOLDFISH_TTY_REG_BYTES_READY);
@ -147,8 +141,7 @@ static irqreturn_t goldfish_tty_interrupt(int irq, void *dev_id)
count = tty_prepare_flip_string(&qtty->port, &buf, count);
address = (unsigned long)(void *)buf;
goldfish_tty_rw(qtty, address, count, 0);
goldfish_tty_rw(qtty, (unsigned long)buf, count, false);
tty_flip_buffer_push(&qtty->port);
return IRQ_HANDLED;

View File

@ -922,8 +922,7 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data,
return ERR_PTR(err);
}
hp = kzalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size,
GFP_KERNEL);
hp = kzalloc(struct_size(hp, outbuf, outbuf_size), GFP_KERNEL);
if (!hp)
return ERR_PTR(-ENOMEM);
@ -931,7 +930,6 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data,
hp->data = data;
hp->ops = ops;
hp->outbuf_size = outbuf_size;
hp->outbuf = &((char *)hp)[ALIGN(sizeof(*hp), sizeof(long))];
tty_port_init(&hp->port);
hp->port.ops = &hvc_port_ops;
@ -976,7 +974,7 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data,
}
EXPORT_SYMBOL_GPL(hvc_alloc);
int hvc_remove(struct hvc_struct *hp)
void hvc_remove(struct hvc_struct *hp)
{
unsigned long flags;
struct tty_struct *tty;
@ -1010,7 +1008,6 @@ int hvc_remove(struct hvc_struct *hp)
tty_vhangup(tty);
tty_kref_put(tty);
}
return 0;
}
EXPORT_SYMBOL_GPL(hvc_remove);

View File

@ -37,7 +37,6 @@ struct hvc_struct {
spinlock_t lock;
int index;
int do_wakeup;
char *outbuf;
int outbuf_size;
int n_outbuf;
uint32_t vtermno;
@ -48,12 +47,13 @@ struct hvc_struct {
struct work_struct tty_resize;
struct list_head next;
unsigned long flags;
u8 outbuf[] __aligned(sizeof(long));
};
/* implemented by a low level driver */
struct hv_ops {
int (*get_chars)(uint32_t vtermno, char *buf, int count);
int (*put_chars)(uint32_t vtermno, const char *buf, int count);
ssize_t (*get_chars)(uint32_t vtermno, u8 *buf, size_t count);
ssize_t (*put_chars)(uint32_t vtermno, const u8 *buf, size_t count);
int (*flush)(uint32_t vtermno, bool wait);
/* Callbacks for notification. Called in open, close and hangup */
@ -77,7 +77,7 @@ extern int hvc_instantiate(uint32_t vtermno, int index,
extern struct hvc_struct * hvc_alloc(uint32_t vtermno, int data,
const struct hv_ops *ops, int outbuf_size);
/* remove a vterm from hvc tty operation (module_exit or hotplug remove) */
extern int hvc_remove(struct hvc_struct *hp);
extern void hvc_remove(struct hvc_struct *hp);
/* data available */
int hvc_poll(struct hvc_struct *hp);

View File

@ -26,10 +26,10 @@
/* Lock to serialize access to DCC fifo */
static DEFINE_SPINLOCK(dcc_lock);
static DEFINE_KFIFO(inbuf, unsigned char, DCC_INBUF_SIZE);
static DEFINE_KFIFO(outbuf, unsigned char, DCC_OUTBUF_SIZE);
static DEFINE_KFIFO(inbuf, u8, DCC_INBUF_SIZE);
static DEFINE_KFIFO(outbuf, u8, DCC_OUTBUF_SIZE);
static void dcc_uart_console_putchar(struct uart_port *port, unsigned char ch)
static void dcc_uart_console_putchar(struct uart_port *port, u8 ch)
{
while (__dcc_getstatus() & DCC_STATUS_TX)
cpu_relax();
@ -47,6 +47,14 @@ static void dcc_early_write(struct console *con, const char *s, unsigned n)
static int __init dcc_early_console_setup(struct earlycon_device *device,
const char *opt)
{
unsigned int count = 0x4000000;
while (--count && (__dcc_getstatus() & DCC_STATUS_TX))
cpu_relax();
if (__dcc_getstatus() & DCC_STATUS_TX)
return -ENODEV;
device->con->write = dcc_early_write;
return 0;
@ -54,9 +62,9 @@ static int __init dcc_early_console_setup(struct earlycon_device *device,
EARLYCON_DECLARE(dcc, dcc_early_console_setup);
static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count)
static ssize_t hvc_dcc_put_chars(uint32_t vt, const u8 *buf, size_t count)
{
int i;
size_t i;
for (i = 0; i < count; i++) {
while (__dcc_getstatus() & DCC_STATUS_TX)
@ -68,9 +76,9 @@ static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count)
return count;
}
static int hvc_dcc_get_chars(uint32_t vt, char *buf, int count)
static ssize_t hvc_dcc_get_chars(uint32_t vt, u8 *buf, size_t count)
{
int i;
size_t i;
for (i = 0; i < count; ++i)
if (__dcc_getstatus() & DCC_STATUS_RX)
@ -149,8 +157,8 @@ static DECLARE_WORK(dcc_pwork, dcc_put_work);
*/
static void dcc_get_work(struct work_struct *work)
{
unsigned char ch;
unsigned long irqflags;
u8 ch;
/*
* Read characters from DCC and put them into the input FIFO, as
@ -172,10 +180,10 @@ static DECLARE_WORK(dcc_gwork, dcc_get_work);
* Write characters directly to the DCC if we're on core 0 and the FIFO
* is empty, or write them to the FIFO if we're not.
*/
static int hvc_dcc0_put_chars(u32 vt, const char *buf, int count)
static ssize_t hvc_dcc0_put_chars(u32 vt, const u8 *buf, size_t count)
{
int len;
unsigned long irqflags;
ssize_t len;
if (!IS_ENABLED(CONFIG_HVC_DCC_SERIALIZE_SMP))
return hvc_dcc_put_chars(vt, buf, count);
@ -211,10 +219,10 @@ static int hvc_dcc0_put_chars(u32 vt, const char *buf, int count)
* Read characters directly from the DCC if we're on core 0 and the FIFO
* is empty, or read them from the FIFO if we're not.
*/
static int hvc_dcc0_get_chars(u32 vt, char *buf, int count)
static ssize_t hvc_dcc0_get_chars(u32 vt, u8 *buf, size_t count)
{
int len;
unsigned long irqflags;
ssize_t len;
if (!IS_ENABLED(CONFIG_HVC_DCC_SERIALIZE_SMP))
return hvc_dcc_get_chars(vt, buf, count);

View File

@ -215,11 +215,11 @@ static void destroy_tty_buffer_list(struct list_head *list)
* If the IUCV path has been severed, then -EPIPE is returned to cause a
* hang up (that is issued by the HVC layer).
*/
static int hvc_iucv_write(struct hvc_iucv_private *priv,
char *buf, int count, int *has_more_data)
static ssize_t hvc_iucv_write(struct hvc_iucv_private *priv,
u8 *buf, size_t count, int *has_more_data)
{
struct iucv_tty_buffer *rb;
int written;
ssize_t written;
int rc;
/* immediately return if there is no IUCV connection */
@ -312,10 +312,10 @@ static int hvc_iucv_write(struct hvc_iucv_private *priv,
* the routine locks the struct hvc_iucv_private->lock to call
* helper functions.
*/
static int hvc_iucv_get_chars(uint32_t vtermno, char *buf, int count)
static ssize_t hvc_iucv_get_chars(uint32_t vtermno, u8 *buf, size_t count)
{
struct hvc_iucv_private *priv = hvc_iucv_get_private(vtermno);
int written;
ssize_t written;
int has_more_data;
if (count <= 0)
@ -352,8 +352,8 @@ static int hvc_iucv_get_chars(uint32_t vtermno, char *buf, int count)
* If an existing IUCV communicaton path has been severed, -EPIPE is returned
* (that can be passed to HVC layer to cause a tty hangup).
*/
static int hvc_iucv_queue(struct hvc_iucv_private *priv, const char *buf,
int count)
static ssize_t hvc_iucv_queue(struct hvc_iucv_private *priv, const u8 *buf,
size_t count)
{
size_t len;
@ -455,12 +455,12 @@ static void hvc_iucv_sndbuf_work(struct work_struct *work)
* Locking: The method gets called under an irqsave() spinlock; and
* locks struct hvc_iucv_private->lock.
*/
static int hvc_iucv_put_chars(uint32_t vtermno, const char *buf, int count)
static ssize_t hvc_iucv_put_chars(uint32_t vtermno, const u8 *buf, size_t count)
{
struct hvc_iucv_private *priv = hvc_iucv_get_private(vtermno);
int queued;
if (count <= 0)
if (!count)
return 0;
if (!priv)

View File

@ -58,7 +58,7 @@ static const struct hv_ops hvc_opal_raw_ops = {
.notifier_hangup = notifier_hangup_irq,
};
static int hvc_opal_hvsi_get_chars(uint32_t vtermno, char *buf, int count)
static ssize_t hvc_opal_hvsi_get_chars(uint32_t vtermno, u8 *buf, size_t count)
{
struct hvc_opal_priv *pv = hvc_opal_privs[vtermno];
@ -68,7 +68,8 @@ static int hvc_opal_hvsi_get_chars(uint32_t vtermno, char *buf, int count)
return hvsilib_get_chars(&pv->hvsi, buf, count);
}
static int hvc_opal_hvsi_put_chars(uint32_t vtermno, const char *buf, int count)
static ssize_t hvc_opal_hvsi_put_chars(uint32_t vtermno, const u8 *buf,
size_t count)
{
struct hvc_opal_priv *pv = hvc_opal_privs[vtermno];
@ -232,24 +233,21 @@ static int hvc_opal_probe(struct platform_device *dev)
return 0;
}
static int hvc_opal_remove(struct platform_device *dev)
static void hvc_opal_remove(struct platform_device *dev)
{
struct hvc_struct *hp = dev_get_drvdata(&dev->dev);
int rc, termno;
int termno;
termno = hp->vtermno;
rc = hvc_remove(hp);
if (rc == 0) {
if (hvc_opal_privs[termno] != &hvc_opal_boot_priv)
kfree(hvc_opal_privs[termno]);
hvc_opal_privs[termno] = NULL;
}
return rc;
hvc_remove(hp);
if (hvc_opal_privs[termno] != &hvc_opal_boot_priv)
kfree(hvc_opal_privs[termno]);
hvc_opal_privs[termno] = NULL;
}
static struct platform_driver hvc_opal_driver = {
.probe = hvc_opal_probe,
.remove = hvc_opal_remove,
.remove_new = hvc_opal_remove,
.driver = {
.name = hvc_opal_name,
.of_match_table = hvc_opal_match,

View File

@ -15,9 +15,9 @@
#include "hvc_console.h"
static int hvc_sbi_tty_put(uint32_t vtermno, const char *buf, int count)
static ssize_t hvc_sbi_tty_put(uint32_t vtermno, const u8 *buf, size_t count)
{
int i;
size_t i;
for (i = 0; i < count; i++)
sbi_console_putchar(buf[i]);
@ -25,9 +25,10 @@ static int hvc_sbi_tty_put(uint32_t vtermno, const char *buf, int count)
return i;
}
static int hvc_sbi_tty_get(uint32_t vtermno, char *buf, int count)
static ssize_t hvc_sbi_tty_get(uint32_t vtermno, u8 *buf, size_t count)
{
int i, c;
size_t i;
int c;
for (i = 0; i < count; i++) {
c = sbi_console_getchar();

View File

@ -31,10 +31,10 @@ static struct hvc_struct *hvc_rtas_dev;
static int rtascons_put_char_token = RTAS_UNKNOWN_SERVICE;
static int rtascons_get_char_token = RTAS_UNKNOWN_SERVICE;
static inline int hvc_rtas_write_console(uint32_t vtermno, const char *buf,
int count)
static ssize_t hvc_rtas_write_console(uint32_t vtermno, const u8 *buf,
size_t count)
{
int i;
size_t i;
for (i = 0; i < count; i++) {
if (rtas_call(rtascons_put_char_token, 1, 1, NULL, buf[i]))
@ -44,9 +44,10 @@ static inline int hvc_rtas_write_console(uint32_t vtermno, const char *buf,
return i;
}
static int hvc_rtas_read_console(uint32_t vtermno, char *buf, int count)
static ssize_t hvc_rtas_read_console(uint32_t vtermno, u8 *buf, size_t count)
{
int i, c;
size_t i;
int c;
for (i = 0; i < count; i++) {
if (rtas_call(rtascons_get_char_token, 0, 2, &c))

View File

@ -19,9 +19,9 @@
static struct hvc_struct *hvc_udbg_dev;
static int hvc_udbg_put(uint32_t vtermno, const char *buf, int count)
static ssize_t hvc_udbg_put(uint32_t vtermno, const u8 *buf, size_t count)
{
int i;
size_t i;
for (i = 0; i < count && udbg_putc; i++)
udbg_putc(buf[i]);
@ -29,9 +29,10 @@ static int hvc_udbg_put(uint32_t vtermno, const char *buf, int count)
return i;
}
static int hvc_udbg_get(uint32_t vtermno, char *buf, int count)
static ssize_t hvc_udbg_get(uint32_t vtermno, u8 *buf, size_t count)
{
int i, c;
size_t i;
int c;
if (!udbg_getc_poll)
return 0;

View File

@ -58,20 +58,20 @@ struct hvterm_priv {
hv_protocol_t proto; /* Raw data or HVSI packets */
struct hvsi_priv hvsi; /* HVSI specific data */
spinlock_t buf_lock;
char buf[SIZE_VIO_GET_CHARS];
int left;
int offset;
u8 buf[SIZE_VIO_GET_CHARS];
size_t left;
size_t offset;
};
static struct hvterm_priv *hvterm_privs[MAX_NR_HVC_CONSOLES];
/* For early boot console */
static struct hvterm_priv hvterm_priv0;
static int hvterm_raw_get_chars(uint32_t vtermno, char *buf, int count)
static ssize_t hvterm_raw_get_chars(uint32_t vtermno, u8 *buf, size_t count)
{
struct hvterm_priv *pv = hvterm_privs[vtermno];
unsigned long i;
unsigned long flags;
int got;
size_t got;
if (WARN_ON(!pv))
return 0;
@ -115,7 +115,8 @@ static int hvterm_raw_get_chars(uint32_t vtermno, char *buf, int count)
* you are sending fewer chars.
* @count: number of chars to send.
*/
static int hvterm_raw_put_chars(uint32_t vtermno, const char *buf, int count)
static ssize_t hvterm_raw_put_chars(uint32_t vtermno, const u8 *buf,
size_t count)
{
struct hvterm_priv *pv = hvterm_privs[vtermno];
@ -133,7 +134,7 @@ static const struct hv_ops hvterm_raw_ops = {
.notifier_hangup = notifier_hangup_irq,
};
static int hvterm_hvsi_get_chars(uint32_t vtermno, char *buf, int count)
static ssize_t hvterm_hvsi_get_chars(uint32_t vtermno, u8 *buf, size_t count)
{
struct hvterm_priv *pv = hvterm_privs[vtermno];
@ -143,7 +144,8 @@ static int hvterm_hvsi_get_chars(uint32_t vtermno, char *buf, int count)
return hvsilib_get_chars(&pv->hvsi, buf, count);
}
static int hvterm_hvsi_put_chars(uint32_t vtermno, const char *buf, int count)
static ssize_t hvterm_hvsi_put_chars(uint32_t vtermno, const u8 *buf,
size_t count)
{
struct hvterm_priv *pv = hvterm_privs[vtermno];

View File

@ -84,13 +84,13 @@ static inline void notify_daemon(struct xencons_info *cons)
notify_remote_via_evtchn(cons->evtchn);
}
static int __write_console(struct xencons_info *xencons,
const char *data, int len)
static ssize_t __write_console(struct xencons_info *xencons,
const u8 *data, size_t len)
{
XENCONS_RING_IDX cons, prod;
struct xencons_interface *intf = xencons->intf;
int sent = 0;
unsigned long flags;
size_t sent = 0;
spin_lock_irqsave(&xencons->ring_lock, flags);
cons = intf->out_cons;
@ -115,10 +115,11 @@ static int __write_console(struct xencons_info *xencons,
return sent;
}
static int domU_write_console(uint32_t vtermno, const char *data, int len)
static ssize_t domU_write_console(uint32_t vtermno, const u8 *data, size_t len)
{
int ret = len;
struct xencons_info *cons = vtermno_to_xencons(vtermno);
size_t ret = len;
if (cons == NULL)
return -EINVAL;
@ -129,7 +130,7 @@ static int domU_write_console(uint32_t vtermno, const char *data, int len)
* kernel is crippled.
*/
while (len) {
int sent = __write_console(cons, data, len);
ssize_t sent = __write_console(cons, data, len);
if (sent < 0)
return sent;
@ -144,14 +145,14 @@ static int domU_write_console(uint32_t vtermno, const char *data, int len)
return ret;
}
static int domU_read_console(uint32_t vtermno, char *buf, int len)
static ssize_t domU_read_console(uint32_t vtermno, u8 *buf, size_t len)
{
struct xencons_interface *intf;
XENCONS_RING_IDX cons, prod;
int recv = 0;
struct xencons_info *xencons = vtermno_to_xencons(vtermno);
unsigned int eoiflag = 0;
unsigned long flags;
size_t recv = 0;
if (xencons == NULL)
return -EINVAL;
@ -209,7 +210,7 @@ static const struct hv_ops domU_hvc_ops = {
.notifier_hangup = notifier_hangup_irq,
};
static int dom0_read_console(uint32_t vtermno, char *buf, int len)
static ssize_t dom0_read_console(uint32_t vtermno, u8 *buf, size_t len)
{
return HYPERVISOR_console_io(CONSOLEIO_read, len, buf);
}
@ -218,9 +219,9 @@ static int dom0_read_console(uint32_t vtermno, char *buf, int len)
* Either for a dom0 to write to the system console, or a domU with a
* debug version of Xen
*/
static int dom0_write_console(uint32_t vtermno, const char *str, int len)
static ssize_t dom0_write_console(uint32_t vtermno, const u8 *str, size_t len)
{
int rc = HYPERVISOR_console_io(CONSOLEIO_write, len, (char *)str);
int rc = HYPERVISOR_console_io(CONSOLEIO_write, len, (u8 *)str);
if (rc < 0)
return rc;

View File

@ -12,7 +12,7 @@ static int hvsi_send_packet(struct hvsi_priv *pv, struct hvsi_header *packet)
packet->seqno = cpu_to_be16(atomic_inc_return(&pv->seqno));
/* Assumes that always succeeds, works in practice */
return pv->put_chars(pv->termno, (char *)packet, packet->len);
return pv->put_chars(pv->termno, (u8 *)packet, packet->len);
}
static void hvsi_start_handshake(struct hvsi_priv *pv)
@ -178,9 +178,10 @@ static int hvsi_get_packet(struct hvsi_priv *pv)
return 0;
}
int hvsilib_get_chars(struct hvsi_priv *pv, char *buf, int count)
ssize_t hvsilib_get_chars(struct hvsi_priv *pv, u8 *buf, size_t count)
{
unsigned int tries, read = 0;
unsigned int tries;
size_t read = 0;
if (WARN_ON(!pv))
return -ENXIO;
@ -199,7 +200,7 @@ int hvsilib_get_chars(struct hvsi_priv *pv, char *buf, int count)
for (tries = 1; count && tries < 2; tries++) {
/* Consume existing data packet */
if (pv->inbuf_pktlen) {
unsigned int l = min(count, (int)pv->inbuf_pktlen);
size_t l = min(count, pv->inbuf_pktlen);
memcpy(&buf[read], &pv->inbuf[pv->inbuf_cur], l);
pv->inbuf_cur += l;
pv->inbuf_pktlen -= l;
@ -228,10 +229,11 @@ int hvsilib_get_chars(struct hvsi_priv *pv, char *buf, int count)
return read;
}
int hvsilib_put_chars(struct hvsi_priv *pv, const char *buf, int count)
ssize_t hvsilib_put_chars(struct hvsi_priv *pv, const u8 *buf, size_t count)
{
struct hvsi_data dp;
int rc, adjcount = min(count, HVSI_MAX_OUTGOING_DATA);
size_t adjcount = min_t(size_t, count, HVSI_MAX_OUTGOING_DATA);
int rc;
if (WARN_ON(!pv))
return -ENODEV;
@ -411,9 +413,9 @@ void hvsilib_close(struct hvsi_priv *pv, struct hvc_struct *hp)
}
void hvsilib_init(struct hvsi_priv *pv,
int (*get_chars)(uint32_t termno, char *buf, int count),
int (*put_chars)(uint32_t termno, const char *buf,
int count),
ssize_t (*get_chars)(uint32_t termno, u8 *buf, size_t count),
ssize_t (*put_chars)(uint32_t termno, const u8 *buf,
size_t count),
int termno, int is_console)
{
memset(pv, 0, sizeof(*pv));

View File

@ -49,9 +49,6 @@ struct ipw_dev {
void __iomem *common_memory;
/* Reference to attribute memory, containing CIS data */
void *attribute_memory;
/* Hardware context */
struct ipw_hardware *hardware;
/* Network layer context */

View File

@ -213,16 +213,16 @@ struct fdc_word {
*/
/* ranges >= 1 && sizes[0] >= 1 */
static struct fdc_word mips_ejtag_fdc_encode(const char **ptrs,
static struct fdc_word mips_ejtag_fdc_encode(const u8 **ptrs,
unsigned int *sizes,
unsigned int ranges)
{
struct fdc_word word = { 0, 0 };
const char **ptrs_end = ptrs + ranges;
const u8 **ptrs_end = ptrs + ranges;
for (; ptrs < ptrs_end; ++ptrs) {
const char *ptr = *(ptrs++);
const char *end = ptr + *(sizes++);
const u8 *ptr = *(ptrs++);
const u8 *end = ptr + *(sizes++);
for (; ptr < end; ++ptr) {
word.word |= (u8)*ptr << (8*word.bytes);
@ -417,7 +417,7 @@ static unsigned int mips_ejtag_fdc_put_chan(struct mips_ejtag_fdc_tty *priv,
{
struct mips_ejtag_fdc_tty_port *dport;
struct tty_struct *tty;
const char *ptrs[2];
const u8 *ptrs[2];
unsigned int sizes[2] = { 0 };
struct fdc_word word = { .bytes = 0 };
unsigned long flags;

View File

@ -514,7 +514,7 @@ static void MoxaPortLineCtrl(struct moxa_port *, bool, bool);
static void MoxaPortFlowCtrl(struct moxa_port *, int, int, int, int, int);
static int MoxaPortLineStatus(struct moxa_port *);
static void MoxaPortFlushData(struct moxa_port *, int);
static int MoxaPortWriteData(struct tty_struct *, const unsigned char *, int);
static ssize_t MoxaPortWriteData(struct tty_struct *, const u8 *, size_t);
static int MoxaPortReadData(struct moxa_port *);
static unsigned int MoxaPortTxQueue(struct moxa_port *);
static int MoxaPortRxQueue(struct moxa_port *);
@ -1933,10 +1933,10 @@ static void MoxaPortFlushData(struct moxa_port *port, int mode)
*
* Function 20: Write data.
* Syntax:
* int MoxaPortWriteData(int port, unsigned char * buffer, int length);
* ssize_t MoxaPortWriteData(int port, u8 *buffer, size_t length);
* int port : port number (0 - 127)
* unsigned char * buffer : pointer to write data buffer.
* int length : write data length
* u8 *buffer : pointer to write data buffer.
* size_t length : write data length
*
* return: 0 - length : real write data length
*
@ -2163,11 +2163,12 @@ static int MoxaPortLineStatus(struct moxa_port *port)
return val;
}
static int MoxaPortWriteData(struct tty_struct *tty, const u8 *buffer, int len)
static ssize_t MoxaPortWriteData(struct tty_struct *tty, const u8 *buffer,
size_t len)
{
struct moxa_port *port = tty->driver_data;
void __iomem *baseAddr, *ofsAddr, *ofs;
unsigned int c, total;
size_t c, total;
u16 head, tail, tx_mask, spage, epage;
u16 pageno, pageofs, bufhead;
@ -2224,8 +2225,8 @@ static int MoxaPortWriteData(struct tty_struct *tty, const u8 *buffer, int len)
static int MoxaPortReadData(struct moxa_port *port)
{
struct tty_struct *tty = port->port.tty;
unsigned char *dst;
void __iomem *baseAddr, *ofsAddr, *ofs;
u8 *dst;
unsigned int count, len, total;
u16 tail, rx_mask, spage, epage;
u16 pageno, pageofs, bufhead, head;

View File

@ -264,7 +264,7 @@ struct mxser_port {
u8 rx_low_water;
int type; /* UART type */
unsigned char x_char; /* xon/xoff character */
u8 x_char; /* xon/xoff character */
u8 IER; /* Interrupt Enable Register */
u8 MCR; /* Modem control register */
u8 FCR; /* FIFO control register */
@ -905,7 +905,7 @@ static ssize_t mxser_write(struct tty_struct *tty, const u8 *buf, size_t count)
{
struct mxser_port *info = tty->driver_data;
unsigned long flags;
int written;
size_t written;
bool is_empty;
spin_lock_irqsave(&info->slock, flags);
@ -1521,7 +1521,7 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty,
if (++ignored > 100)
break;
} else {
char flag = 0;
u8 flag = 0;
if (status & UART_LSR_BRK_ERROR_BITS) {
if (status & UART_LSR_BI) {
flag = TTY_BREAK;
@ -1585,7 +1585,7 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port
count = port->xmit_fifo_size;
do {
unsigned char c;
u8 c;
if (!kfifo_get(&port->port.xmit_fifo, &c))
break;

View File

@ -124,8 +124,8 @@ struct gsm_msg {
u8 addr; /* DLCI address + flags */
u8 ctrl; /* Control byte + flags */
unsigned int len; /* Length of data block (can be zero) */
unsigned char *data; /* Points into buffer but not at the start */
unsigned char buffer[];
u8 *data; /* Points into buffer but not at the start */
u8 buffer[];
};
enum gsm_dlci_state {
@ -283,7 +283,7 @@ struct gsm_mux {
/* Bits for GSM mode decoding */
/* Framing Layer */
unsigned char *buf;
u8 *buf;
enum gsm_mux_state state;
unsigned int len;
unsigned int address;
@ -2856,7 +2856,7 @@ static void gsm_queue(struct gsm_mux *gsm)
* Receive bytes in gsm mode 0
*/
static void gsm0_receive(struct gsm_mux *gsm, unsigned char c)
static void gsm0_receive(struct gsm_mux *gsm, u8 c)
{
unsigned int len;
@ -2947,7 +2947,7 @@ static void gsm0_receive(struct gsm_mux *gsm, unsigned char c)
* Receive bytes in mode 1 (Advanced option)
*/
static void gsm1_receive(struct gsm_mux *gsm, unsigned char c)
static void gsm1_receive(struct gsm_mux *gsm, u8 c)
{
/* handle XON/XOFF */
if ((c & ISO_IEC_646_MASK) == XON) {
@ -3541,7 +3541,7 @@ static void gsmld_receive_buf(struct tty_struct *tty, const u8 *cp,
const u8 *fp, size_t count)
{
struct gsm_mux *gsm = tty->disc_data;
char flags = TTY_NORMAL;
u8 flags = TTY_NORMAL;
if (debug & DBG_DATA)
gsm_hex_dump_bytes(__func__, cp, count);
@ -3711,7 +3711,7 @@ static ssize_t gsmld_write(struct tty_struct *tty, struct file *file,
{
struct gsm_mux *gsm = tty->disc_data;
unsigned long flags;
int space;
size_t space;
int ret;
if (!gsm)
@ -3909,8 +3909,7 @@ static void gsm_mux_net_tx_timeout(struct net_device *net, unsigned int txqueue)
net->stats.tx_errors++;
}
static void gsm_mux_rx_netchar(struct gsm_dlci *dlci,
const unsigned char *in_buf, int size)
static void gsm_mux_rx_netchar(struct gsm_dlci *dlci, const u8 *in_buf, int size)
{
struct net_device *net = dlci->net;
struct sk_buff *skb;

View File

@ -109,8 +109,8 @@
struct n_hdlc_buf {
struct list_head list_item;
int count;
char buf[];
size_t count;
u8 buf[];
};
struct n_hdlc_buf_list {
@ -263,9 +263,9 @@ static int n_hdlc_tty_open(struct tty_struct *tty)
*/
static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty)
{
register int actual;
unsigned long flags;
struct n_hdlc_buf *tbuf;
ssize_t actual;
check_again:
@ -281,7 +281,7 @@ static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty)
tbuf = n_hdlc_buf_get(&n_hdlc->tx_buf_list);
while (tbuf) {
pr_debug("sending frame %p, count=%d\n", tbuf, tbuf->count);
pr_debug("sending frame %p, count=%zu\n", tbuf, tbuf->count);
/* Send the next block of data to device */
set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
@ -521,9 +521,9 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
const u8 *data, size_t count)
{
struct n_hdlc *n_hdlc = tty->disc_data;
int error = 0;
DECLARE_WAITQUEUE(wait, current);
struct n_hdlc_buf *tbuf;
ssize_t error = 0;
pr_debug("%s() called count=%zd\n", __func__, count);

View File

@ -65,24 +65,8 @@ do { \
#define DBG3(args...) DBG_(0x04, ##args)
#define DBG4(args...) DBG_(0x08, ##args)
/* TODO: rewrite to optimize macros... */
#define TMP_BUF_MAX 256
#define DUMP(buf__, len__) \
do { \
char tbuf[TMP_BUF_MAX] = {0}; \
if (len__ > 1) { \
u32 data_len = min_t(u32, len__, TMP_BUF_MAX); \
strscpy(tbuf, buf__, data_len); \
if (tbuf[data_len - 2] == '\r') \
tbuf[data_len - 2] = 'r'; \
DBG1("SENDING: '%s' (%d+n)", tbuf, len__); \
} else { \
DBG1("SENDING: '%s' (%d)", tbuf, len__); \
} \
} while (0)
/* Defines */
#define NOZOMI_NAME "nozomi"
#define NOZOMI_NAME_TTY "nozomi_tty"
@ -754,8 +738,6 @@ static int send_data(enum port_type index, struct nozomi *dc)
return 0;
}
/* DUMP(buf, size); */
/* Write length + data */
write_mem32(addr, (u32 *) &size, 4);
write_mem32(addr + 4, (u32 *) dc->send_buf, size);
@ -801,11 +783,10 @@ static int receive_data(enum port_type index, struct nozomi *dc)
tty_insert_flip_char(&port->port, buf[0], TTY_NORMAL);
size = 0;
} else if (size < RECEIVE_BUF_MAX) {
size -= tty_insert_flip_string(&port->port,
(char *)buf, size);
size -= tty_insert_flip_string(&port->port, buf, size);
} else {
i = tty_insert_flip_string(&port->port,
(char *)buf, RECEIVE_BUF_MAX);
i = tty_insert_flip_string(&port->port, buf,
RECEIVE_BUF_MAX);
size -= i;
offset += i;
}
@ -1602,10 +1583,10 @@ static void ntty_hangup(struct tty_struct *tty)
static ssize_t ntty_write(struct tty_struct *tty, const u8 *buffer,
size_t count)
{
int rval = -EINVAL;
struct nozomi *dc = get_dc_by_tty(tty);
struct port *port = tty->driver_data;
unsigned long flags;
size_t rval;
if (!dc || !port)
return -ENODEV;

View File

@ -77,7 +77,7 @@ static bool is_serdev_device(const struct device *dev)
static void serdev_ctrl_release(struct device *dev)
{
struct serdev_controller *ctrl = to_serdev_controller(dev);
ida_simple_remove(&ctrl_ida, ctrl->nr);
ida_free(&ctrl_ida, ctrl->nr);
kfree(ctrl);
}
@ -225,8 +225,7 @@ EXPORT_SYMBOL_GPL(serdev_device_write_wakeup);
* Return: The number of bytes written (less than count if not enough room in
* the write buffer), or a negative errno on errors.
*/
int serdev_device_write_buf(struct serdev_device *serdev,
const unsigned char *buf, size_t count)
int serdev_device_write_buf(struct serdev_device *serdev, const u8 *buf, size_t count)
{
struct serdev_controller *ctrl = serdev->ctrl;
@ -259,13 +258,12 @@ EXPORT_SYMBOL_GPL(serdev_device_write_buf);
* -ETIMEDOUT or -ERESTARTSYS if interrupted before any bytes were written, or
* a negative errno on errors.
*/
int serdev_device_write(struct serdev_device *serdev,
const unsigned char *buf, size_t count,
long timeout)
ssize_t serdev_device_write(struct serdev_device *serdev, const u8 *buf,
size_t count, long timeout)
{
struct serdev_controller *ctrl = serdev->ctrl;
int written = 0;
int ret;
size_t written = 0;
ssize_t ret;
if (!ctrl || !ctrl->ops->write_buf || !serdev->ops->write_wakeup)
return -EINVAL;
@ -468,6 +466,7 @@ EXPORT_SYMBOL_GPL(serdev_device_alloc);
/**
* serdev_controller_alloc() - Allocate a new serdev controller
* @host: serial port hardware controller device
* @parent: parent device
* @size: size of private data
*
@ -476,8 +475,9 @@ EXPORT_SYMBOL_GPL(serdev_device_alloc);
* The allocated private data region may be accessed via
* serdev_controller_get_drvdata()
*/
struct serdev_controller *serdev_controller_alloc(struct device *parent,
size_t size)
struct serdev_controller *serdev_controller_alloc(struct device *host,
struct device *parent,
size_t size)
{
struct serdev_controller *ctrl;
int id;
@ -489,7 +489,7 @@ struct serdev_controller *serdev_controller_alloc(struct device *parent,
if (!ctrl)
return NULL;
id = ida_simple_get(&ctrl_ida, 0, 0, GFP_KERNEL);
id = ida_alloc(&ctrl_ida, GFP_KERNEL);
if (id < 0) {
dev_err(parent,
"unable to allocate serdev controller identifier.\n");
@ -502,7 +502,8 @@ struct serdev_controller *serdev_controller_alloc(struct device *parent,
ctrl->dev.type = &serdev_ctrl_type;
ctrl->dev.bus = &serdev_bus_type;
ctrl->dev.parent = parent;
device_set_node(&ctrl->dev, dev_fwnode(parent));
ctrl->host = host;
device_set_node(&ctrl->dev, dev_fwnode(host));
serdev_controller_set_drvdata(ctrl, &ctrl[1]);
dev_set_name(&ctrl->dev, "serial%d", id);
@ -665,7 +666,7 @@ static int acpi_serdev_check_resources(struct serdev_controller *ctrl,
acpi_get_parent(adev->handle, &lookup.controller_handle);
/* Make sure controller and ResourceSource handle match */
if (!device_match_acpi_handle(ctrl->dev.parent, lookup.controller_handle))
if (!device_match_acpi_handle(ctrl->host, lookup.controller_handle))
return -ENODEV;
return 0;
@ -730,7 +731,7 @@ static int acpi_serdev_register_devices(struct serdev_controller *ctrl)
bool skip;
int ret;
if (!has_acpi_companion(ctrl->dev.parent))
if (!has_acpi_companion(ctrl->host))
return -ENODEV;
/*
@ -739,7 +740,7 @@ static int acpi_serdev_register_devices(struct serdev_controller *ctrl)
* succeed in this case, so that the proper serdev devices can be
* added "manually" later.
*/
ret = acpi_quirk_skip_serdev_enumeration(ctrl->dev.parent, &skip);
ret = acpi_quirk_skip_serdev_enumeration(ctrl->host, &skip);
if (ret)
return ret;
if (skip)

View File

@ -74,7 +74,7 @@ static const struct tty_port_client_operations client_ops = {
* Callback functions from the serdev core.
*/
static int ttyport_write_buf(struct serdev_controller *ctrl, const unsigned char *data, size_t len)
static ssize_t ttyport_write_buf(struct serdev_controller *ctrl, const u8 *data, size_t len)
{
struct serport *serport = serdev_controller_get_drvdata(ctrl);
struct tty_struct *tty = serport->tty;
@ -274,6 +274,7 @@ static const struct serdev_controller_ops ctrl_ops = {
};
struct device *serdev_tty_port_register(struct tty_port *port,
struct device *host,
struct device *parent,
struct tty_driver *drv, int idx)
{
@ -284,7 +285,7 @@ struct device *serdev_tty_port_register(struct tty_port *port,
if (!port || !drv || !parent)
return ERR_PTR(-ENODEV);
ctrl = serdev_controller_alloc(parent, sizeof(struct serport));
ctrl = serdev_controller_alloc(host, parent, sizeof(struct serport));
if (!ctrl)
return ERR_PTR(-ENOMEM);
serport = serdev_controller_get_drvdata(ctrl);

View File

@ -566,7 +566,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev)
return rc;
}
static int aspeed_vuart_remove(struct platform_device *pdev)
static void aspeed_vuart_remove(struct platform_device *pdev)
{
struct aspeed_vuart *vuart = platform_get_drvdata(pdev);
@ -574,8 +574,6 @@ static int aspeed_vuart_remove(struct platform_device *pdev)
aspeed_vuart_set_enabled(vuart, false);
serial8250_unregister_port(vuart->line);
sysfs_remove_group(&vuart->dev->kobj, &aspeed_vuart_attr_group);
return 0;
}
static const struct of_device_id aspeed_vuart_table[] = {
@ -590,7 +588,7 @@ static struct platform_driver aspeed_vuart_driver = {
.of_match_table = aspeed_vuart_table,
},
.probe = aspeed_vuart_probe,
.remove = aspeed_vuart_remove,
.remove_new = aspeed_vuart_remove,
};
module_platform_driver(aspeed_vuart_driver);

View File

@ -119,6 +119,8 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)
/* get the clock - this also enables the HW */
data->clk = devm_clk_get_optional(&pdev->dev, NULL);
if (IS_ERR(data->clk))
return dev_err_probe(&pdev->dev, PTR_ERR(data->clk), "could not get clk\n");
/* get the interrupt */
ret = platform_get_irq(pdev, 0);
@ -195,14 +197,12 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)
return ret;
}
static int bcm2835aux_serial_remove(struct platform_device *pdev)
static void bcm2835aux_serial_remove(struct platform_device *pdev)
{
struct bcm2835aux_data *data = platform_get_drvdata(pdev);
serial8250_unregister_port(data->line);
clk_disable_unprepare(data->clk);
return 0;
}
static const struct bcm2835_aux_serial_driver_data bcm2835_acpi_data = {
@ -228,7 +228,7 @@ static struct platform_driver bcm2835aux_serial_driver = {
.acpi_match_table = bcm2835aux_serial_acpi_match,
},
.probe = bcm2835aux_serial_probe,
.remove = bcm2835aux_serial_remove,
.remove_new = bcm2835aux_serial_remove,
};
module_platform_driver(bcm2835aux_serial_driver);

View File

@ -1121,7 +1121,7 @@ static int brcmuart_probe(struct platform_device *pdev)
return ret;
}
static int brcmuart_remove(struct platform_device *pdev)
static void brcmuart_remove(struct platform_device *pdev)
{
struct brcmuart_priv *priv = platform_get_drvdata(pdev);
@ -1131,7 +1131,6 @@ static int brcmuart_remove(struct platform_device *pdev)
brcmuart_free_bufs(&pdev->dev, priv);
if (priv->dma_enabled)
brcmuart_arbitration(priv, 0);
return 0;
}
static int __maybe_unused brcmuart_suspend(struct device *dev)
@ -1207,7 +1206,7 @@ static struct platform_driver brcmuart_platform_driver = {
.of_match_table = brcmuart_dt_ids,
},
.probe = brcmuart_probe,
.remove = brcmuart_remove,
.remove_new = brcmuart_remove,
};
static int __init brcmuart_init(void)

View File

@ -883,7 +883,7 @@ static int serial8250_probe(struct platform_device *dev)
/*
* Remove serial ports registered against a platform device.
*/
static int serial8250_remove(struct platform_device *dev)
static void serial8250_remove(struct platform_device *dev)
{
int i;
@ -893,7 +893,6 @@ static int serial8250_remove(struct platform_device *dev)
if (up->port.dev == &dev->dev)
serial8250_unregister_port(i);
}
return 0;
}
static int serial8250_suspend(struct platform_device *dev, pm_message_t state)
@ -926,7 +925,7 @@ static int serial8250_resume(struct platform_device *dev)
static struct platform_driver serial8250_isa_driver = {
.probe = serial8250_probe,
.remove = serial8250_remove,
.remove_new = serial8250_remove,
.suspend = serial8250_suspend,
.resume = serial8250_resume,
.driver = {

View File

@ -663,7 +663,7 @@ static int dw8250_probe(struct platform_device *pdev)
return 0;
}
static int dw8250_remove(struct platform_device *pdev)
static void dw8250_remove(struct platform_device *pdev)
{
struct dw8250_data *data = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev;
@ -680,8 +680,6 @@ static int dw8250_remove(struct platform_device *pdev)
pm_runtime_disable(dev);
pm_runtime_put_noidle(dev);
return 0;
}
static int dw8250_suspend(struct device *dev)
@ -790,7 +788,7 @@ static struct platform_driver dw8250_platform_driver = {
.acpi_match_table = dw8250_acpi_match,
},
.probe = dw8250_probe,
.remove = dw8250_remove,
.remove_new = dw8250_remove,
};
module_platform_driver(dw8250_platform_driver);

View File

@ -259,17 +259,6 @@ void dw8250_setup_port(struct uart_port *p)
}
up->capabilities |= UART_CAP_NOTEMT;
/*
* If the Component Version Register returns zero, we know that
* ADDITIONAL_FEATURES are not enabled. No need to go any further.
*/
reg = dw8250_readl_ext(p, DW_UART_UCV);
if (!reg)
return;
dev_dbg(p->dev, "Designware UART version %c.%c%c\n",
(reg >> 24) & 0xff, (reg >> 16) & 0xff, (reg >> 8) & 0xff);
/* Preserve value written by firmware or bootloader */
old_dlf = dw8250_readl_ext(p, DW_UART_DLF);
dw8250_writel_ext(p, DW_UART_DLF, ~0U);
@ -282,6 +271,11 @@ void dw8250_setup_port(struct uart_port *p)
p->set_divisor = dw8250_set_divisor;
}
reg = dw8250_readl_ext(p, DW_UART_UCV);
if (reg)
dev_dbg(p->dev, "Designware UART version %c.%c%c\n",
(reg >> 24) & 0xff, (reg >> 16) & 0xff, (reg >> 8) & 0xff);
reg = dw8250_readl_ext(p, DW_UART_CPR);
if (!reg) {
reg = data->pdata->cpr_val;

View File

@ -200,12 +200,11 @@ static int serial8250_em_probe(struct platform_device *pdev)
return 0;
}
static int serial8250_em_remove(struct platform_device *pdev)
static void serial8250_em_remove(struct platform_device *pdev)
{
struct serial8250_em_priv *priv = platform_get_drvdata(pdev);
serial8250_unregister_port(priv->line);
return 0;
}
static const struct of_device_id serial8250_em_dt_ids[] = {
@ -220,7 +219,7 @@ static struct platform_driver serial8250_em_platform_driver = {
.of_match_table = serial8250_em_dt_ids,
},
.probe = serial8250_em_probe,
.remove = serial8250_em_remove,
.remove_new = serial8250_em_remove,
};
module_platform_driver(serial8250_em_platform_driver);

View File

@ -480,7 +480,7 @@ static int sealevel_rs485_config(struct uart_port *port, struct ktermios *termio
}
static const struct serial_rs485 generic_rs485_supported = {
.flags = SER_RS485_ENABLED,
.flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND,
};
static const struct exar8250_platform exar8250_default_platform = {
@ -524,7 +524,8 @@ static int iot2040_rs485_config(struct uart_port *port, struct ktermios *termios
}
static const struct serial_rs485 iot2040_rs485_supported = {
.flags = SER_RS485_ENABLED | SER_RS485_RX_DURING_TX | SER_RS485_TERMINATE_BUS,
.flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND |
SER_RS485_RX_DURING_TX | SER_RS485_TERMINATE_BUS,
};
static const struct property_entry iot2040_gpio_properties[] = {

View File

@ -51,7 +51,8 @@ int fsl8250_handle_irq(struct uart_port *port)
* immediately and interrupt the CPU again. The hardware clears LSR.BI
* when the next valid char is read.)
*/
if (unlikely(up->lsr_saved_flags & UART_LSR_BI)) {
if (unlikely((iir & UART_IIR_ID) == UART_IIR_RLSI &&
(up->lsr_saved_flags & UART_LSR_BI))) {
up->lsr_saved_flags &= ~UART_LSR_BI;
port->serial_in(port, UART_RX);
uart_port_unlock_irqrestore(&up->port, flags);
@ -159,12 +160,11 @@ static int fsl8250_acpi_probe(struct platform_device *pdev)
return 0;
}
static int fsl8250_acpi_remove(struct platform_device *pdev)
static void fsl8250_acpi_remove(struct platform_device *pdev)
{
struct fsl8250_data *data = platform_get_drvdata(pdev);
serial8250_unregister_port(data->line);
return 0;
}
static const struct acpi_device_id fsl_8250_acpi_id[] = {
@ -179,7 +179,7 @@ static struct platform_driver fsl8250_platform_driver = {
.acpi_match_table = ACPI_PTR(fsl_8250_acpi_id),
},
.probe = fsl8250_acpi_probe,
.remove = fsl8250_acpi_remove,
.remove_new = fsl8250_acpi_remove,
};
module_platform_driver(fsl8250_platform_driver);

View File

@ -320,14 +320,13 @@ static int ingenic_uart_probe(struct platform_device *pdev)
return err;
}
static int ingenic_uart_remove(struct platform_device *pdev)
static void ingenic_uart_remove(struct platform_device *pdev)
{
struct ingenic_uart_data *data = platform_get_drvdata(pdev);
serial8250_unregister_port(data->line);
clk_disable_unprepare(data->clk_module);
clk_disable_unprepare(data->clk_baud);
return 0;
}
static const struct ingenic_uart_config jz4740_uart_config = {
@ -368,7 +367,7 @@ static struct platform_driver ingenic_uart_platform_driver = {
.of_match_table = of_match,
},
.probe = ingenic_uart_probe,
.remove = ingenic_uart_remove,
.remove_new = ingenic_uart_remove,
};
module_platform_driver(ingenic_uart_platform_driver);

View File

@ -75,17 +75,16 @@ static int serial8250_ioc3_probe(struct platform_device *pdev)
return 0;
}
static int serial8250_ioc3_remove(struct platform_device *pdev)
static void serial8250_ioc3_remove(struct platform_device *pdev)
{
struct ioc3_8250_data *data = platform_get_drvdata(pdev);
serial8250_unregister_port(data->line);
return 0;
}
static struct platform_driver serial8250_ioc3_driver = {
.probe = serial8250_ioc3_probe,
.remove = serial8250_ioc3_remove,
.remove_new = serial8250_ioc3_remove,
.driver = {
.name = "ioc3-serial8250",
}

View File

@ -182,15 +182,13 @@ static int lpc18xx_serial_probe(struct platform_device *pdev)
return ret;
}
static int lpc18xx_serial_remove(struct platform_device *pdev)
static void lpc18xx_serial_remove(struct platform_device *pdev)
{
struct lpc18xx_uart_data *data = platform_get_drvdata(pdev);
serial8250_unregister_port(data->line);
clk_disable_unprepare(data->clk_uart);
clk_disable_unprepare(data->clk_reg);
return 0;
}
static const struct of_device_id lpc18xx_serial_match[] = {
@ -201,7 +199,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_serial_match);
static struct platform_driver lpc18xx_serial_driver = {
.probe = lpc18xx_serial_probe,
.remove = lpc18xx_serial_remove,
.remove_new = lpc18xx_serial_remove,
.driver = {
.name = "lpc18xx-uart",
.of_match_table = lpc18xx_serial_match,

View File

@ -287,17 +287,14 @@ static int lpss8250_dma_setup(struct lpss8250 *lpss, struct uart_8250_port *port
return 0;
}
rx_param = devm_kzalloc(dev, sizeof(*rx_param), GFP_KERNEL);
rx_param = devm_kmemdup(dev, &lpss->dma_param, sizeof(*rx_param), GFP_KERNEL);
if (!rx_param)
return -ENOMEM;
tx_param = devm_kzalloc(dev, sizeof(*tx_param), GFP_KERNEL);
tx_param = devm_kmemdup(dev, &lpss->dma_param, sizeof(*tx_param), GFP_KERNEL);
if (!tx_param)
return -ENOMEM;
*rx_param = lpss->dma_param;
*tx_param = lpss->dma_param;
dma->fn = lpss8250_dma_filter;
dma->rx_param = rx_param;
dma->tx_param = tx_param;

View File

@ -581,7 +581,7 @@ static int mtk8250_probe(struct platform_device *pdev)
return 0;
}
static int mtk8250_remove(struct platform_device *pdev)
static void mtk8250_remove(struct platform_device *pdev)
{
struct mtk8250_data *data = platform_get_drvdata(pdev);
@ -591,8 +591,6 @@ static int mtk8250_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
return 0;
}
static int __maybe_unused mtk8250_suspend(struct device *dev)
@ -652,7 +650,7 @@ static struct platform_driver mtk8250_platform_driver = {
.of_match_table = mtk8250_of_match,
},
.probe = mtk8250_probe,
.remove = mtk8250_remove,
.remove_new = mtk8250_remove,
};
module_platform_driver(mtk8250_platform_driver);

View File

@ -251,7 +251,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
/*
* Release a line
*/
static int of_platform_serial_remove(struct platform_device *ofdev)
static void of_platform_serial_remove(struct platform_device *ofdev)
{
struct of_serial_info *info = platform_get_drvdata(ofdev);
@ -261,7 +261,6 @@ static int of_platform_serial_remove(struct platform_device *ofdev)
pm_runtime_put_sync(&ofdev->dev);
pm_runtime_disable(&ofdev->dev);
kfree(info);
return 0;
}
#ifdef CONFIG_PM_SLEEP
@ -337,7 +336,7 @@ static struct platform_driver of_platform_serial_driver = {
.pm = &of_serial_pm_ops,
},
.probe = of_platform_serial_probe,
.remove = of_platform_serial_remove,
.remove_new = of_platform_serial_remove,
};
module_platform_driver(of_platform_serial_driver);

View File

@ -1586,7 +1586,7 @@ static int omap8250_probe(struct platform_device *pdev)
return ret;
}
static int omap8250_remove(struct platform_device *pdev)
static void omap8250_remove(struct platform_device *pdev)
{
struct omap8250_priv *priv = platform_get_drvdata(pdev);
struct uart_8250_port *up;
@ -1594,7 +1594,7 @@ static int omap8250_remove(struct platform_device *pdev)
err = pm_runtime_resume_and_get(&pdev->dev);
if (err)
return err;
dev_err(&pdev->dev, "Failed to resume hardware\n");
up = serial8250_get_port(priv->line);
omap_8250_shutdown(&up->port);
@ -1606,7 +1606,6 @@ static int omap8250_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
cpu_latency_qos_remove_request(&priv->pm_qos_request);
device_init_wakeup(&pdev->dev, false);
return 0;
}
static int omap8250_prepare(struct device *dev)
@ -1865,7 +1864,7 @@ static struct platform_driver omap8250_platform_driver = {
.of_match_table = omap8250_dt_ids,
},
.probe = omap8250_probe,
.remove = omap8250_remove,
.remove_new = omap8250_remove,
};
module_platform_driver(omap8250_platform_driver);

View File

@ -19,6 +19,7 @@
#include <linux/serial_core.h>
#include <linux/8250_pci.h>
#include <linux/bitops.h>
#include <linux/bitfield.h>
#include <asm/byteorder.h>
#include <asm/io.h>
@ -1970,6 +1971,20 @@ pci_sunix_setup(struct serial_private *priv,
#define MOXA_GPIO_PIN2 BIT(2)
#define MOXA_RS232 0x00
#define MOXA_RS422 0x01
#define MOXA_RS485_4W 0x0B
#define MOXA_RS485_2W 0x0F
#define MOXA_UIR_OFFSET 0x04
#define MOXA_EVEN_RS_MASK GENMASK(3, 0)
#define MOXA_ODD_RS_MASK GENMASK(7, 4)
enum {
MOXA_SUPP_RS232 = BIT(0),
MOXA_SUPP_RS422 = BIT(1),
MOXA_SUPP_RS485 = BIT(2),
};
static bool pci_moxa_is_mini_pcie(unsigned short device)
{
if (device == PCI_DEVICE_ID_MOXA_CP102N ||
@ -1983,12 +1998,54 @@ static bool pci_moxa_is_mini_pcie(unsigned short device)
return false;
}
static unsigned int pci_moxa_supported_rs(struct pci_dev *dev)
{
switch (dev->device & 0x0F00) {
case 0x0000:
case 0x0600:
return MOXA_SUPP_RS232;
case 0x0100:
return MOXA_SUPP_RS232 | MOXA_SUPP_RS422 | MOXA_SUPP_RS485;
case 0x0300:
return MOXA_SUPP_RS422 | MOXA_SUPP_RS485;
}
return 0;
}
static int pci_moxa_set_interface(const struct pci_dev *dev,
unsigned int port_idx,
u8 mode)
{
resource_size_t iobar_addr = pci_resource_start(dev, 2);
resource_size_t UIR_addr = iobar_addr + MOXA_UIR_OFFSET + port_idx / 2;
u8 val;
val = inb(UIR_addr);
if (port_idx % 2) {
val &= ~MOXA_ODD_RS_MASK;
val |= FIELD_PREP(MOXA_ODD_RS_MASK, mode);
} else {
val &= ~MOXA_EVEN_RS_MASK;
val |= FIELD_PREP(MOXA_EVEN_RS_MASK, mode);
}
outb(val, UIR_addr);
return 0;
}
static int pci_moxa_init(struct pci_dev *dev)
{
unsigned short device = dev->device;
resource_size_t iobar_addr = pci_resource_start(dev, 2);
unsigned int num_ports = (device & 0x00F0) >> 4;
u8 val;
unsigned int num_ports = (device & 0x00F0) >> 4, i;
u8 val, init_mode = MOXA_RS232;
if (!(pci_moxa_supported_rs(dev) & MOXA_SUPP_RS232)) {
init_mode = MOXA_RS422;
}
for (i = 0; i < num_ports; ++i)
pci_moxa_set_interface(dev, i, init_mode);
/*
* Enable hardware buffer to prevent break signal output when system boots up.

View File

@ -9,15 +9,21 @@
#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/serial_core.h>
#include <linux/serial_reg.h>
#include <linux/serial_8250.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/units.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/8250_pci.h>
#include <asm/byteorder.h>
@ -52,6 +58,17 @@
#define PCI_SUBDEVICE_ID_EFAR_PCI11400 PCI_DEVICE_ID_EFAR_PCI11400
#define PCI_SUBDEVICE_ID_EFAR_PCI11414 PCI_DEVICE_ID_EFAR_PCI11414
#define UART_SYSTEM_ADDR_BASE 0x1000
#define UART_DEV_REV_REG (UART_SYSTEM_ADDR_BASE + 0x00)
#define UART_DEV_REV_MASK GENMASK(7, 0)
#define UART_SYSLOCK_REG (UART_SYSTEM_ADDR_BASE + 0xA0)
#define UART_SYSLOCK BIT(2)
#define SYSLOCK_SLEEP_TIMEOUT 100
#define SYSLOCK_RETRY_CNT 1000
#define UART_RX_BYTE_FIFO 0x00
#define UART_FIFO_CTL 0x02
#define UART_ACTV_REG 0x11
#define UART_BLOCK_SET_ACTIVE BIT(0)
@ -82,8 +99,59 @@
#define UART_RESET_REG 0x94
#define UART_RESET_D3_RESET_DISABLE BIT(16)
#define UART_BURST_STATUS_REG 0x9C
#define UART_RX_BURST_FIFO 0xA4
#define MAX_PORTS 4
#define PORT_OFFSET 0x100
#define RX_BUF_SIZE 512
#define UART_BYTE_SIZE 1
#define UART_BURST_SIZE 4
#define UART_BST_STAT_RX_COUNT_MASK 0x00FF
#define UART_BST_STAT_IIR_INT_PEND 0x100000
#define UART_LSR_OVERRUN_ERR_CLR 0x43
#define UART_BST_STAT_LSR_RX_MASK 0x9F000000
#define UART_BST_STAT_LSR_RX_ERR_MASK 0x9E000000
#define UART_BST_STAT_LSR_OVERRUN_ERR 0x2000000
#define UART_BST_STAT_LSR_PARITY_ERR 0x4000000
#define UART_BST_STAT_LSR_FRAME_ERR 0x8000000
struct pci1xxxx_8250 {
unsigned int nr;
u8 dev_rev;
u8 pad[3];
void __iomem *membase;
int line[] __counted_by(nr);
};
static const struct serial_rs485 pci1xxxx_rs485_supported = {
.flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND |
SER_RS485_RTS_AFTER_SEND,
.delay_rts_after_send = 1,
/* Delay RTS before send is not supported */
};
static int pci1xxxx_set_sys_lock(struct pci1xxxx_8250 *port)
{
writel(UART_SYSLOCK, port->membase + UART_SYSLOCK_REG);
return readl(port->membase + UART_SYSLOCK_REG);
}
static int pci1xxxx_acquire_sys_lock(struct pci1xxxx_8250 *port)
{
u32 regval;
return readx_poll_timeout(pci1xxxx_set_sys_lock, port, regval,
(regval & UART_SYSLOCK),
SYSLOCK_SLEEP_TIMEOUT,
SYSLOCK_RETRY_CNT * SYSLOCK_SLEEP_TIMEOUT);
}
static void pci1xxxx_release_sys_lock(struct pci1xxxx_8250 *port)
{
writel(0x0, port->membase + UART_SYSLOCK_REG);
}
static const int logical_to_physical_port_idx[][MAX_PORTS] = {
{0, 1, 2, 3}, /* PCI12000, PCI11010, PCI11101, PCI11400, PCI11414 */
@ -104,12 +172,6 @@ static const int logical_to_physical_port_idx[][MAX_PORTS] = {
{3, -1, -1, -1}, /* PCI1p3 */
};
struct pci1xxxx_8250 {
unsigned int nr;
void __iomem *membase;
int line[] __counted_by(nr);
};
static int pci1xxxx_get_num_ports(struct pci_dev *dev)
{
switch (dev->subsystem_device) {
@ -205,12 +267,102 @@ static int pci1xxxx_rs485_config(struct uart_port *port,
return 0;
}
static const struct serial_rs485 pci1xxxx_rs485_supported = {
.flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND |
SER_RS485_RTS_AFTER_SEND,
.delay_rts_after_send = 1,
/* Delay RTS before send is not supported */
};
static u32 pci1xxxx_read_burst_status(struct uart_port *port)
{
u32 status;
status = readl(port->membase + UART_BURST_STATUS_REG);
if (status & UART_BST_STAT_LSR_RX_ERR_MASK) {
if (status & UART_BST_STAT_LSR_OVERRUN_ERR) {
writeb(UART_LSR_OVERRUN_ERR_CLR,
port->membase + UART_FIFO_CTL);
port->icount.overrun++;
}
if (status & UART_BST_STAT_LSR_FRAME_ERR)
port->icount.frame++;
if (status & UART_BST_STAT_LSR_PARITY_ERR)
port->icount.parity++;
}
return status;
}
static void pci1xxxx_process_read_data(struct uart_port *port,
unsigned char *rx_buff, u32 *buff_index,
u32 *valid_byte_count)
{
u32 valid_burst_count = *valid_byte_count / UART_BURST_SIZE;
u32 *burst_buf;
/*
* Depending on the RX Trigger Level the number of bytes that can be
* stored in RX FIFO at a time varies. Each transaction reads data
* in DWORDs. If there are less than four remaining valid_byte_count
* to read, the data is received one byte at a time.
*/
while (valid_burst_count--) {
if (*buff_index > (RX_BUF_SIZE - UART_BURST_SIZE))
break;
burst_buf = (u32 *)&rx_buff[*buff_index];
*burst_buf = readl(port->membase + UART_RX_BURST_FIFO);
*buff_index += UART_BURST_SIZE;
*valid_byte_count -= UART_BURST_SIZE;
}
while (*valid_byte_count) {
if (*buff_index > RX_BUF_SIZE)
break;
rx_buff[*buff_index] = readb(port->membase +
UART_RX_BYTE_FIFO);
*buff_index += UART_BYTE_SIZE;
*valid_byte_count -= UART_BYTE_SIZE;
}
}
static void pci1xxxx_rx_burst(struct uart_port *port, u32 uart_status)
{
u32 valid_byte_count = uart_status & UART_BST_STAT_RX_COUNT_MASK;
struct tty_port *tty_port = &port->state->port;
unsigned char rx_buff[RX_BUF_SIZE];
u32 buff_index = 0;
u32 copied_len;
if (valid_byte_count != 0 &&
valid_byte_count < RX_BUF_SIZE) {
pci1xxxx_process_read_data(port, rx_buff, &buff_index,
&valid_byte_count);
copied_len = (u32)tty_insert_flip_string(tty_port, rx_buff,
buff_index);
if (copied_len != buff_index)
port->icount.overrun += buff_index - copied_len;
port->icount.rx += buff_index;
tty_flip_buffer_push(tty_port);
}
}
static int pci1xxxx_handle_irq(struct uart_port *port)
{
unsigned long flags;
u32 status;
status = pci1xxxx_read_burst_status(port);
if (status & UART_BST_STAT_IIR_INT_PEND)
return 0;
spin_lock_irqsave(&port->lock, flags);
if (status & UART_BST_STAT_LSR_RX_MASK)
pci1xxxx_rx_burst(port, status);
spin_unlock_irqrestore(&port->lock, flags);
return 1;
}
static bool pci1xxxx_port_suspend(int line)
{
@ -323,7 +475,7 @@ static int pci1xxxx_resume(struct device *dev)
}
static int pci1xxxx_setup(struct pci_dev *pdev,
struct uart_8250_port *port, int port_idx)
struct uart_8250_port *port, int port_idx, int rev)
{
int ret;
@ -335,6 +487,10 @@ static int pci1xxxx_setup(struct pci_dev *pdev,
port->port.rs485_config = pci1xxxx_rs485_config;
port->port.rs485_supported = pci1xxxx_rs485_supported;
/* From C0 rev Burst operation is supported */
if (rev >= 0xC0)
port->port.handle_irq = pci1xxxx_handle_irq;
ret = serial8250_pci_setup_port(pdev, port, 0, PORT_OFFSET * port_idx, 0);
if (ret < 0)
return ret;
@ -370,6 +526,27 @@ static int pci1xxxx_logical_to_physical_port_translate(int subsys_dev, int port)
return logical_to_physical_port_idx[0][port];
}
static int pci1xxxx_get_device_revision(struct pci1xxxx_8250 *priv)
{
u32 regval;
int ret;
/*
* DEV REV is a system register, HW Syslock bit
* should be acquired before accessing the register
*/
ret = pci1xxxx_acquire_sys_lock(priv);
if (ret)
return ret;
regval = readl(priv->membase + UART_DEV_REV_REG);
priv->dev_rev = regval & UART_DEV_REV_MASK;
pci1xxxx_release_sys_lock(priv);
return 0;
}
static int pci1xxxx_serial_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
@ -381,6 +558,7 @@ static int pci1xxxx_serial_probe(struct pci_dev *pdev,
int num_vectors;
int subsys_dev;
int port_idx;
int ret;
int rc;
rc = pcim_enable_device(pdev);
@ -397,6 +575,10 @@ static int pci1xxxx_serial_probe(struct pci_dev *pdev,
if (!priv->membase)
return -ENOMEM;
ret = pci1xxxx_get_device_revision(priv);
if (ret)
return ret;
pci_set_master(pdev);
priv->nr = nr_ports;
@ -428,7 +610,7 @@ static int pci1xxxx_serial_probe(struct pci_dev *pdev,
else
uart.port.irq = pci_irq_vector(pdev, 0);
rc = pci1xxxx_setup(pdev, &uart, port_idx);
rc = pci1xxxx_setup(pdev, &uart, port_idx, priv->dev_rev);
if (rc) {
dev_warn(dev, "Failed to setup port %u\n", i);
continue;

View File

@ -146,20 +146,18 @@ static int serial_pxa_probe(struct platform_device *pdev)
return ret;
}
static int serial_pxa_remove(struct platform_device *pdev)
static void serial_pxa_remove(struct platform_device *pdev)
{
struct pxa8250_data *data = platform_get_drvdata(pdev);
serial8250_unregister_port(data->line);
clk_unprepare(data->clk);
return 0;
}
static struct platform_driver serial_pxa_driver = {
.probe = serial_pxa_probe,
.remove = serial_pxa_remove,
.remove_new = serial_pxa_remove,
.driver = {
.name = "pxa2xx-uart",

View File

@ -128,15 +128,13 @@ static int tegra_uart_probe(struct platform_device *pdev)
return ret;
}
static int tegra_uart_remove(struct platform_device *pdev)
static void tegra_uart_remove(struct platform_device *pdev)
{
struct tegra_uart *uart = platform_get_drvdata(pdev);
serial8250_unregister_port(uart->line);
reset_control_assert(uart->rst);
clk_disable_unprepare(uart->clk);
return 0;
}
#ifdef CONFIG_PM_SLEEP
@ -192,7 +190,7 @@ static struct platform_driver tegra_uart_driver = {
.acpi_match_table = ACPI_PTR(tegra_uart_acpi_match),
},
.probe = tegra_uart_probe,
.remove = tegra_uart_remove,
.remove_new = tegra_uart_remove,
};
module_platform_driver(tegra_uart_driver);

View File

@ -241,14 +241,12 @@ static int uniphier_uart_probe(struct platform_device *pdev)
return 0;
}
static int uniphier_uart_remove(struct platform_device *pdev)
static void uniphier_uart_remove(struct platform_device *pdev)
{
struct uniphier8250_priv *priv = platform_get_drvdata(pdev);
serial8250_unregister_port(priv->line);
clk_disable_unprepare(priv->clk);
return 0;
}
static int __maybe_unused uniphier_uart_suspend(struct device *dev)
@ -293,7 +291,7 @@ MODULE_DEVICE_TABLE(of, uniphier_uart_match);
static struct platform_driver uniphier_uart_platform_driver = {
.probe = uniphier_uart_probe,
.remove = uniphier_uart_remove,
.remove_new = uniphier_uart_remove,
.driver = {
.name = "uniphier-uart",
.of_match_table = uniphier_uart_match,

View File

@ -90,12 +90,6 @@ struct serial_info {
const struct serial_quirk *quirk;
};
struct serial_cfg_mem {
tuple_t tuple;
cisparse_t parse;
u_char buf[256];
};
/*
* vers_1 5.0, "Brain Boxes", "2-Port RS232 card", "r6"
* manfid 0x0160, 0x0104

View File

@ -532,6 +532,9 @@ config SERIAL_UARTLITE_NR_UARTS
help
Set this to the number of uartlites in your system, or the number
you think you might implement.
If maximum number of uartlite serial ports is more than 4, then the
driver uses dynamic allocation instead of static allocation for major
number.
config SERIAL_SUNCORE
bool

View File

@ -425,7 +425,7 @@ static int altera_jtaguart_probe(struct platform_device *pdev)
return 0;
}
static int altera_jtaguart_remove(struct platform_device *pdev)
static void altera_jtaguart_remove(struct platform_device *pdev)
{
struct uart_port *port;
int i = pdev->id;
@ -436,8 +436,6 @@ static int altera_jtaguart_remove(struct platform_device *pdev)
port = &altera_jtaguart_ports[i];
uart_remove_one_port(&altera_jtaguart_driver, port);
iounmap(port->membase);
return 0;
}
#ifdef CONFIG_OF
@ -451,7 +449,7 @@ MODULE_DEVICE_TABLE(of, altera_jtaguart_match);
static struct platform_driver altera_jtaguart_platform_driver = {
.probe = altera_jtaguart_probe,
.remove = altera_jtaguart_remove,
.remove_new = altera_jtaguart_remove,
.driver = {
.name = DRV_NAME,
.of_match_table = of_match_ptr(altera_jtaguart_match),

Some files were not shown because too many files have changed in this diff Show More