From nobody Fri Dec 19 16:02:08 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F60CC4167B for ; Wed, 6 Dec 2023 07:38:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376799AbjLFHiK (ORCPT ); Wed, 6 Dec 2023 02:38:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376830AbjLFHhr (ORCPT ); Wed, 6 Dec 2023 02:37:47 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 171B61722 for ; Tue, 5 Dec 2023 23:37:37 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5433C433C7; Wed, 6 Dec 2023 07:37:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701848257; bh=dQFCDmEpt5P6ThPydBMGELVuIhzHjl7/FVwjhyy0yRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VUvsjQdzGwCfUKDjkBnh/6sqrgysLBucHf9QNxpTCbCY4llLHwlLyUSb2wcYenaUb jG87KYRBZojYzewsCBheiyxTR4VpE8G0gBw/uY6yifqJq5i3AkCl3tbe4Noj0V0QIM vqoXgTa/35sZnCChMUIhYLIRHWIrwbdl5uUR+MPnem7KSgL26UxJXAKIwOsFuchwnI lboLuLBNTSCNJ/UPslvXHh2gX+97CnffjXIQ2IBaaNUwTDlWtbO16MH97vG1trDxcu RPXaPiTEwD5YOckTLLLuCcqmG9uCgVJIOOatRfjCJJ5kncQnjMvAXkhr+5z3fX0ZPA 1oOsp61cFOkRg== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , linux-s390@vger.kernel.org Subject: [PATCH 08/27] tty: con3215: convert to u8 and size_t Date: Wed, 6 Dec 2023 08:36:53 +0100 Message-ID: <20231206073712.17776-9-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231206073712.17776-1-jirislaby@kernel.org> References: <20231206073712.17776-1-jirislaby@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer. Signed-off-by: Jiri Slaby (SUSE) Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Alexander Gordeev Cc: Christian Borntraeger Cc: Sven Schnelle Cc: linux-s390@vger.kernel.org Acked-by: Alexander Gordeev --- drivers/s390/char/con3215.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index 34bc343dcfcc..0b0324fe4aff 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c @@ -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 */ @@ -522,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 =3D 0; + unsigned int i, blanks, expanded_size =3D 0; unsigned int column =3D raw->line_pos; + size_t c; + u8 ch; =20 if (opmode =3D=3D RAW3215_COUNT) todrop =3D 0; @@ -558,7 +560,7 @@ static unsigned int raw3215_addtext(const char *str, un= signed int length, if (todrop && expanded_size < todrop) /* Drop head data */ continue; for (i =3D 0; i < blanks; i++) { - raw->buffer[raw->head] =3D (char)_ascebc[(int)ch]; + raw->buffer[raw->head] =3D _ascebc[ch]; raw->head =3D (raw->head + 1) & (RAW3215_BUFFER_SIZE - 1); raw->count++; } @@ -570,8 +572,8 @@ static unsigned int raw3215_addtext(const char *str, un= signed 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; @@ -596,7 +598,7 @@ static void raw3215_write(struct raw3215_info *raw, con= st 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); } @@ -823,12 +825,10 @@ static struct ccw_driver raw3215_ccw_driver =3D { .int_class =3D IRQIO_C15, }; =20 -static void handle_write(struct raw3215_info *raw, const char *str, int co= unt) +static void handle_write(struct raw3215_info *raw, const u8 *str, size_t c= ount) { - int i; - while (count > 0) { - i =3D min_t(int, count, RAW3215_BUFFER_SIZE - 1); + size_t i =3D min_t(size_t, count, RAW3215_BUFFER_SIZE - 1); raw3215_write(raw, str, i); count -=3D i; str +=3D i; --=20 2.43.0