diff mbox series

Input: ads7846 - ratelimit the spi_sync error message

Message ID 20240708211913.171243-1-marex@denx.de (mailing list archive)
State Mainlined
Commit ccbfea78adf75d3d9e87aa739dab83254f5333fa
Headers show
Series Input: ads7846 - ratelimit the spi_sync error message | expand

Commit Message

Marek Vasut July 8, 2024, 9:18 p.m. UTC
In case the touch controller is not connected, this message keeps scrolling
on the console indefinitelly. Ratelimit it to avoid filling kernel logs.

"
ads7846 spi2.1: spi_sync --> -22
"

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: kernel@dh-electronics.com
Cc: linux-input@vger.kernel.org
---
 drivers/input/touchscreen/ads7846.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dmitry Torokhov July 8, 2024, 9:39 p.m. UTC | #1
On July 8, 2024 2:18:57 PM PDT, Marek Vasut <marex@denx.de> wrote:
>In case the touch controller is not connected, this message keeps scrolling
>on the console indefinitelly. Ratelimit it to avoid filling kernel logs.

Instead of ratelimiting, maybe we should try reading touchscreen state when
probing and abort if the device dies not respond?

Thanks.
Hi Marek,
Marek Vasut July 18, 2024, 12:02 a.m. UTC | #2
On 7/8/24 11:39 PM, Dmitry Torokhov wrote:
> On July 8, 2024 2:18:57 PM PDT, Marek Vasut <marex@denx.de> wrote:
>> In case the touch controller is not connected, this message keeps scrolling
>> on the console indefinitelly. Ratelimit it to avoid filling kernel logs.
> 
> Instead of ratelimiting, maybe we should try reading touchscreen state when
> probing and abort if the device dies not respond?

Ratelimiting also helps if the touch controller fails or disconnects at 
runtime, which would still trigger the scrolling messages. With this 
cheap prototype hardware, that happens.
Dmitry Torokhov July 24, 2024, 4:10 a.m. UTC | #3
On Thu, Jul 18, 2024 at 02:02:50AM +0200, Marek Vasut wrote:
> On 7/8/24 11:39 PM, Dmitry Torokhov wrote:
> > On July 8, 2024 2:18:57 PM PDT, Marek Vasut <marex@denx.de> wrote:
> > > In case the touch controller is not connected, this message keeps scrolling
> > > on the console indefinitelly. Ratelimit it to avoid filling kernel logs.
> > 
> > Instead of ratelimiting, maybe we should try reading touchscreen state when
> > probing and abort if the device dies not respond?
> 
> Ratelimiting also helps if the touch controller fails or disconnects at
> runtime, which would still trigger the scrolling messages. With this cheap
> prototype hardware, that happens.

OK, fair enough. Applied, thank you.
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 3dc41687aa1d9..f7bc0a3e56d86 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -834,7 +834,7 @@  static void ads7846_read_state(struct ads7846 *ts)
 		m = &ts->msg[msg_idx];
 		error = spi_sync(ts->spi, m);
 		if (error) {
-			dev_err(&ts->spi->dev, "spi_sync --> %d\n", error);
+			dev_err_ratelimited(&ts->spi->dev, "spi_sync --> %d\n", error);
 			packet->ignore = true;
 			return;
 		}