From nobody Wed Dec 17 10:45:01 2025 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 84C152EB861 for ; Sat, 18 Oct 2025 09:13:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760778836; cv=none; b=oIQzhiEMhPAjZpbf9z/GH3YUjaIjQghqGgR42QHzyA6GLz3dn0cOorxDbCYl32DxX9O12zM5Ea2+dx+3HWbzzCNVFO4lUCAuEVZDRxRESfByuD/MlKhbl95BlxjZNNEhL27YTgAFnKHg35jDhNl0R+2uxGxHQcwj4ecd5wZI280= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760778836; c=relaxed/simple; bh=Wp6pA2ijV72XmoO9lCOYRgiZJPPCan0nmj6ebicN3LA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NtJF6JFbIpjHJCz7Y8ri6hMeBAIA7EuX3DHy3puHCM2nAOzQaXrzkKwPSArW+K6rDxfS8oCRPwuCVy4VS6nyzpNt6evI+OdpReHr+wjoNZzruoTcaUpmYjKd7fHzG2BjfbgknS9HGnzUG5tsQZhAhrw6s3XVEp8/exyBdc586mk= 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=H1Qss6wc; arc=none smtp.client-ip=209.85.221.49 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H1Qss6wc" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3ee15b5435bso2199208f8f.0 for ; Sat, 18 Oct 2025 02:13:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760778833; x=1761383633; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=blLwC/EvjjsUuF6PMdGCDWzJWZs5gZEWamFiXY0Ipag=; b=H1Qss6wc7wpRbYySvN4W2R/NzIbSyONkhWkIsQVhDEgVj+kdRKtYKklLl3kn0DmtTL WoL5mh10qfFAC5qY5ZWyX+nIVRjDksM/ldIMlWWQbjvk+krKnSzuoUl8K+8dxxLLV1vZ 34O62s7ORAwo7atK6hDLMJssxNC9ZjwpTBytuNmPf0bR0PlqXgNxRzzQOOFqOhB2Behb qxk2qRsTojSSXY1hLu9wF2wVVEAroorQdGlRsFPcUkwtpao4IM11ZI7rHM7NlVHlQ1Kf sEXIltycDSFNEG0Ves8pNBu5lLZARz4/ooPi2RGLHYorwS73S++7hXI2DJ7Wsq9dyL4g s4Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760778833; x=1761383633; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=blLwC/EvjjsUuF6PMdGCDWzJWZs5gZEWamFiXY0Ipag=; b=I7QL2DIlEVJ3m34U5AsXpIMYF6vJpQ6Qgfi6/Xn37oY4HLfGRcziFxzrzdtlfOJUuS fEEFwD1E45rI4rw7CJgChO8fzhk6tkkCoFiyzSTbWZhZEI9VZbBztTgezfI4uvS1rx7H Pb3tWs2mMKE1jj6mP4s60+LtMZCYZPdpcn5qJCy15U2bKD3qXHBps8+gLQTT8IxCj2H9 l289nTWMIoCF+goypmni3xKaWi9WgS4a4f3YdmIYYY0t/EZd5nR7u5WYKF/nPQ/aMe6u K+CtaZJfR+Xc9nDmRG/9qr40oCJg9XRDZUNAfr+P5n4pGuHTsN7q7BX921H8+aIBbnvN KlaQ== X-Forwarded-Encrypted: i=1; AJvYcCVysK40rKY0P3bfxbEdW8KXJ60l6bU1WYdwe3iSbspMv1bvqCUmyS7PdR9Exm2/36uz6nm1tq/H7xBMgrE=@vger.kernel.org X-Gm-Message-State: AOJu0Yykl8v4B1AmINJ7CWvCLquCIUdFDCyJbdjxor6k3Dz1RZ9cv9os jsdXaK9DuHTtPjee7qf4B2NOcydDAxE7QoGlkvCOrvTqJ/6ebM+M8Zr8 X-Gm-Gg: ASbGncs/p6VhlEjC9rQASbSzinGrpodb9rn3+FLj+93wsRXrLzEdhtJ5rubbXVg8nm0 6c3wlL8Dmiu76Cv5hm3rFlx43cEr1PQ4hWwZ4vMbixbpgzZ9AmFV9bRDd2Lv5ETZkr3hQjXH9gT BbkIdv+NoiFVIOdW7Hru+TTo36Upyl8xTPMbE0elMclIxkKZFeEgX136zoZOBSzoUxm2icnRFdD FjjjX151uH5peIyWe4OXycpNBK/0xBUV31qBP3uuHJw3scmDF9eIJPpXagKUJLeGF/X9oAYe+k+ HNgfJe8NccWHlKAElkVyQ2BntPY77PZUeR5P129kCFSP/WtEULtrKkUU6zeOX3ni4L//i2+wlHb Jm8P2Ql7oYsU648kOEn/DvbZsGMFV9HShHNLEZOzF1cr5jnjKDCXuw/rPwGifEB5gTW0hRNHtgq vk X-Google-Smtp-Source: AGHT+IElXdxTpHivdHDGA/bS1moJZtG7kL7FPB73M2FQi4YQX9DDbcWVaiOgDyqqlMab7mC/uUqFtA== X-Received: by 2002:a05:600c:1907:b0:46e:206a:78cc with SMTP id 5b1f17b1804b1-4711791c3b0mr56406565e9.28.1760778832610; Sat, 18 Oct 2025 02:13:52 -0700 (PDT) Received: from shift.. ([86.124.201.90]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-471144d17cdsm121034215e9.18.2025.10.18.02.13.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Oct 2025 02:13:52 -0700 (PDT) From: Cezar Chiru To: andi.shyti@kernel.org, wsa+renesas@sang-engineering.com Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Cezar Chiru Subject: [PATCH v7 1/3] i2c: pcf8584: Remove debug macros from i2c-algo-pcf.c Date: Sat, 18 Oct 2025 12:12:56 +0300 Message-ID: <20251018091258.5266-2-chiru.cezar.89@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251018091258.5266-1-chiru.cezar.89@gmail.com> References: <20251018091258.5266-1-chiru.cezar.89@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Remove debug macros and printk and dev_dbg function calls from file as no change was done for long time. Remove i2c_debug module parameter also as its implementation, the debug macros, has been removed. Signed-off-by: Cezar Chiru --- drivers/i2c/algos/i2c-algo-pcf.c | 59 -------------------------------- 1 file changed, 59 deletions(-) diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-= pcf.c index fd563e845d4b..7e2d8ff33d75 100644 --- a/drivers/i2c/algos/i2c-algo-pcf.c +++ b/drivers/i2c/algos/i2c-algo-pcf.c @@ -23,17 +23,8 @@ #include "i2c-algo-pcf.h" =20 =20 -#define DEB2(x) if (i2c_debug >=3D 2) x -#define DEB3(x) if (i2c_debug >=3D 3) x /* print several statistical value= s */ -#define DEBPROTO(x) if (i2c_debug >=3D 9) x; - /* debug the protocol by showing transferred bits */ #define DEF_TIMEOUT 16 =20 -/* - * module parameters: - */ -static int i2c_debug; - /* setting states on the bus with the right timing: */ =20 #define set_pcf(adap, ctl, val) adap->setpcf(adap->data, ctl, val) @@ -47,27 +38,21 @@ static int i2c_debug; =20 static void i2c_start(struct i2c_algo_pcf_data *adap) { - DEBPROTO(printk(KERN_DEBUG "S ")); set_pcf(adap, 1, I2C_PCF_START); } =20 static void i2c_repstart(struct i2c_algo_pcf_data *adap) { - DEBPROTO(printk(" Sr ")); set_pcf(adap, 1, I2C_PCF_REPSTART); } =20 static void i2c_stop(struct i2c_algo_pcf_data *adap) { - DEBPROTO(printk("P\n")); set_pcf(adap, 1, I2C_PCF_STOP); } =20 static void handle_lab(struct i2c_algo_pcf_data *adap, const int *status) { - DEB2(printk(KERN_INFO - "i2c-algo-pcf.o: lost arbitration (CSR 0x%02x)\n", - *status)); /* * Cleanup from LAB -- reset and enable ESO. * This resets the PCF8584; since we've lost the bus, no @@ -88,9 +73,6 @@ static void handle_lab(struct i2c_algo_pcf_data *adap, co= nst int *status) if (adap->lab_mdelay) mdelay(adap->lab_mdelay); =20 - DEB2(printk(KERN_INFO - "i2c-algo-pcf.o: reset LAB condition (CSR 0x%02x)\n", - get_pcf(adap, 1))); } =20 static int wait_for_bb(struct i2c_algo_pcf_data *adap) @@ -151,9 +133,6 @@ static int pcf_init_8584 (struct i2c_algo_pcf_data *ada= p) { unsigned char temp; =20 - DEB3(printk(KERN_DEBUG "i2c-algo-pcf.o: PCF state 0x%02x\n", - get_pcf(adap, 1))); - /* S1=3D0x80: S0 selected, serial interface off */ set_pcf(adap, 1, I2C_PCF_PIN); /* @@ -161,7 +140,6 @@ static int pcf_init_8584 (struct i2c_algo_pcf_data *ada= p) * PCF8584 does that when ESO is zero */ if (((temp =3D get_pcf(adap, 1)) & 0x7f) !=3D (0)) { - DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't sele= ct S0 (0x%02x).\n", temp)); return -ENXIO; /* definitely not PCF8584 */ } =20 @@ -169,7 +147,6 @@ static int pcf_init_8584 (struct i2c_algo_pcf_data *ada= p) i2c_outb(adap, get_own(adap)); /* check it's really written */ if ((temp =3D i2c_inb(adap)) !=3D get_own(adap)) { - DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't set = S0 (0x%02x).\n", temp)); return -ENXIO; } =20 @@ -177,7 +154,6 @@ static int pcf_init_8584 (struct i2c_algo_pcf_data *ada= p) set_pcf(adap, 1, I2C_PCF_PIN | I2C_PCF_ES1); /* check to see S2 now selected */ if (((temp =3D get_pcf(adap, 1)) & 0x7f) !=3D I2C_PCF_ES1) { - DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't sele= ct S2 (0x%02x).\n", temp)); return -ENXIO; } =20 @@ -185,7 +161,6 @@ static int pcf_init_8584 (struct i2c_algo_pcf_data *ada= p) i2c_outb(adap, get_clock(adap)); /* check it's really written, the only 5 lowest bits does matter */ if (((temp =3D i2c_inb(adap)) & 0x1f) !=3D get_clock(adap)) { - DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't set = S2 (0x%02x).\n", temp)); return -ENXIO; } =20 @@ -194,7 +169,6 @@ static int pcf_init_8584 (struct i2c_algo_pcf_data *ada= p) =20 /* check to see PCF is really idled and we can access status register */ if ((temp =3D get_pcf(adap, 1)) !=3D (I2C_PCF_PIN | I2C_PCF_BB)) { - DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't sele= ct S1` (0x%02x).\n", temp)); return -ENXIO; } =20 @@ -210,8 +184,6 @@ static int pcf_sendbytes(struct i2c_adapter *i2c_adap, = const char *buf, int wrcount, status, timeout; =20 for (wrcount=3D0; wrcountdev, "i2c_write: writing %2.2X\n", - buf[wrcount] & 0xff)); i2c_outb(adap, buf[wrcount]); timeout =3D wait_for_pin(adap, &status); if (timeout) { @@ -307,8 +279,6 @@ static int pcf_xfer(struct i2c_adapter *i2c_adap, /* Check for bus busy */ timeout =3D wait_for_bb(adap); if (timeout) { - DEB2(printk(KERN_ERR "i2c-algo-pcf.o: " - "Timeout waiting for BB in pcf_xfer\n");) i =3D -EIO; goto out; } @@ -316,10 +286,6 @@ static int pcf_xfer(struct i2c_adapter *i2c_adap, for (i =3D 0;ret >=3D 0 && i < num; i++) { pmsg =3D &msgs[i]; =20 - DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: Doing %s %d bytes to 0x%02x - %d= of %d messages\n", - str_read_write(pmsg->flags & I2C_M_RD), - pmsg->len, pmsg->addr, i + 1, num);) - ret =3D pcf_doAddress(adap, pmsg); =20 /* Send START */ @@ -335,8 +301,6 @@ static int pcf_xfer(struct i2c_adapter *i2c_adap, goto out; } i2c_stop(adap); - DEB2(printk(KERN_ERR "i2c-algo-pcf.o: Timeout waiting " - "for PIN(1) in pcf_xfer\n");) i =3D -EREMOTEIO; goto out; } @@ -344,34 +308,17 @@ static int pcf_xfer(struct i2c_adapter *i2c_adap, /* Check LRB (last rcvd bit - slave ack) */ if (status & I2C_PCF_LRB) { i2c_stop(adap); - DEB2(printk(KERN_ERR "i2c-algo-pcf.o: No LRB(1) in pcf_xfer\n");) i =3D -EREMOTEIO; goto out; } =20 - DEB3(printk(KERN_DEBUG "i2c-algo-pcf.o: Msg %d, addr=3D0x%x, flags=3D0x%= x, len=3D%d\n", - i, msgs[i].addr, msgs[i].flags, msgs[i].len);) =20 if (pmsg->flags & I2C_M_RD) { ret =3D pcf_readbytes(i2c_adap, pmsg->buf, pmsg->len, (i + 1 =3D=3D num)); - - if (ret !=3D pmsg->len) { - DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: fail: " - "only read %d bytes.\n",ret)); - } else { - DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: read %d bytes.\n",ret)); - } } else { ret =3D pcf_sendbytes(i2c_adap, pmsg->buf, pmsg->len, (i + 1 =3D=3D num)); - - if (ret !=3D pmsg->len) { - DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: fail: " - "only wrote %d bytes.\n",ret)); - } else { - DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: wrote %d bytes.\n",ret)); - } } } =20 @@ -401,8 +348,6 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap) struct i2c_algo_pcf_data *pcf_adap =3D adap->algo_data; int rval; =20 - DEB2(dev_dbg(&adap->dev, "hw routines registered.\n")); - /* register new adapter to i2c module... */ adap->algo =3D &pcf_algo; =20 @@ -418,7 +363,3 @@ EXPORT_SYMBOL(i2c_pcf_add_bus); MODULE_AUTHOR("Hans Berglund "); MODULE_DESCRIPTION("I2C-Bus PCF8584 algorithm"); MODULE_LICENSE("GPL"); - -module_param(i2c_debug, int, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(i2c_debug, - "debug level - 0 off; 1 normal; 2,3 more verbose; 9 pcf-protocol"); --=20 2.43.0 From nobody Wed Dec 17 10:45:01 2025 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 F00652EBBA1 for ; Sat, 18 Oct 2025 09:14:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760778842; cv=none; b=mjWVRj4B+WPKEvp3QDQ7TVkC7ei2AHLY1kkhU92Tr+O0tnm1gJQH+UTiiFwBZ+CSf+Fz7tuiiKf0h79YPEIDtEuIXGOW15ADiXctS5e9BRiwG5Ca4VO3Vc9Io8cFlS7Ds0BVIiRxB2rCqcH1o3533NJLrVRtbgugTq5IgWyhQ2E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760778842; c=relaxed/simple; bh=LHZjH2UMXa92SxXhNcHHvMGpkdxmO+gWMcsE10ROlWg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ekPS7hDNaXCM+f+I/a8gV7kL2dBwTFSYeFgdTsKVNrgCA0PMT//kiTXKskcuiybd9JND8csLE7TUF45FK0uUzqVH8i2SLskNWOXiQ974AldIe3GS5REYESf3EJBnRcGO2Z2Hs/aXS2kSrczSs6Ooig6+hWA52+uJlJBIH5KgSgw= 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=I71/UhTH; arc=none smtp.client-ip=209.85.128.50 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I71/UhTH" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-471b80b994bso3420945e9.3 for ; Sat, 18 Oct 2025 02:14:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760778839; x=1761383639; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XH2k5qkD7Z3u1A48Y16IYSnGNDzLTVrlHvL80g4n3eU=; b=I71/UhTHTGAWR2C9m7ZUGD0tEn4Iq9cwnPEgd1U/WC0qH++SWOV1pqnqP/VGlv74wM ztkUcPSCr88VhiNfM1yMqjui0DAoSoauG5R84oG0RYhzbt98l08FZemLbstyYb+dU3xW HSgQZHQ6imavfJ6dkBVtKeQahd8vR7ppJvNla1T3Y71r84BhcRcxkxwhb8apFuOFnKeO gmyVcgnErNjtEbr4pG8Oa2S3YirjvE8tMlTnqpV3u3+SntqjS8sI7jjPjSSFQkLEakdM jm/rGnugInVgYwnRgFzWvp8PjxnlyDmtrpFbVtrtLqY3U5HoR6oSHCphRwESsO36XtD5 LYsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760778839; x=1761383639; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XH2k5qkD7Z3u1A48Y16IYSnGNDzLTVrlHvL80g4n3eU=; b=L+Cbm7DgQr9eF69rXgXzXJKWaHLkRe2FusqV6mwE8t1cocPGEjDrB9cAaJghHmsz4D WCkhvgNO1KhOJKbkqXr2TacH783CNTcx8UiljZCj7N8KVkM5Wc6BMMaytOuPKK7Eur5T RHdwKK7SsNHINLp2lsgxqY3MH2xtCpy5BL1ln0HzoHEtY78jgbX2apYpEO4jAoGeSATG +WecD5nK4nSQvJcIfL3wK24f5WAYDiDpYbC/jEXsFX8p+5sa/Z2w1UoG9RXy7LLBrU0x +9YmmM+skph8PQCPVauL0zTqwLt9mKxZi8Sa0auCGnf8lSnM0THs6mvRJyarQLGtyk4n cm/Q== X-Forwarded-Encrypted: i=1; AJvYcCUCm+P/eHgsxnklTy84sjaR/enn6jucRoDuyYcDlgB+HhSo7SQ9odALrPh2sNhgHsxIL5N0GF1HFUJzPlw=@vger.kernel.org X-Gm-Message-State: AOJu0YxjfDRv2a5t7WCH1bYICpJ8mBthf1uAxlaAmBlgBEVyS6fhLZIn 6sW+5Cox9gjKuUaX2y2d9zyehAhed9v7fWQNmtecoBsN1HSALOsm5+MW X-Gm-Gg: ASbGncuTNVLVHkk4ox65/YhrYocetla1lkArx6++wyLNWgmfKwBhzq6XVPXJwCU50AQ Z+aNC9BgRQjF2/eHKdinB50BEnTkJsue12mzVkpB06TJfEUFDDPUhk7D4qzimCP6TjfeWJ0aoxZ PcWxV6I6gjq/LUbQiE0kbzeDVdsqDy9M54Yr57lCX6CY8QoUZyzw0x7rBV2Oi0DIEqa8+UkOIoO pnwESmuV6p1HL03exTEoaR+7pZTzylYagRDI8rqrgdo7Vizzul9nGD6iKSNdGMtzyOf22tYesIe zF9xLNOxWasA8R2HeQ8A6sHuKBpb2pzHmD2ZOvzkM/2Fll6sezvyBw1LGeBCDakxI5Ped8yhKu0 LbUvsZhAHhw+gNwPR+FEGFsw4SfuuzyFu/Ew+V9FzAhjwQLXg2mmbv33fKzGi3doBEiS4tKwpul tc5XNhk4Db/Br3+F07TJiV/A== X-Google-Smtp-Source: AGHT+IEUzXUajWE7NWxCs+sl4jnxDCzewliCBfPohtrMWKyQzYPRrVvK+cmI6/ZdtUdp4Zf3OtHTMA== X-Received: by 2002:a05:600c:8b0c:b0:471:15df:9fcd with SMTP id 5b1f17b1804b1-47117911c51mr48689275e9.25.1760778838813; Sat, 18 Oct 2025 02:13:58 -0700 (PDT) Received: from shift.. ([86.124.201.90]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-471144d17cdsm121034215e9.18.2025.10.18.02.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Oct 2025 02:13:58 -0700 (PDT) From: Cezar Chiru To: andi.shyti@kernel.org, wsa+renesas@sang-engineering.com Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Cezar Chiru Subject: [PATCH v7 2/3] i2c: pcf8584: Fix do not use assignment inside if conditional Date: Sat, 18 Oct 2025 12:12:57 +0300 Message-ID: <20251018091258.5266-3-chiru.cezar.89@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251018091258.5266-1-chiru.cezar.89@gmail.com> References: <20251018091258.5266-1-chiru.cezar.89@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Assign inside of 'if' conditional is not allowed. Move assignment from inside 'if' conditional, to one line before each 'if'conditional statement that caused errors. Enforce errors fixing based on checkpatch.pl output on file. Signed-off-by: Cezar Chiru --- drivers/i2c/algos/i2c-algo-pcf.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-= pcf.c index 7e2d8ff33d75..41a81d37e880 100644 --- a/drivers/i2c/algos/i2c-algo-pcf.c +++ b/drivers/i2c/algos/i2c-algo-pcf.c @@ -129,7 +129,7 @@ static int wait_for_pin(struct i2c_algo_pcf_data *adap,= int *status) * * vdovikin: added detect code for PCF8584 */ -static int pcf_init_8584 (struct i2c_algo_pcf_data *adap) +static int pcf_init_8584(struct i2c_algo_pcf_data *adap) { unsigned char temp; =20 @@ -139,38 +139,38 @@ static int pcf_init_8584 (struct i2c_algo_pcf_data *a= dap) * check to see S1 now used as R/W ctrl - * PCF8584 does that when ESO is zero */ - if (((temp =3D get_pcf(adap, 1)) & 0x7f) !=3D (0)) { + temp =3D get_pcf(adap, 1); + if ((temp & 0x7f) !=3D 0) return -ENXIO; /* definitely not PCF8584 */ - } =20 /* load own address in S0, effective address is (own << 1) */ i2c_outb(adap, get_own(adap)); /* check it's really written */ - if ((temp =3D i2c_inb(adap)) !=3D get_own(adap)) { + temp =3D i2c_inb(adap); + if (temp !=3D get_own(adap)) return -ENXIO; - } =20 /* S1=3D0xA0, next byte in S2 */ set_pcf(adap, 1, I2C_PCF_PIN | I2C_PCF_ES1); /* check to see S2 now selected */ - if (((temp =3D get_pcf(adap, 1)) & 0x7f) !=3D I2C_PCF_ES1) { + temp =3D get_pcf(adap, 1); + if ((temp & 0x7f) !=3D I2C_PCF_ES1) return -ENXIO; - } =20 /* load clock register S2 */ i2c_outb(adap, get_clock(adap)); /* check it's really written, the only 5 lowest bits does matter */ - if (((temp =3D i2c_inb(adap)) & 0x1f) !=3D get_clock(adap)) { + temp =3D i2c_inb(adap); + if ((temp & 0x1f) !=3D get_clock(adap)) return -ENXIO; - } =20 /* Enable serial interface, idle, S0 selected */ set_pcf(adap, 1, I2C_PCF_IDLE); =20 /* check to see PCF is really idled and we can access status register */ - if ((temp =3D get_pcf(adap, 1)) !=3D (I2C_PCF_PIN | I2C_PCF_BB)) { + temp =3D get_pcf(adap, 1); + if (temp !=3D (I2C_PCF_PIN | I2C_PCF_BB)) return -ENXIO; - } =20 printk(KERN_DEBUG "i2c-algo-pcf.o: detected and initialized PCF8584.\n"); =20 @@ -218,7 +218,8 @@ static int pcf_readbytes(struct i2c_adapter *i2c_adap, = char *buf, /* increment number of bytes to read by one -- read dummy byte */ for (i =3D 0; i <=3D count; i++) { =20 - if ((wfp =3D wait_for_pin(adap, &status))) { + wfp =3D wait_for_pin(adap, &status); + if (wfp) { if (wfp =3D=3D -EINTR) return -EINTR; /* arbitration lost */ =20 @@ -351,7 +352,8 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap) /* register new adapter to i2c module... */ adap->algo =3D &pcf_algo; =20 - if ((rval =3D pcf_init_8584(pcf_adap))) + rval =3D pcf_init_8584(pcf_adap); + if (rval) return rval; =20 rval =3D i2c_add_adapter(adap); --=20 2.43.0 From nobody Wed Dec 17 10:45:01 2025 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 8B8D82EBDFB for ; Sat, 18 Oct 2025 09:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760778847; cv=none; b=SIlGRIo20z5NACMLBTh62QM+wgynjyxQacLFkdF1pbeelNVcFbIe9VQ8jOKNR+T9cR9GoFJxyMMoKHHsUYDEVaQUihzyAiIxpeBQQT+mRFdaTs1CiRdvEH/1LsD/+18bNVlEwSoBXrSu90D562JEwBLRwjd6W3GNCT+NhfM2R4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760778847; c=relaxed/simple; bh=h8vI1OluXSSJBLDiMPvfyfHYRqMJdQ8aWra4Wn19dbI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HxLrGlLJrUn9QyerkBmr87S105+6TQ5XdDC5wgdWHiKhDK0Jdg9IB0FXEC7SLGNrilbyA8Zy4GHyslSwzN9xmlhCZ0I0bHt24p5pGwrZJSj7sbuYKmrPPEj85dXFdZwPCOeCHTCwHk9OzwgzH6WMn6yA+wA399irlBgSE1RlqGE= 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=DjmuNPcb; arc=none smtp.client-ip=209.85.221.50 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DjmuNPcb" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-421851bcb25so1510318f8f.2 for ; Sat, 18 Oct 2025 02:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760778844; x=1761383644; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HOKCu0zkFmuT3TdzBpwieB/b/YLMRGqn8lOHXlUlsOM=; b=DjmuNPcbunkdFgS7KFhmX2Lx+WSR+oE0Wqe5ZhguvU1DHvXeItTe+i1lSuKzr4QL9I XXGiHbBaX4CphPqTEhPI8Jou755srennutK+9Qta+aMsn/dUPvMDE1PZCFeDUdgHXi5S kGqSEP/LjOUkQEhbxIChDLzaqmjIEjOZgRaNyNI+zBq5ryWNLQnwUsASPzExtKmTNydE 4b2UjHS85EFnFjv0Q7mJLBgWswvOnOEvnlFy8ZmhMvEgeYQ434RWD59mn3rAsw+WnO96 JqjMm4aMN9ej0jRlPuI/98aie4wQKfjvJUprW/Tk3+kefnKGYk8gZ9+yRSzxFl2Iyg98 6qGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760778844; x=1761383644; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HOKCu0zkFmuT3TdzBpwieB/b/YLMRGqn8lOHXlUlsOM=; b=c0PESyTqMDjIekC+yD9uT0tWE3Y+Ij3kp0h+0MKxAdyUhviweArdnQuErbcZG4k+DL Kmjc/4PeEO0qC5D7ctyTnSMimi+SsBQ/UrauFjqX87v6ZiHHLFQSctAht0OBEAaXa/2c TWjy6HUEUI76lbmXw224O3hb/VNhfU+94+WAldatX34cXThohecL09Yfyrf5+tRoJ15e ynpUNFazquPMDehSrOot2BTFEiwLfxGbn8M88jY4aEuK7p6dgu/AKxEZW2tSTYJgvgnt I432jBQmig6HzL9f/OIV/mHTJCEQilaQPsNkNxigetYn1LNdFmc31IqsPyCP+whQVgkN +TSQ== X-Forwarded-Encrypted: i=1; AJvYcCWkRwCEeAM7/bMYH0fUE4xyayAnodXfIM8jMTgnJF6YSouHqzTetjxAW8Oql/gbf007IT/ZZsIpPDjfvZs=@vger.kernel.org X-Gm-Message-State: AOJu0YwcHH6fGHQpOPQiGjOGEUnETuYp4Hv2uQmuRiO80sxCXEASmGqi MseB2v1XxnHfmYY1lqsLOWnNNC2+wuHj4PYVc8xfcJL5Zshxwq+fI/s+ X-Gm-Gg: ASbGnctR0n+p8FsdVYWjhxuyPq40IndBpO8kDmaJLJbmkXgEuo0AC10trZVA6a4D9al 4FjJiOabUmB8nXl2zvqT6VrFC/xV5MIhKZ5FN+7BKi25vhTa/xlV1WIjdItby8l96lPMBCZRqHC 5S7p9O39OkUyzpW6Xu9NJ1TEgRUW+TTUhaFaZuVUdtKZ9wafceL6PFajAMjt178fBdQjf81kiwK Mbvkh6hH57xRuUthAqx67za5DgSyQK66j8F7zv0pssZ0IQxZ9en5yQ2hDs8MD4Lw0flwVT6J1Pw x5tuhbPkItc40BW0weaBHfZJbfKp15I7JewG6QtdTNql0VcrzW8EK78SDmzMTMsbB26QsIbeSjH EN4wfIrDnyGNlLgxG5WxbQH/XZGxBkF0CT7izDonUaol4+wVbU+BmrNpeGhlIP5Bz5YcMu+X+Vi zfM/ahLVA1v40= X-Google-Smtp-Source: AGHT+IEnUmucqP+clc1J7H8PyJUVBC91ey+7MbB47Yf97h5uYlKqoAo6/jmHTzo8phjYWgEIm4e9bg== X-Received: by 2002:a05:6000:2f86:b0:426:fb28:7964 with SMTP id ffacd0b85a97d-42704dac9ddmr4901776f8f.61.1760778843896; Sat, 18 Oct 2025 02:14:03 -0700 (PDT) Received: from shift.. ([86.124.201.90]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-471144d17cdsm121034215e9.18.2025.10.18.02.14.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Oct 2025 02:14:02 -0700 (PDT) From: Cezar Chiru To: andi.shyti@kernel.org, wsa+renesas@sang-engineering.com Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Cezar Chiru Subject: [PATCH v7 3/3] i2c: pcf8584: Move 'ret' variable inside for loop, break if ret < 0. Date: Sat, 18 Oct 2025 12:12:58 +0300 Message-ID: <20251018091258.5266-4-chiru.cezar.89@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251018091258.5266-1-chiru.cezar.89@gmail.com> References: <20251018091258.5266-1-chiru.cezar.89@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Require spaces around '=3D', '>' and '<'. Add space(s) around binary operators. Move 'ret' variable inside for loop. Then check if (ret < 0) break. This improves usage of ret variable. Enforce errors fixing based on checkpatch.pl output on file. Signed-off-by: Cezar Chiru --- drivers/i2c/algos/i2c-algo-pcf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-= pcf.c index 41a81d37e880..40c4d622e8c5 100644 --- a/drivers/i2c/algos/i2c-algo-pcf.c +++ b/drivers/i2c/algos/i2c-algo-pcf.c @@ -183,7 +183,7 @@ static int pcf_sendbytes(struct i2c_adapter *i2c_adap, = const char *buf, struct i2c_algo_pcf_data *adap =3D i2c_adap->algo_data; int wrcount, status, timeout; =20 - for (wrcount=3D0; wrcountalgo_data; struct i2c_msg *pmsg; int i; - int ret=3D0, timeout, status; + int timeout, status; =20 if (adap->xfer_begin) adap->xfer_begin(adap->data); @@ -284,9 +284,10 @@ static int pcf_xfer(struct i2c_adapter *i2c_adap, goto out; } =20 - for (i =3D 0;ret >=3D 0 && i < num; i++) { - pmsg =3D &msgs[i]; + for (i =3D 0; i < num; i++) { + int ret =3D 0; =20 + pmsg =3D &msgs[i]; ret =3D pcf_doAddress(adap, pmsg); =20 /* Send START */ @@ -321,6 +322,9 @@ static int pcf_xfer(struct i2c_adapter *i2c_adap, ret =3D pcf_sendbytes(i2c_adap, pmsg->buf, pmsg->len, (i + 1 =3D=3D num)); } + + if (ret < 0) + break; } =20 out: --=20 2.43.0