From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8F501D0799; Wed, 2 Oct 2024 13:53:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727877197; cv=none; b=ksSZvyshQxUbqsCdSUpv23hheZWfRm6BpAajIDb+qPjmBPTenUfPUzZOrskKAdTywlLfl9DHRiQoPZE58U/CQ6KS+it6Ec9QPEkK2ayzNDFYYcUnUa6cr54NTTHApMppay0QT9tdxIY5fVu6wIjf1eJ3vQcp0p/DmThv9+B63gc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727877197; c=relaxed/simple; bh=hrGrhf2tVQ/fYG1tk0CBJN5i/Cd64IkH/ObZeBoXIOA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q6K0n+Txa0+qJZk3G6Nu1ADaWGziQa6hlwaTffPDGB5hnlIKnJwL46U0iy1UzfFffPe7uJPVuU8kPv9QlARUwEkWI2JekL3m/m+VdrzoWCvXtmu9wnGPozVzXPOYC73yjWDXg7y3hyPOhBcY8kuq9aA5U6TKoeGcRnGuZOF/cMI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tVlzxOvb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="tVlzxOvb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51DA9C4CEC2; Wed, 2 Oct 2024 13:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1727877197; bh=hrGrhf2tVQ/fYG1tk0CBJN5i/Cd64IkH/ObZeBoXIOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tVlzxOvbVZwKzUZeQxEr0d35LCb370eSTyFryVscTE/2RM27a4SGkwbKmHP/HSXxT Kww72vsgBEt7DrjQA7xEkSeiijLjfulgTW1GDl880QvQAMZ4Q3J6Rnr5icj3q5fUpG c7mD2vDyvAxsWYjAsXkmZQ/4g//Ry723Gq0fgsNY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Douglas Anderson , Konrad Dybcio , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Johan Hovold , Sasha Levin Subject: [PATCH 6.11 667/695] serial: qcom-geni: introduce qcom_geni_serial_poll_bitfield() Date: Wed, 2 Oct 2024 15:01:05 +0200 Message-ID: <20241002125849.133587788@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241002125822.467776898@linuxfoundation.org> References: <20241002125822.467776898@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.11-stable review patch. If anyone has any objections, please let me know. ------------------ From: Douglas Anderson [ Upstream commit b26d1ad1221273c88c2c4f5b4080338b8ca23859 ] With a small modification the qcom_geni_serial_poll_bit() function could be used to poll more than just a single bit. Let's generalize it. We'll make the qcom_geni_serial_poll_bit() into just a wrapper of the general function. Signed-off-by: Douglas Anderson Reviewed-by: Konrad Dybcio Link: https://lore.kernel.org/r/20240610152420.v4.5.Ic6411eab8d9d37acc451705f583fb535cd6dadb2@changeid Tested-by: NĂ­colas F. R. A. Prado Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20240906131336.23625-6-johan+linaro@kernel.org Signed-off-by: Greg Kroah-Hartman Stable-dep-of: cc4a0e5754a1 ("serial: qcom-geni: fix console corruption") Signed-off-by: Sasha Levin --- drivers/tty/serial/qcom_geni_serial.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 54052c68555d7..7bbd70c306201 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -265,8 +265,8 @@ static bool qcom_geni_serial_secondary_active(struct uart_port *uport) return readl(uport->membase + SE_GENI_STATUS) & S_GENI_CMD_ACTIVE; } -static bool qcom_geni_serial_poll_bit(struct uart_port *uport, - unsigned int offset, u32 field, bool set) +static bool qcom_geni_serial_poll_bitfield(struct uart_port *uport, + unsigned int offset, u32 field, u32 val) { u32 reg; struct qcom_geni_serial_port *port; @@ -286,7 +286,7 @@ static bool qcom_geni_serial_poll_bit(struct uart_port *uport, timeout_us = DIV_ROUND_UP(timeout_us, 10) * 10; while (timeout_us) { reg = readl(uport->membase + offset); - if ((bool)(reg & field) == set) + if ((reg & field) == val) return true; udelay(10); timeout_us -= 10; @@ -294,6 +294,12 @@ static bool qcom_geni_serial_poll_bit(struct uart_port *uport, return false; } +static bool qcom_geni_serial_poll_bit(struct uart_port *uport, + unsigned int offset, u32 field, bool set) +{ + return qcom_geni_serial_poll_bitfield(uport, offset, field, set ? field : 0); +} + static void qcom_geni_serial_setup_tx(struct uart_port *uport, u32 xmit_size) { u32 m_cmd; -- 2.43.0