Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp515442lqo; Wed, 8 May 2024 06:59:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU97NASEZpT/9yZlOFWMf1Xkl5/liYiuIkGZ2god4acscNeAwbR71NEJJxsOE6GAdNjLFPlCeBzEtuSO0OnG2bcG7AjSxs6JGXS8nX2Xw== X-Google-Smtp-Source: AGHT+IH5NK8UmkPFtrPqLLMyHp0m16gXxWN82AyzPUgy3LZZH0LPxAEp7HwZ3B+qFytzfe0FAM4J X-Received: by 2002:a17:906:1c06:b0:a59:c7d7:8b0f with SMTP id a640c23a62f3a-a59fb9595f3mr143193166b.29.1715176759416; Wed, 08 May 2024 06:59:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715176759; cv=pass; d=google.com; s=arc-20160816; b=FcV7P+A5LhVZe9kK3PTJBW9qPcqK5AeeRSQXszVEIKrNFEZNBCeJdJ+V4eZf+5QSQI jKhDCvgaeudWxGiSejvsOqeFH96qz7CXSm9hcaHHdqCJddlXXNuqAUbh0m6Sxm7Hdv3t CFxL4bxtOFN41glu8Yh9cgqtKgymGEpO2PBiMb6ZfuH9a2tgKZX2V19WZ9mUXFzigNW6 saOowmxotEJDElWrsqZeo+0uM3OtEVrnYuz/NspoPuZnO71wl5GPozXP6nu5bBEGRiQT 2bIe3i4+UnoFMHitZOidwoikP2PB8cKVVG7anKvTRbmD2IKNB3vcVbI7B3QxjA/WplT4 ZjZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=wteB/wo3Zzx+FC62Ax47MWkRwTrlGJK2z3q3lgZSSCU=; fh=JT/2wdkCquuOf4l7HpBUA7TPVMUh9KLYvy5xuWZxTWw=; b=ucD3gN5hP0/rWE/hC/OnUb1Ts4+Ss6EikQanMo05g6th3cbFIrFk4acfb+sIXnXyLz Xofj+JUERxvja+swi4YjuFAq2XdnGvWCQro9l+dle0Y7CFH3VGz9rEnEBWx2UQeTgRAq /d1HclfCju6k+y/H2kYR9NPD0wOSB12wPmaU5xyhs/+VIYGcjgpvaNNzewdfeTXbZx3Y jBYyZ90O+k6imcxRjhIafNLc0n+GZQ2TgWJcYzUIPgwA33KcLXSRs1e0TecXfsuUFLg3 NUDGjp6AVE3iSmR+vv8KpNqAgx+olhnLHmFi6aBsZWKIi/8ObOIs8x3X6YDzaWjUcee1 /bhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WhNgJ0Cu; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-173356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id hd30-20020a170907969e00b00a59a7bdd577si5403327ejc.782.2024.05.08.06.59.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 06:59:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WhNgJ0Cu; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-173356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 74EC31F29EA9 for ; Wed, 8 May 2024 13:48:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C1977E0F1; Wed, 8 May 2024 13:47:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WhNgJ0Cu" Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (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 3AAA1182CC; Wed, 8 May 2024 13:47:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715176040; cv=none; b=e+Lnqnu4B7Bk3mKUPvUNRX1rvqBlGlqqiM9d8PnJe8aXBUC57q/TenufrwXwF9UY6RqQd8PTXHAr1SroQu5pWxV3NsHAyos5wCX79HpZtryx4iYrPM8QQldI4FQSKpy8G3nSMo0chnm51k2RUMo2yaPmJ4nfXTsHIUqd1uOC8sc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715176040; c=relaxed/simple; bh=UJoC/0p60SVk+M5ckNWwXHQLVKtSVLLfbm9KWYn/b20=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=krveNA0+rWZ0w+1tLmgY/Ip/qg51Txcr0Hut8sv7/5Ovsww4ILaIvF7JmLZ3b4EMpAsP/nFc/tSwAlZpdaG/lpUg/FtJGKcJH7qvBQ1ozNK/qXFqDNtFOEWW+g0c+kqp9AOAyrtFIZ3tDKaawYTi0oLKyRbbQq9a6Y55vKMs+38= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WhNgJ0Cu; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a59a0e4b773so1059441566b.2; Wed, 08 May 2024 06:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715176037; x=1715780837; 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=wteB/wo3Zzx+FC62Ax47MWkRwTrlGJK2z3q3lgZSSCU=; b=WhNgJ0Cu39Mft0lkpmyyx7Vn5k+vwVmlMLWNFBZAE8q3IEBn643ppF9IMd7mamX5ey xj4CXzfPZ17+74Hm52BFSnTzee1loz5sXaKN+TJPTbbPq6tmPjj8nyByj0WZCgrbpyix b/uNGFhmitFFuuYwEVLvvUIPc94aYuUxvCLrM2ryDnLohrUDpnpIvvxZpp/CrKOFHvAg XlVNVOv7GENpgQXJKQSkYVkYIOX2427lkwMPvhnh6Rf8yhBw96XbLgfbPSzjcI6BUFMv m8bZqBaBuxyWK/hoQgIYUlLp1oSzFyR3GlngRD9RSaZsOSCMylogoR4YF6GQ+WepzsuO RfgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715176037; x=1715780837; 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=wteB/wo3Zzx+FC62Ax47MWkRwTrlGJK2z3q3lgZSSCU=; b=GjD5ojRdT3BV37Vnm0wAj8n5HJdmDCEfCBRP4uTJcGPWYRtxqNd/xT3c0pGgUc37fQ o0bbd2WVU7/zwWsYVsRmF43oniTggoODXIEbnmd625WPNoO8oMIiAoFRQD5kUsSmhrlf d1HY9kM/nnis5bYGgkfajF7PwgGHjFOOKiR2U1vHmxrtwwwF3KrUpvQuywf5Y5jmlnKc z1km0Hbcg2nLe9gfQRFs1soY1h0g+len7Ft8wnuqHLuec31Vu74eyvehtit5tsFjppRh Mjjya1fDBYV/hoLhgmgWSYBFO05yRZ6OB0AYgfixfsviSuStGUDphSbJqkWcKoKLp8A6 vsIA== X-Forwarded-Encrypted: i=1; AJvYcCViBgTdl+VYDFbFdqcXtVWld1POmTP2yOkwyXMzjropCHiCcVjNNXmbPDhwyBcEBty4M3ydnCQQvYte5V3H3vHe1YKI6pfg4jeJ/EiysNOeOcLz8CNYTmv6OeG2HoYL/sLUyEx2I8nY X-Gm-Message-State: AOJu0YwxFGMW4nyYu1UvF6QNef49hFcVmvauGobeqByRwRYSUR5A7lgx 4q9YxXPrIO7nxcURwTdvmxuC8DX5UXXJlDISzS6crmKQ3Extuef6hseBpKd0DQZF3+NQ7MHKdaM Ogx7eGiQWKcJ68wulyJoS04lhwtA= X-Received: by 2002:a17:906:ad6:b0:a59:c367:560c with SMTP id a640c23a62f3a-a59fb9dc564mr151760366b.60.1715176037437; Wed, 08 May 2024 06:47:17 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240506154520.3886867-1-marc.ferland@sonatest.com> In-Reply-To: From: Marc Ferland Date: Wed, 8 May 2024 09:47:05 -0400 Message-ID: Subject: Re: [PATCH] i2c: xiic: print error code when xiic_start_xfer fails To: Andi Shyti Cc: michal.simek@amd.com, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Marc Ferland Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, May 8, 2024 at 8:51=E2=80=AFAM Andi Shyti w= rote: > > Hi Marc, > > On Mon, May 06, 2024 at 11:45:20AM -0400, marc.ferland@gmail.com wrote: > > From: Marc Ferland > > > > xiic_start_xfer can fail for different reasons: > > > > - EBUSY: bus is busy or i2c messages still in tx_msg or rx_msg > > - ETIMEDOUT: timed-out trying to clear the RX fifo > > Wolfram has recently removed all the error printouts caused by > etimedout. > > > - EINVAL: wrong clock settings > > > > Printing the error code helps identifying the root cause. > > > > Signed-off-by: Marc Ferland > > --- > > drivers/i2c/busses/i2c-xiic.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xii= c.c > > index 71391b590ada..73729f0180a1 100644 > > --- a/drivers/i2c/busses/i2c-xiic.c > > +++ b/drivers/i2c/busses/i2c-xiic.c > > @@ -1165,7 +1165,7 @@ static int xiic_xfer(struct i2c_adapter *adap, st= ruct i2c_msg *msgs, int num) > > > > err =3D xiic_start_xfer(i2c, msgs, num); > > if (err < 0) { > > - dev_err(adap->dev.parent, "Error xiic_start_xfer\n"); > > + dev_err(adap->dev.parent, "Error xiic_start_xfer: %d\n", = err); > > I don't see the end user being interested in having the error > number printed in the dmesg. In fact, I doubt the end user is > interested in this message at all. > > We could print the debug messages (or warnings) where the actual > failure occurs. For example, in the setclk case, a warning is > already being printed, and I don't see why we should also print > an error here. > > Does that make sense? > Yeah, it makes sense. My goal here is to add a bit more context when things go wrong. I've been having these _very_ rare failures with this i2c adapter and the only trace I am getting is this "Error xiic_start_xfer" message in the kernel logs. So it seemed like a good idea to just print the error code along with the message. I'll resend a v2 with your suggestions. Regards, Marc