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 3DF271CCEDA; Wed, 2 Oct 2024 14:25:13 +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=1727879113; cv=none; b=LLF4LYGYFSlwoff52wrXnhiMQ+zf2zp6ruKuCHb9OQmMjuCv2yGM77zD9OPjHZMdNin7fkJg8MsUvPWg2QyZdrwYYekBWS97+BYqTD0KTjdHqPn4i7tiHUCtJevrr5TX3Iu0XbrVjYHV98z+WdAjsBGOHA7VjyiyEVuHT0eLAbA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727879113; c=relaxed/simple; bh=GgNwBqY/sNQ3553+T259u81NRNkNgUJOdYnwblizZm4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=s4wHq58dP+C3/FAHB2FW0aj3TZlXo3uvBCeVI/79RS25rRS/xwVwIpZSZEoWCczy+caBBF/my+UBHlAzcTkn/Cc+6xE4RnYUeX58aHGF6PDPknzKWKwme1degzAiO0IzGKOHpm0V3z09OwdTNfHF0sckZ7wbGLgXIl1+NgRt89w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mAairTIo; 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="mAairTIo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA37CC4CECD; Wed, 2 Oct 2024 14:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1727879113; bh=GgNwBqY/sNQ3553+T259u81NRNkNgUJOdYnwblizZm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mAairTIou1/MgHsoJNMK4VvRM1QXyXBXohHKK6F4jUBzN8T6MoUDYl3xswh8vqoG6 eDFNewH+GEK8VQg+BFMKKycOQ9dFguz67c/ztPWfryvINGEINmP0GXf+bkuDRHVO5u BaN9TwcC/bP+IekmMG42CD4r772XdSsrrEg6BvS0= 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.10 605/634] serial: qcom-geni: introduce qcom_geni_serial_poll_bitfield() Date: Wed, 2 Oct 2024 15:01:45 +0200 Message-ID: <20241002125834.994811568@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241002125811.070689334@linuxfoundation.org> References: <20241002125811.070689334@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.10-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