Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tty: hvc: convert counts to size_t

Unify the type of tty_operations::write() counters with the 'count'
parameter. I.e. use size_t for them.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230810091510.13006-33-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
8428e522 49b8220c

+9 -9
+1 -1
drivers/tty/hvc/hvc_console.c
··· 500 500 { 501 501 struct hvc_struct *hp = tty->driver_data; 502 502 unsigned long flags; 503 - int rsize, written = 0; 503 + size_t rsize, written = 0; 504 504 505 505 /* This write was probably executed during a tty close. */ 506 506 if (!hp)
+3 -3
drivers/tty/hvc/hvcs.c
··· 1263 1263 unsigned int unit_address; 1264 1264 const unsigned char *charbuf; 1265 1265 unsigned long flags; 1266 - int total_sent = 0; 1267 - int tosend = 0; 1266 + size_t total_sent = 0; 1267 + size_t tosend = 0; 1268 1268 int result = 0; 1269 1269 1270 1270 /* ··· 1299 1299 unit_address = hvcsd->vdev->unit_address; 1300 1300 1301 1301 while (count > 0) { 1302 - tosend = min_t(unsigned, count, 1302 + tosend = min_t(size_t, count, 1303 1303 (HVCS_BUFF_LEN - hvcsd->chars_in_buffer)); 1304 1304 /* 1305 1305 * No more space, this probably means that the last call to
+5 -5
drivers/tty/hvc/hvsi.c
··· 909 909 { 910 910 struct hvsi_struct *hp = tty->driver_data; 911 911 unsigned long flags; 912 - int total = 0; 913 - int origcount = count; 912 + size_t total = 0; 913 + size_t origcount = count; 914 914 915 915 spin_lock_irqsave(&hp->lock, flags); 916 916 ··· 928 928 * will see there is no room in outbuf and return. 929 929 */ 930 930 while ((count > 0) && (hvsi_write_room(tty) > 0)) { 931 - int chunksize = min_t(int, count, hvsi_write_room(tty)); 931 + size_t chunksize = min_t(size_t, count, hvsi_write_room(tty)); 932 932 933 933 BUG_ON(hp->n_outbuf < 0); 934 934 memcpy(hp->outbuf + hp->n_outbuf, source, chunksize); ··· 952 952 spin_unlock_irqrestore(&hp->lock, flags); 953 953 954 954 if (total != origcount) 955 - pr_debug("%s: wanted %i, only wrote %i\n", __func__, origcount, 956 - total); 955 + pr_debug("%s: wanted %zu, only wrote %zu\n", __func__, 956 + origcount, total); 957 957 958 958 return total; 959 959 }