vcc.c (69851e4ab8feeb369119a44ddca430c0ee15f0d8) | vcc.c (95713967ba52389f7cea75704d0cf048080ec218) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* vcc.c: sun4v virtual channel concentrator 3 * 4 * Copyright (C) 2017 Oracle. All rights reserved. 5 */ 6 7#include <linux/delay.h> 8#include <linux/interrupt.h> --- 790 unchanged lines hidden (view full) --- 799 800 vcc_ldc_hup(port); 801 802 vcc_put(port, false); 803 804 tty_port_hangup(tty->port); 805} 806 | 1// SPDX-License-Identifier: GPL-2.0 2/* vcc.c: sun4v virtual channel concentrator 3 * 4 * Copyright (C) 2017 Oracle. All rights reserved. 5 */ 6 7#include <linux/delay.h> 8#include <linux/interrupt.h> --- 790 unchanged lines hidden (view full) --- 799 800 vcc_ldc_hup(port); 801 802 vcc_put(port, false); 803 804 tty_port_hangup(tty->port); 805} 806 |
807static int vcc_write(struct tty_struct *tty, const u8 *buf, int count) | 807static ssize_t vcc_write(struct tty_struct *tty, const u8 *buf, size_t count) |
808{ 809 struct vcc_port *port; 810 struct vio_vcc *pkt; 811 unsigned long flags; 812 int total_sent = 0; 813 int tosend = 0; 814 int rv = -EINVAL; 815 --- 5 unchanged lines hidden (view full) --- 821 822 spin_lock_irqsave(&port->lock, flags); 823 824 pkt = &port->buffer; 825 pkt->tag.type = VIO_TYPE_DATA; 826 827 while (count > 0) { 828 /* Minimum of data to write and space available */ | 808{ 809 struct vcc_port *port; 810 struct vio_vcc *pkt; 811 unsigned long flags; 812 int total_sent = 0; 813 int tosend = 0; 814 int rv = -EINVAL; 815 --- 5 unchanged lines hidden (view full) --- 821 822 spin_lock_irqsave(&port->lock, flags); 823 824 pkt = &port->buffer; 825 pkt->tag.type = VIO_TYPE_DATA; 826 827 while (count > 0) { 828 /* Minimum of data to write and space available */ |
829 tosend = min(count, (VCC_BUFF_LEN - port->chars_in_buffer)); | 829 tosend = min_t(size_t, count, 830 (VCC_BUFF_LEN - port->chars_in_buffer)); |
830 831 if (!tosend) 832 break; 833 834 memcpy(&pkt->data[port->chars_in_buffer], &buf[total_sent], 835 tosend); 836 port->chars_in_buffer += tosend; 837 pkt->tag.stype = tosend; --- 243 unchanged lines hidden --- | 831 832 if (!tosend) 833 break; 834 835 memcpy(&pkt->data[port->chars_in_buffer], &buf[total_sent], 836 tosend); 837 port->chars_in_buffer += tosend; 838 pkt->tag.stype = tosend; --- 243 unchanged lines hidden --- |