Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp628433rdb; Tue, 16 Jan 2024 10:38:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHoLjRlNHqne8Nf9cFjB+yV7w1hkFOWKn8kR4aiU10LqY2i32d32p9IFWBZaYXBz63FU/pt X-Received: by 2002:a05:6808:640e:b0:3bd:8bdf:3a34 with SMTP id fg14-20020a056808640e00b003bd8bdf3a34mr1336134oib.106.1705430303734; Tue, 16 Jan 2024 10:38:23 -0800 (PST) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id t42-20020a05622a182a00b00429c84b8a8csi9779456qtc.674.2024.01.16.10.38.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 10:38:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27702-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=oGxH89Dd; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-27702-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27702-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4AEF51C23954 for ; Tue, 16 Jan 2024 18:38:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D1C91CD39; Tue, 16 Jan 2024 18:38:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oGxH89Dd" Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B5121CD27 for ; Tue, 16 Jan 2024 18:38:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705430295; cv=none; b=VX4b9h/5D+a7nq2om7qY5y7EXngIK8o/iJeBKVYy4oXhHahjyu5MGKs7RfKV1JrOegSOJwqVreMvdGIWP0rnSdudBUn7HY1U5ff1NJrNREige34+U4LkFjk9qYtoyIA9q7YsDfNWEIBK+V7FMnLaaHgMggKjMFVPbP5qNli+cuk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705430295; c=relaxed/simple; bh=TB6bL0w3hLWUcnDcaIay8oWyOu6RzNDf0O17kPM6VXw=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:MIME-Version: References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc: Content-Type:Content-Transfer-Encoding; b=OwbOto3W0MGaWYuvMFm9yNEAWcfKWONvuYCl5hADYB/gJw+s4MS09JjDyfXu6FnEDALIgyodeo6ZYFQgUDtF55BRHaJisfTKTMzZZGvXXR3Y3SxJE6Q1jrj30+FWzUGkZk2YhBIS6NAlKvF0aQTPQGu0hGD/wT4O+HCWOf78buA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=oGxH89Dd; arc=none smtp.client-ip=209.85.215.174 Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-5cdbc4334edso4524498a12.3 for ; Tue, 16 Jan 2024 10:38:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705430293; x=1706035093; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0jDglbZBWktYfWTPUcusyZr2j2GiYOxnIQXGiD8Doo4=; b=oGxH89DdczRxZnF4aohIqsU78Z+Srdlzge3Ji/jgAa6Fb6Spd1BEJNiI8rE4hG1goZ rlKPoeg/ln2gFfGQPZB38Qs5lb9u8CxAn4Pi/gwVDwaucUSYrgOYh58f3dE7YbUIvlXm MdGi78pL3TYyVpYjiogoopMxxTZBPDgBp6V4OnE6AI0vIx67m6zyPegIvLot2gsbej3p NBH3Ne1vIxD5CVXV4SoJd3wRu59Lnu5euQWMLxYtQVKNhR2fnBneTI7/nlysuybv2OtG qgGTDdu1PGCb6za71j3MyI9uvJIEO2OLdqN7txZgHNVo4W86zdiMEqWse5auX4MTpjeP pJ8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705430293; x=1706035093; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0jDglbZBWktYfWTPUcusyZr2j2GiYOxnIQXGiD8Doo4=; b=Z1A/hs9nq4EJsQxtkt8GkSnAF4iyxUxCraKsceyt2WBqSCS0LQwL5KCRmg5jAUJalb 4VhUq4WBEhOMGhFh2TorlT9XfGkaYWLFUK3BN5O8+wj9BC33aeyVkZuMTT7x3phkPsIS ZyDS4sMNWWuVK7UsSMw4j/fQHIQxQ4AF3by+39piGLmvGIFYFlqgub0OFI/G5zUhZRqt NrXJmFr2+JaF4rkJ9WKek6mtahxjmxEXVvj49paXS7+VW2ZboImr9ZRJvGf4SdrfwupW SoEUDh1zllSwlBiefpdk8lA/Ck1i/yU4zVquhs/yXcuOwX5On35ByIzpx1LB9juzQ++J aR0g== X-Gm-Message-State: AOJu0YwpB2bmNAmdmH9fwBHGrLMa0xYuh0Y2jYb9aeakOG0/IAfvd68o DZRBj3cHfZmF2IpEiC5YLPtaN3u+vl8sfQpVT96zqgsj7lBz2g== X-Received: by 2002:a17:90a:d913:b0:28e:1d1e:f2eb with SMTP id c19-20020a17090ad91300b0028e1d1ef2ebmr2701244pjv.90.1705430293457; Tue, 16 Jan 2024 10:38:13 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240110102102.61587-1-tudor.ambarus@linaro.org> <20240110102102.61587-12-tudor.ambarus@linaro.org> In-Reply-To: <20240110102102.61587-12-tudor.ambarus@linaro.org> From: Sam Protsenko Date: Tue, 16 Jan 2024 12:38:02 -0600 Message-ID: Subject: Re: [PATCH 11/18] tty: serial: samsung: don't compare with zero an if (bitwise expression) To: Tudor Ambarus Cc: krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com, gregkh@linuxfoundation.org, jirislaby@kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 10, 2024 at 4:24=E2=80=AFAM Tudor Ambarus wrote: > > Since an if tests the numeric value of an expression, certain coding > shortcuts can be used. The most obvious one is writing > if (expression) > instead of > if (expression !=3D 0) > > Since our case is a bitwise expression, it's more natural and clear to > use the ``if (expression)`` shortcut. Maybe the author of this code: (ufstat & info->tx_fifomask) !=3D 0 just wanted to outline (logically) that the result of this bitwise operation produces FIFO length, which he checks to have non-zero length? Mechanically of course it doesn't matter much, and I guess everyone can understand what's going on there even without '!=3D 0' part. But it looks quite intentional to me, because in the same 'if' block the author uses this as well: (ufstat & info->tx_fifofull) without any comparison operators. > > Signed-off-by: Tudor Ambarus > --- > drivers/tty/serial/samsung_tty.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsun= g_tty.c > index dbbe6b8e3ceb..f2413da14b1d 100644 > --- a/drivers/tty/serial/samsung_tty.c > +++ b/drivers/tty/serial/samsung_tty.c > @@ -988,8 +988,7 @@ static unsigned int s3c24xx_serial_tx_empty(struct ua= rt_port *port) > u32 ufcon =3D rd_regl(port, S3C2410_UFCON); > > if (ufcon & S3C2410_UFCON_FIFOMODE) { > - if ((ufstat & info->tx_fifomask) !=3D 0 || > - (ufstat & info->tx_fifofull)) > + if ((ufstat & info->tx_fifomask) || (ufstat & info->tx_fi= fofull)) Does this line fit into 80 characters? If no, please rework it so it does. I guess it's also possible to get rid of superfluous braces there, but then the code might look confusing, and I'm not sure if checkpatch would be ok with that. > return 0; > > return 1; > -- > 2.43.0.472.g3155946c3a-goog > >