From patchwork Fri Apr 18 21:16:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 882715 Received: from 9.mo581.mail-out.ovh.net (9.mo581.mail-out.ovh.net [46.105.60.248]) (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 86593145A03 for ; Sat, 19 Apr 2025 03:41:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.105.60.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745034108; cv=none; b=utiqHbxDYlf0kYi+ATCm+t/Jng5F9MHeAWdPKevhPO/F5GY+BjIlmJHnEy4QCRy58qme1HT/hDsSf/hB/boRf5oPzmCb0EClzfLROdACxhM/ZTDg9x9KJmAClJE+I+3qVpAIM6y370+v2FETG+bMhyqkCZ60FnqKc+7WJnx2DVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745034108; c=relaxed/simple; bh=DOXOrP2nRFCXtvEvIGwGCHE78KHBPhafL4nGQYJGnls=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WUINyy4P5HJxPc3NQ4TH1jzfnVFP0hV3HnNHl2PKBFjK4nIH0rvT8uF+bvVlZLKv7c+cahf2JfDXTVkSeMDzJa9xsCnLfJOL2XCSClmDAcUWg1oOy8f4mJ+4mjnsv46s5mK/jmjeggBdXVZrNBxh+Dd3PC9dhle38RMamSZjcXo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=etezian.org; arc=none smtp.client-ip=46.105.60.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etezian.org Received: from director7.ghost.mail-out.ovh.net (unknown [10.108.17.245]) by mo581.mail-out.ovh.net (Postfix) with ESMTP id 4ZfSJ30YFLz1FMk for ; Fri, 18 Apr 2025 21:16:51 +0000 (UTC) Received: from ghost-submission-5b5ff79f4f-jhwpg (unknown [10.110.188.223]) by director7.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 944661FE0C; Fri, 18 Apr 2025 21:16:49 +0000 (UTC) Received: from etezian.org ([37.59.142.104]) by ghost-submission-5b5ff79f4f-jhwpg with ESMTPSA id g9HgF0HBAmj6UzIAUW6moQ (envelope-from ); Fri, 18 Apr 2025 21:16:49 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-104R0057ca26847-bf46-4a74-afa9-9db2bcc4f3e3, 9BBFD0B8C49B6260DDB62D1D32C292C5393E7E6E) smtp.auth=andi@etezian.org X-OVh-ClientIp: 178.39.90.92 From: Andi Shyti To: linux-i2c Cc: Andi Shyti Subject: [PATCH 01/10] i2c: iproc: Drop unnecessary initialisation of 'ret' Date: Fri, 18 Apr 2025 23:16:26 +0200 Message-ID: <20250418211635.2666234-2-andi.shyti@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250418211635.2666234-1-andi.shyti@kernel.org> References: <20250418211635.2666234-1-andi.shyti@kernel.org> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Ovh-Tracer-Id: 13925974475960420935 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfeefvddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetnhguihcuufhhhihtihcuoegrnhguihdrshhhhihtiheskhgvrhhnvghlrdhorhhgqeenucggtffrrghtthgvrhhnpefgudevjeetgeetlefhteeuteehgeefhefhkedtvdelheethfehveekudelueeuveenucfkphepuddvjedrtddrtddruddpudejkedrfeelrdeltddrledvpdefjedrheelrddugedvrddutdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpegrnhguihesvghtvgiiihgrnhdrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhivdgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehkedumgdpmhhouggvpehsmhhtphhouhht The 'ret' variable doesn't need to be initialised, as it is always assigned before use. While here, reorder the variable declarations in reverse Christmas tree style, by line length. Signed-off-by: Andi Shyti --- drivers/i2c/busses/i2c-bcm-iproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index 332a0fcca28d..5d846ab91e6f 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -1039,9 +1039,9 @@ static int bcm_iproc_i2c_cfg_speed(struct bcm_iproc_i2c_dev *iproc_i2c) static int bcm_iproc_i2c_probe(struct platform_device *pdev) { - int irq, ret = 0; struct bcm_iproc_i2c_dev *iproc_i2c; struct i2c_adapter *adap; + int irq, ret; iproc_i2c = devm_kzalloc(&pdev->dev, sizeof(*iproc_i2c), GFP_KERNEL); From patchwork Fri Apr 18 21:16:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 882429 Received: from 2.mo560.mail-out.ovh.net (2.mo560.mail-out.ovh.net [188.165.53.149]) (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 8411A70805 for ; Fri, 18 Apr 2025 21:24:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.165.53.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745011473; cv=none; b=K1Zzlovkd23CmpkcrCHJZYCW+rZn1doLgkWr6AS9/LbJrNuwG6BH4/1GRjEbRz/p6DA33wIBNms0HZoT0EmxQg+DkeI8zIuU8U1UlxQgfkIQQ97sYBpuwl0z7TpqGcBKdlobhWXA0qigDlv1sRs7+Dx520x8HkR0FdBbtZN72nI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745011473; c=relaxed/simple; bh=5WGaPSP3M6rjl6ltEI23zJBvWJjlBN14l/WwAD8CP+Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iVaoiMOEZwU/uzgXkM446qRbhCwmJQ0chdHtHquzSRhsOoNmfPwTYB2Y4u0SdzNWKDgU1I9pUR3PhHECOExazWsIz2zt+cOSXZqQzYjQGL4xZ0ZMH3TC9C8lx7bQPOlXO/cO95wZMQvQL+hAGvlpz5mAiEZaBEZJC9HyVqVDSqw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=etezian.org; arc=none smtp.client-ip=188.165.53.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etezian.org Received: from director8.ghost.mail-out.ovh.net (unknown [10.109.176.118]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id 4ZfSJ43Tflz1ggW for ; Fri, 18 Apr 2025 21:16:52 +0000 (UTC) Received: from ghost-submission-5b5ff79f4f-5pxxj (unknown [10.110.178.32]) by director8.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 257AC1FD1E; Fri, 18 Apr 2025 21:16:52 +0000 (UTC) Received: from etezian.org ([37.59.142.100]) by ghost-submission-5b5ff79f4f-5pxxj with ESMTPSA id Zc0eOEPBAmh+9AMAoF5Zmg (envelope-from ); Fri, 18 Apr 2025 21:16:52 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-100R00316932784-a669-42cb-80d9-70e09e47d080, 9BBFD0B8C49B6260DDB62D1D32C292C5393E7E6E) smtp.auth=andi@etezian.org X-OVh-ClientIp: 178.39.90.92 From: Andi Shyti To: linux-i2c Cc: Andi Shyti Subject: [PATCH 02/10] i2c: iproc: Use dev_err_probe in probe Date: Fri, 18 Apr 2025 23:16:27 +0200 Message-ID: <20250418211635.2666234-3-andi.shyti@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250418211635.2666234-1-andi.shyti@kernel.org> References: <20250418211635.2666234-1-andi.shyti@kernel.org> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Ovh-Tracer-Id: 13926255948694686279 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfeefvddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetnhguihcuufhhhihtihcuoegrnhguihdrshhhhihtiheskhgvrhhnvghlrdhorhhgqeenucggtffrrghtthgvrhhnpefgudevjeetgeetlefhteeuteehgeefhefhkedtvdelheethfehveekudelueeuveenucfkphepuddvjedrtddrtddruddpudejkedrfeelrdeltddrledvpdefjedrheelrddugedvrddutddtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpegrnhguihesvghtvgiiihgrnhdrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhivdgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehiedtmgdpmhhouggvpehsmhhtphhouhht Use dev_err_probe() instead of dev_err() and then return. Signed-off-by: Andi Shyti --- drivers/i2c/busses/i2c-bcm-iproc.c | 31 ++++++++++++------------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index 5d846ab91e6f..2e24959bc9af 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -1014,17 +1014,14 @@ static int bcm_iproc_i2c_cfg_speed(struct bcm_iproc_i2c_dev *iproc_i2c) bus_speed = I2C_MAX_STANDARD_MODE_FREQ; } - if (bus_speed < I2C_MAX_STANDARD_MODE_FREQ) { - dev_err(iproc_i2c->device, "%d Hz bus speed not supported\n", - bus_speed); - dev_err(iproc_i2c->device, - "valid speeds are 100khz and 400khz\n"); - return -EINVAL; - } else if (bus_speed < I2C_MAX_FAST_MODE_FREQ) { + if (bus_speed < I2C_MAX_STANDARD_MODE_FREQ) + return dev_err_probe(iproc_i2c->device, -EINVAL, + "%d Hz not supported (out of 100-400 kHz range)\n", + bus_speed); + else if (bus_speed < I2C_MAX_FAST_MODE_FREQ) bus_speed = I2C_MAX_STANDARD_MODE_FREQ; - } else { + else bus_speed = I2C_MAX_FAST_MODE_FREQ; - } iproc_i2c->bus_speed = bus_speed; val = iproc_i2c_rd_reg(iproc_i2c, TIM_CFG_OFFSET); @@ -1066,11 +1063,9 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev) ret = of_property_read_u32(iproc_i2c->device->of_node, "brcm,ape-hsls-addr-mask", &iproc_i2c->ape_addr_mask); - if (ret < 0) { - dev_err(iproc_i2c->device, - "'brcm,ape-hsls-addr-mask' missing\n"); - return -EINVAL; - } + if (ret < 0) + return dev_err_probe(iproc_i2c->device, ret, + "'brcm,ape-hsls-addr-mask' missing\n"); spin_lock_init(&iproc_i2c->idm_lock); @@ -1090,11 +1085,9 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev) ret = devm_request_irq(iproc_i2c->device, irq, bcm_iproc_i2c_isr, 0, pdev->name, iproc_i2c); - if (ret < 0) { - dev_err(iproc_i2c->device, - "unable to request irq %i\n", irq); - return ret; - } + if (ret < 0) + return dev_err_probe(iproc_i2c->device, ret, + "unable to request irq %i\n", irq); iproc_i2c->irq = irq; } else { From patchwork Fri Apr 18 21:16:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 882716 Received: from 1.mo550.mail-out.ovh.net (1.mo550.mail-out.ovh.net [178.32.127.22]) (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 5E1DD20ED for ; Sat, 19 Apr 2025 00:55:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.32.127.22 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745024130; cv=none; b=N4elPdBo0et5sr7hXLRMmnRQD0kQk0X/fB0C1Hvii6+O+nUY7SGd5tddiuS1d5tfwQe7Nmo3fon52XRA9BYAQrfSgBLp4ez81JxYgfVJtHvIeQdO2td7L8uG+bUuQtVUs/FeFWLeQWxcnEByX6jcAAcHxVcm25MC4PF4wSfmukQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745024130; c=relaxed/simple; bh=SvBQs+xgaH3rzs3Fm52JvwCT3jY0Enxx/F/kY40Dtn0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gzihjRawXaUVeJa0d1QFQDdZ33vBRiXoJpH8MjkOS/yBGKjfZuvxySKfsjMT8U+iiRyKe6n6dIq74bK0KGDzw49PNVmKv8Q2xPqc56BzYpSbMU1ZhnDtr95akcB1FOm+hK68lArqQe71ugGkRb/gzbd5qf790UAp1Z7zBBpEb7Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=etezian.org; arc=none smtp.client-ip=178.32.127.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etezian.org Received: from director11.ghost.mail-out.ovh.net (unknown [10.108.9.127]) by mo550.mail-out.ovh.net (Postfix) with ESMTP id 4ZfSJ54Bwnz1P8N for ; Fri, 18 Apr 2025 21:16:53 +0000 (UTC) Received: from ghost-submission-5b5ff79f4f-5pxxj (unknown [10.110.164.236]) by director11.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 4B24B1FD7E; Fri, 18 Apr 2025 21:16:53 +0000 (UTC) Received: from etezian.org ([37.59.142.98]) by ghost-submission-5b5ff79f4f-5pxxj with ESMTPSA id FdMgC0XBAmiD9AMAoF5Zmg (envelope-from ); Fri, 18 Apr 2025 21:16:53 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-98R002bbfe6eed-130f-45f7-be39-a1244d88b3ce, 9BBFD0B8C49B6260DDB62D1D32C292C5393E7E6E) smtp.auth=andi@etezian.org X-OVh-ClientIp: 178.39.90.92 From: Andi Shyti To: linux-i2c Cc: Andi Shyti Subject: [PATCH 03/10] i2c: iproc: Use u32 instead of uint32_t Date: Fri, 18 Apr 2025 23:16:28 +0200 Message-ID: <20250418211635.2666234-4-andi.shyti@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250418211635.2666234-1-andi.shyti@kernel.org> References: <20250418211635.2666234-1-andi.shyti@kernel.org> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Ovh-Tracer-Id: 13926537424641985095 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfeefvddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetnhguihcuufhhhihtihcuoegrnhguihdrshhhhihtiheskhgvrhhnvghlrdhorhhgqeenucggtffrrghtthgvrhhnpefgudevjeetgeetlefhteeuteehgeefhefhkedtvdelheethfehveekudelueeuveenucfkphepuddvjedrtddrtddruddpudejkedrfeelrdeltddrledvpdefjedrheelrddugedvrdelkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomheprghnughisegvthgviihirghnrdhorhhgpdhnsggprhgtphhtthhopedupdhrtghpthhtoheplhhinhhugidqihdvtgesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheehtdgmpdhmohguvgepshhmthhpohhuth In the kernel u32 should be used instead of unit32_t. Signed-off-by: Andi Shyti --- drivers/i2c/busses/i2c-bcm-iproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index 2e24959bc9af..3816ceb713d9 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -542,7 +542,7 @@ static bool bcm_iproc_i2c_slave_isr(struct bcm_iproc_i2c_dev *iproc_i2c, static void bcm_iproc_i2c_read_valid_bytes(struct bcm_iproc_i2c_dev *iproc_i2c) { struct i2c_msg *msg = iproc_i2c->msg; - uint32_t val; + u32 val; /* Read valid data from RX FIFO */ while (iproc_i2c->rx_bytes < msg->len) { @@ -977,7 +977,7 @@ static int bcm_iproc_i2c_xfer(struct i2c_adapter *adapter, return num; } -static uint32_t bcm_iproc_i2c_functionality(struct i2c_adapter *adap) +static u32 bcm_iproc_i2c_functionality(struct i2c_adapter *adap) { u32 val; From patchwork Fri Apr 18 21:16:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 882426 Received: from 5.mo576.mail-out.ovh.net (5.mo576.mail-out.ovh.net [46.105.43.105]) (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 412DF2528EA for ; Fri, 18 Apr 2025 23:11:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.105.43.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745017909; cv=none; b=a4Lg7p4jdYvslBZ7imVrTH26hQougsGKGwZ5BeLf7hqWe3gQVT4MGuINoB+g/iRjMvhEr88ZQpFuewXUzqg2iQlr0fbWs64TDOZ1iPpgXl+3tXICVgCer8JYFConm4pjH9tR1m1pE7hbAlZZg+zhxMXfH540+mZCRG1jHXSvsYU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745017909; c=relaxed/simple; bh=UUC14YA2YoslkTd/j1Cp9LplFvbFq7GvXbWEK2zzazI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qKhHzuDYjfctDzBFEKmmIjALpVYBiOYaOlxQsSL8i+yrbfdaMCNJCmPgHZ1qt5fisASM/P7Q32hTIE9E5i9/7asTOrNBDDSSQsNVvg3CTxdtqY+ZtZVl8Nul4MPTaSraphch/jLNTNhhPjeqBSIla5P14aRWt2k/1/cZg1HHiFQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=etezian.org; arc=none smtp.client-ip=46.105.43.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etezian.org Received: from director8.ghost.mail-out.ovh.net (unknown [10.109.140.151]) by mo576.mail-out.ovh.net (Postfix) with ESMTP id 4ZfSJ819hbz1vQy for ; Fri, 18 Apr 2025 21:16:56 +0000 (UTC) Received: from ghost-submission-5b5ff79f4f-bt6hd (unknown [10.110.113.47]) by director8.ghost.mail-out.ovh.net (Postfix) with ESMTPS id DDB871FD1E; Fri, 18 Apr 2025 21:16:55 +0000 (UTC) Received: from etezian.org ([37.59.142.107]) by ghost-submission-5b5ff79f4f-bt6hd with ESMTPSA id 1qWOLUfBAmi89gMAyP1w0w (envelope-from ); Fri, 18 Apr 2025 21:16:55 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-107S00112209747-3b9d-48bb-b4f7-df806b7bbc97, 9BBFD0B8C49B6260DDB62D1D32C292C5393E7E6E) smtp.auth=andi@etezian.org X-OVh-ClientIp: 178.39.90.92 From: Andi Shyti To: linux-i2c Cc: Andi Shyti Subject: [PATCH 05/10] i2c: iproc: Remove stray blank line in slave ISR Date: Fri, 18 Apr 2025 23:16:30 +0200 Message-ID: <20250418211635.2666234-6-andi.shyti@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250418211635.2666234-1-andi.shyti@kernel.org> References: <20250418211635.2666234-1-andi.shyti@kernel.org> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Ovh-Tracer-Id: 13927381848306420295 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfeefvdduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetnhguihcuufhhhihtihcuoegrnhguihdrshhhhihtiheskhgvrhhnvghlrdhorhhgqeenucggtffrrghtthgvrhhnpefgudevjeetgeetlefhteeuteehgeefhefhkedtvdelheethfehveekudelueeuveenucfkphepuddvjedrtddrtddruddpudejkedrfeelrdeltddrledvpdefjedrheelrddugedvrddutdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpegrnhguihesvghtvgiiihgrnhdrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhivdgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehjeeimgdpmhhouggvpehsmhhtphhouhht Drop an unnecessary blank line in bcm_iproc_i2c_slave_isr(). Signed-off-by: Andi Shyti --- drivers/i2c/busses/i2c-bcm-iproc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index 3e76120c23ab..44083698121a 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -438,7 +438,6 @@ static bool bcm_iproc_i2c_slave_isr(struct bcm_iproc_i2c_dev *iproc_i2c, u32 val; u8 value; - if (status & BIT(IS_S_TX_UNDERRUN_SHIFT)) { iproc_i2c->tx_underrun++; if (iproc_i2c->tx_underrun == 1) From patchwork Fri Apr 18 21:16:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 882717 Received: from 4.mo583.mail-out.ovh.net (4.mo583.mail-out.ovh.net [178.33.111.247]) (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 28BA51E49F for ; Fri, 18 Apr 2025 22:36:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.33.111.247 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745015776; cv=none; b=CrqVQ0x84uTNw47UZC50BfP+dqc5bF5U0h1+9x3lVXv+H/woveip0rUlaNjnkbpCGPqKiVsSfpncwIo98sKn3nsybTseAqQCZ5/DORWH6SxTOzlLlhGQvMsLi2UQiGqXXz8TJ8CvtJu+MgWAL4fAGyN+miQjUPEhdaii0RhAKdk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745015776; c=relaxed/simple; bh=K31VTDnAO0XegQP88s5PyhgwqoyK9gcD4n7fKhv+fhc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b87QUI/Lc2WWnzZQ5F3LUnyAoqPih7nqzcWdJvh+Oev687+Gt9szVXZ6Q8ZxJP80jaW9gnOafcilCn6ujSDn94GuMN/ZufTAHTRjw8h4x+KJ8x02/2RPLlDxXmj0VWULUy561duiYUBduIFdlAVAO3cjtbw4XbcxGJQr+Igx3wg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=etezian.org; arc=none smtp.client-ip=178.33.111.247 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etezian.org Received: from director10.ghost.mail-out.ovh.net (unknown [10.108.25.2]) by mo583.mail-out.ovh.net (Postfix) with ESMTP id 4ZfSJ93vG9z1SHd for ; Fri, 18 Apr 2025 21:16:57 +0000 (UTC) Received: from ghost-submission-5b5ff79f4f-vvf6g (unknown [10.110.188.251]) by director10.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 385E21FE50; Fri, 18 Apr 2025 21:16:57 +0000 (UTC) Received: from etezian.org ([37.59.142.95]) by ghost-submission-5b5ff79f4f-vvf6g with ESMTPSA id fEQAAUnBAmjCTwEAlPG0AA (envelope-from ); Fri, 18 Apr 2025 21:16:57 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-95G001a241a1fb-5cc7-4823-b462-e32fcbfb4b86, 9BBFD0B8C49B6260DDB62D1D32C292C5393E7E6E) smtp.auth=andi@etezian.org X-OVh-ClientIp: 178.39.90.92 From: Andi Shyti To: linux-i2c Cc: Andi Shyti Subject: [PATCH 06/10] i2c: iproc: Replace udelay() with usleep_range() Date: Fri, 18 Apr 2025 23:16:31 +0200 Message-ID: <20250418211635.2666234-7-andi.shyti@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250418211635.2666234-1-andi.shyti@kernel.org> References: <20250418211635.2666234-1-andi.shyti@kernel.org> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Ovh-Tracer-Id: 13927663325296331335 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfeefvdduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetnhguihcuufhhhihtihcuoegrnhguihdrshhhhihtiheskhgvrhhnvghlrdhorhhgqeenucggtffrrghtthgvrhhnpefgudevjeetgeetlefhteeuteehgeefhefhkedtvdelheethfehveekudelueeuveenucfkphepuddvjedrtddrtddruddpudejkedrfeelrdeltddrledvpdefjedrheelrddugedvrdelheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomheprghnughisegvthgviihirghnrdhorhhgpdhnsggprhgtphhtthhopedupdhrtghpthhtoheplhhinhhugidqihdvtgesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheekfegmpdhmohguvgepshhmthhpohhuth Replace udelay(100) with usleep_range(100, 200) as recommended by kernel documentation. The delay is not in atomic context, so busy-waiting is unnecessary. Also update the comment for clarity. Signed-off-by: Andi Shyti --- drivers/i2c/busses/i2c-bcm-iproc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index 44083698121a..2e04ea157e8e 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -276,8 +276,8 @@ static void bcm_iproc_i2c_slave_init( val |= BIT(CFG_RESET_SHIFT); iproc_i2c_wr_reg(iproc_i2c, CFG_OFFSET, val); - /* wait 100 usec per spec */ - udelay(100); + /* wait approximately 100 usec as per spec */ + usleep_range(100, 200); /* bring controller out of reset */ val &= ~(BIT(CFG_RESET_SHIFT)); @@ -687,8 +687,8 @@ static void bcm_iproc_i2c_init(struct bcm_iproc_i2c_dev *iproc_i2c) val &= ~(BIT(CFG_EN_SHIFT)); iproc_i2c_wr_reg(iproc_i2c, CFG_OFFSET, val); - /* wait 100 usec per spec */ - udelay(100); + /* wait approximately 100 usec as per spec */ + usleep_range(100, 200); /* bring controller out of reset */ val &= ~(BIT(CFG_RESET_SHIFT)); From patchwork Fri Apr 18 21:16:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 882718 Received: from 2.mo561.mail-out.ovh.net (2.mo561.mail-out.ovh.net [46.105.75.36]) (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 69C001B6CE0 for ; Fri, 18 Apr 2025 21:53:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.105.75.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745013234; cv=none; b=Vru47/M0XbGEl8Rb6nFwEmDJQbwwKW5RVqmVGBRQoh8sEmkwdQRXgME1hwkgAgr4irjV/WG9wH7LDQkwGkhOOXCBAcbHvfInwx4mH6XTt6WJazAnqmR2CpEifjKD1pz2GEJ5gn35LQgC/4zzxoKocOl/Mg13pPMmqLkjMQ2Cdkw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745013234; c=relaxed/simple; bh=GElmE044h5cSHZYW7tOeuvVEqudlN30eQflvguUHTKE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IksBqJELWNFI9fS1EuNOLvW/+6V2nnd5jOYSXilReZHa4eMPVvicbiXABvai7TcrjFd2/+9MMXq+rUV/5l9YPbpmoQSV5U8kVfxWunCOvKbYexDOc4ole88TbnYXQIvvbFZY24ebvBOrPC/hv15CT4ibvaYu7BFpYUq8bAB1iMo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=etezian.org; arc=none smtp.client-ip=46.105.75.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etezian.org Received: from director7.ghost.mail-out.ovh.net (unknown [10.108.9.127]) by mo561.mail-out.ovh.net (Postfix) with ESMTP id 4ZfSJB35JXz1LVj for ; Fri, 18 Apr 2025 21:16:58 +0000 (UTC) Received: from ghost-submission-5b5ff79f4f-lm9kv (unknown [10.110.96.7]) by director7.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 2C6D81FD50; Fri, 18 Apr 2025 21:16:58 +0000 (UTC) Received: from etezian.org ([37.59.142.111]) by ghost-submission-5b5ff79f4f-lm9kv with ESMTPSA id D526AkrBAmjJPgkAYJzoiA (envelope-from ); Fri, 18 Apr 2025 21:16:58 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-111S005cce18062-f229-41d5-a2c3-6abe90f982d8, 9BBFD0B8C49B6260DDB62D1D32C292C5393E7E6E) smtp.auth=andi@etezian.org X-OVh-ClientIp: 178.39.90.92 From: Andi Shyti To: linux-i2c Cc: Andi Shyti Subject: [PATCH 07/10] i2c: iproc: Fix indentation of bcm_iproc_i2c_slave_init() Date: Fri, 18 Apr 2025 23:16:32 +0200 Message-ID: <20250418211635.2666234-8-andi.shyti@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250418211635.2666234-1-andi.shyti@kernel.org> References: <20250418211635.2666234-1-andi.shyti@kernel.org> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Ovh-Tracer-Id: 13927944798707780167 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfeefvddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetnhguihcuufhhhihtihcuoegrnhguihdrshhhhihtiheskhgvrhhnvghlrdhorhhgqeenucggtffrrghtthgvrhhnpefgudevjeetgeetlefhteeuteehgeefhefhkedtvdelheethfehveekudelueeuveenucfkphepuddvjedrtddrtddruddpudejkedrfeelrdeltddrledvpdefjedrheelrddugedvrdduuddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpegrnhguihesvghtvgiiihgrnhdrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhivdgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehiedumgdpmhhouggvpehsmhhtphhouhht Adjust the indentation of the bcm_iproc_i2c_slave_init() function definition to match standard kernel coding style. Don't end the line with an open parenthesis. Signed-off-by: Andi Shyti --- drivers/i2c/busses/i2c-bcm-iproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index 2e04ea157e8e..d25b393f456b 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -264,8 +264,8 @@ static inline void iproc_i2c_wr_reg(struct bcm_iproc_i2c_dev *iproc_i2c, } } -static void bcm_iproc_i2c_slave_init( - struct bcm_iproc_i2c_dev *iproc_i2c, bool need_reset) +static void bcm_iproc_i2c_slave_init(struct bcm_iproc_i2c_dev *iproc_i2c, + bool need_reset) { u32 val; From patchwork Fri Apr 18 21:16:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 882720 Received: from 8.mo575.mail-out.ovh.net (8.mo575.mail-out.ovh.net [46.105.74.219]) (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 3AA6F70805 for ; Fri, 18 Apr 2025 21:24:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.105.74.219 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745011447; cv=none; b=nfieTyhou2n7kncGjTZsaRB39eWLNFD8cO+0rIKIzwH/5eSRUCcKD9TWXtRir2G/XgRPZ1aGsChvRCSyl9r+Xh9Sb4S0cd/hh1mctPJ0YuVSwuTPHVS07s5kjg0y4EuY/F24hSyZvgUvPpTK8dpYhUg5Rap3Vok/5kwvUDfiWX8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745011447; c=relaxed/simple; bh=o2ln017Zl9ileyW/vJmZqqPP0Shcf1lfLAeYoScXZ0Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MT5MDc7pqMnUrDhvh4fk2A+7aa1CC/i0LwdF9W7rfEvW8u6iyWsuw8NyTzq3EuxoFN9qNnjP7kIYJOdd/xJO8ZLDFtjxtzGt9YsXciPVQn5aVJlbI/5EfE2+OBqyVKaGFzsALriST2SYx+Vkvj8rQLPQap/tICPAAJYSucP0Hc8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=etezian.org; arc=none smtp.client-ip=46.105.74.219 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etezian.org Received: from director5.ghost.mail-out.ovh.net (unknown [10.109.140.151]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id 4ZfSJC1DT5z1nvL for ; Fri, 18 Apr 2025 21:16:59 +0000 (UTC) Received: from ghost-submission-5b5ff79f4f-74q2x (unknown [10.110.164.123]) by director5.ghost.mail-out.ovh.net (Postfix) with ESMTPS id E712F1FDB8; Fri, 18 Apr 2025 21:16:58 +0000 (UTC) Received: from etezian.org ([37.59.142.107]) by ghost-submission-5b5ff79f4f-74q2x with ESMTPSA id blpXL0rBAmi1eQAAHE1v4A (envelope-from ); Fri, 18 Apr 2025 21:16:58 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-107S001bd28fce3-5e9d-4766-a0c7-b70f6ca098a5, 9BBFD0B8C49B6260DDB62D1D32C292C5393E7E6E) smtp.auth=andi@etezian.org X-OVh-ClientIp: 178.39.90.92 From: Andi Shyti To: linux-i2c Cc: Andi Shyti Subject: [PATCH 08/10] i2c: iproc: Move function and avoid prototypes Date: Fri, 18 Apr 2025 23:16:33 +0200 Message-ID: <20250418211635.2666234-9-andi.shyti@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250418211635.2666234-1-andi.shyti@kernel.org> References: <20250418211635.2666234-1-andi.shyti@kernel.org> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Ovh-Tracer-Id: 13928226274704362055 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfeefvdduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetnhguihcuufhhhihtihcuoegrnhguihdrshhhhihtiheskhgvrhhnvghlrdhorhhgqeenucggtffrrghtthgvrhhnpefgudevjeetgeetlefhteeuteehgeefhefhkedtvdelheethfehveekudelueeuveenucfkphepuddvjedrtddrtddruddpudejkedrfeelrdeltddrledvpdefjedrheelrddugedvrddutdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpegrnhguihesvghtvgiiihgrnhdrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhivdgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehjeehmgdpmhhouggvpehsmhhtphhouhht Shuffle a bit the code in order to avoid prototypes. Signed-off-by: Andi Shyti --- drivers/i2c/busses/i2c-bcm-iproc.c | 143 ++++++++++++++--------------- 1 file changed, 69 insertions(+), 74 deletions(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index d25b393f456b..74903edb4925 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -224,11 +224,6 @@ static void slave_rx_tasklet_fn(unsigned long); | BIT(IS_S_TX_UNDERRUN_SHIFT) | BIT(IS_S_RX_FIFO_FULL_SHIFT)\ | BIT(IS_S_RX_THLD_SHIFT)) -static int bcm_iproc_i2c_reg_slave(struct i2c_client *slave); -static int bcm_iproc_i2c_unreg_slave(struct i2c_client *slave); -static void bcm_iproc_i2c_enable_disable(struct bcm_iproc_i2c_dev *iproc_i2c, - bool enable); - static inline u32 iproc_i2c_rd_reg(struct bcm_iproc_i2c_dev *iproc_i2c, u32 offset) { @@ -316,6 +311,19 @@ static void bcm_iproc_i2c_slave_init(struct bcm_iproc_i2c_dev *iproc_i2c, iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, val); } +static void bcm_iproc_i2c_enable_disable(struct bcm_iproc_i2c_dev *iproc_i2c, + bool enable) +{ + u32 val; + + val = iproc_i2c_rd_reg(iproc_i2c, CFG_OFFSET); + if (enable) + val |= BIT(CFG_EN_SHIFT); + else + val &= ~BIT(CFG_EN_SHIFT); + iproc_i2c_wr_reg(iproc_i2c, CFG_OFFSET, val); +} + static bool bcm_iproc_i2c_check_slave_status (struct bcm_iproc_i2c_dev *iproc_i2c, u32 status) { @@ -707,19 +715,6 @@ static void bcm_iproc_i2c_init(struct bcm_iproc_i2c_dev *iproc_i2c) iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, 0xffffffff); } -static void bcm_iproc_i2c_enable_disable(struct bcm_iproc_i2c_dev *iproc_i2c, - bool enable) -{ - u32 val; - - val = iproc_i2c_rd_reg(iproc_i2c, CFG_OFFSET); - if (enable) - val |= BIT(CFG_EN_SHIFT); - else - val &= ~BIT(CFG_EN_SHIFT); - iproc_i2c_wr_reg(iproc_i2c, CFG_OFFSET, val); -} - static int bcm_iproc_i2c_check_status(struct bcm_iproc_i2c_dev *iproc_i2c, struct i2c_msg *msg) { @@ -988,6 +983,62 @@ static u32 bcm_iproc_i2c_functionality(struct i2c_adapter *adap) return val; } +static int bcm_iproc_i2c_reg_slave(struct i2c_client *slave) +{ + struct bcm_iproc_i2c_dev *iproc_i2c = i2c_get_adapdata(slave->adapter); + + if (iproc_i2c->slave) + return -EBUSY; + + if (slave->flags & I2C_CLIENT_TEN) + return -EAFNOSUPPORT; + + iproc_i2c->slave = slave; + + tasklet_init(&iproc_i2c->slave_rx_tasklet, slave_rx_tasklet_fn, + (unsigned long)iproc_i2c); + + bcm_iproc_i2c_slave_init(iproc_i2c, false); + return 0; +} + +static int bcm_iproc_i2c_unreg_slave(struct i2c_client *slave) +{ + u32 tmp; + struct bcm_iproc_i2c_dev *iproc_i2c = i2c_get_adapdata(slave->adapter); + + if (!iproc_i2c->slave) + return -EINVAL; + + disable_irq(iproc_i2c->irq); + + tasklet_kill(&iproc_i2c->slave_rx_tasklet); + + /* disable all slave interrupts */ + tmp = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); + tmp &= ~(IE_S_ALL_INTERRUPT_MASK << + IE_S_ALL_INTERRUPT_SHIFT); + iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, tmp); + + /* Erase the slave address programmed */ + tmp = iproc_i2c_rd_reg(iproc_i2c, S_CFG_SMBUS_ADDR_OFFSET); + tmp &= ~BIT(S_CFG_EN_NIC_SMB_ADDR3_SHIFT); + iproc_i2c_wr_reg(iproc_i2c, S_CFG_SMBUS_ADDR_OFFSET, tmp); + + /* flush TX/RX FIFOs */ + tmp = (BIT(S_FIFO_RX_FLUSH_SHIFT) | BIT(S_FIFO_TX_FLUSH_SHIFT)); + iproc_i2c_wr_reg(iproc_i2c, S_FIFO_CTRL_OFFSET, tmp); + + /* clear all pending slave interrupts */ + iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, ISR_MASK_SLAVE); + + iproc_i2c->slave = NULL; + + enable_irq(iproc_i2c->irq); + + return 0; +} + static struct i2c_algorithm bcm_iproc_algo = { .master_xfer = bcm_iproc_i2c_xfer, .functionality = bcm_iproc_i2c_functionality, @@ -1173,62 +1224,6 @@ static const struct dev_pm_ops bcm_iproc_i2c_pm_ops = { .resume_early = &bcm_iproc_i2c_resume }; -static int bcm_iproc_i2c_reg_slave(struct i2c_client *slave) -{ - struct bcm_iproc_i2c_dev *iproc_i2c = i2c_get_adapdata(slave->adapter); - - if (iproc_i2c->slave) - return -EBUSY; - - if (slave->flags & I2C_CLIENT_TEN) - return -EAFNOSUPPORT; - - iproc_i2c->slave = slave; - - tasklet_init(&iproc_i2c->slave_rx_tasklet, slave_rx_tasklet_fn, - (unsigned long)iproc_i2c); - - bcm_iproc_i2c_slave_init(iproc_i2c, false); - return 0; -} - -static int bcm_iproc_i2c_unreg_slave(struct i2c_client *slave) -{ - u32 tmp; - struct bcm_iproc_i2c_dev *iproc_i2c = i2c_get_adapdata(slave->adapter); - - if (!iproc_i2c->slave) - return -EINVAL; - - disable_irq(iproc_i2c->irq); - - tasklet_kill(&iproc_i2c->slave_rx_tasklet); - - /* disable all slave interrupts */ - tmp = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); - tmp &= ~(IE_S_ALL_INTERRUPT_MASK << - IE_S_ALL_INTERRUPT_SHIFT); - iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, tmp); - - /* Erase the slave address programmed */ - tmp = iproc_i2c_rd_reg(iproc_i2c, S_CFG_SMBUS_ADDR_OFFSET); - tmp &= ~BIT(S_CFG_EN_NIC_SMB_ADDR3_SHIFT); - iproc_i2c_wr_reg(iproc_i2c, S_CFG_SMBUS_ADDR_OFFSET, tmp); - - /* flush TX/RX FIFOs */ - tmp = (BIT(S_FIFO_RX_FLUSH_SHIFT) | BIT(S_FIFO_TX_FLUSH_SHIFT)); - iproc_i2c_wr_reg(iproc_i2c, S_FIFO_CTRL_OFFSET, tmp); - - /* clear all pending slave interrupts */ - iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, ISR_MASK_SLAVE); - - iproc_i2c->slave = NULL; - - enable_irq(iproc_i2c->irq); - - return 0; -} - static const struct of_device_id bcm_iproc_i2c_of_match[] = { { .compatible = "brcm,iproc-i2c", From patchwork Fri Apr 18 21:16:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 882428 Received: from 6.mo575.mail-out.ovh.net (6.mo575.mail-out.ovh.net [46.105.63.100]) (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 7014E70805 for ; Fri, 18 Apr 2025 21:33:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.105.63.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745012034; cv=none; b=M/ebhyhsfMRZUzN+0zVA5xLw55jXLCUm+GWYIdU7Th19h9FN4ERj4SNh0wozbV7kUAqvPrRIhqfKS4rqbMfqa0qtxak71nJcVog+NE33udigRPT1D8pRQLtw4M21hsHGFDT8xIS2CPbDv7ZxqN+7rcQHdG7il+AA80W5WKhzU/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745012034; c=relaxed/simple; bh=gtvZRB9iNxOvkloBmfD/D8ku0CD51jtEgy34dv8PS7k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gW5hlbNL+4aBSNYZ5d8dlLSQ/e7FrZDraqEJVEsBbBTmpqcvxn7m+IH+KNuF292M8Ujr/YanYv/sTJ9XcOphyFAn3DoY0yHtSE2UjI2eYqyr3zHGEPkf4Ai4POmRJU/7qxHlZ41kTEdbyi7cb+Q5FfY2KgZfH1HmHOFWnjNSv7k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=etezian.org; arc=none smtp.client-ip=46.105.63.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etezian.org Received: from director7.ghost.mail-out.ovh.net (unknown [10.108.25.156]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id 4ZfSJC6WFfz1nw3 for ; Fri, 18 Apr 2025 21:16:59 +0000 (UTC) Received: from ghost-submission-5b5ff79f4f-qcsxk (unknown [10.110.96.141]) by director7.ghost.mail-out.ovh.net (Postfix) with ESMTPS id A6E8B1FD50; Fri, 18 Apr 2025 21:16:59 +0000 (UTC) Received: from etezian.org ([37.59.142.114]) by ghost-submission-5b5ff79f4f-qcsxk with ESMTPSA id pjniIEvBAmh2TDUA+qAPwg (envelope-from ); Fri, 18 Apr 2025 21:16:59 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-114S008d4f4e433-c83a-4006-8edf-f10d0c83a561, 9BBFD0B8C49B6260DDB62D1D32C292C5393E7E6E) smtp.auth=andi@etezian.org X-OVh-ClientIp: 178.39.90.92 From: Andi Shyti To: linux-i2c Cc: Andi Shyti Subject: [PATCH 09/10] i2c: iproc: When there's an error treat it as an error Date: Fri, 18 Apr 2025 23:16:34 +0200 Message-ID: <20250418211635.2666234-10-andi.shyti@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250418211635.2666234-1-andi.shyti@kernel.org> References: <20250418211635.2666234-1-andi.shyti@kernel.org> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Ovh-Tracer-Id: 13928226274471512647 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfeefvdduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetnhguihcuufhhhihtihcuoegrnhguihdrshhhhihtiheskhgvrhhnvghlrdhorhhgqeenucggtffrrghtthgvrhhnpefgudevjeetgeetlefhteeuteehgeefhefhkedtvdelheethfehveekudelueeuveenucfkphepuddvjedrtddrtddruddpudejkedrfeelrdeltddrledvpdefjedrheelrddugedvrdduudegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpegrnhguihesvghtvgiiihgrnhdrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhivdgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehjeehmgdpmhhouggvpehsmhhtphhouhht If the xfer fails, it indicates a real error. Log it with an error message instead of a debug message to reflect its severity. Signed-off-by: Andi Shyti --- drivers/i2c/busses/i2c-bcm-iproc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index 74903edb4925..9356a16422a3 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -728,31 +728,31 @@ static int bcm_iproc_i2c_check_status(struct bcm_iproc_i2c_dev *iproc_i2c, return 0; case M_CMD_STATUS_LOST_ARB: - dev_dbg(iproc_i2c->device, "lost bus arbitration\n"); + dev_err(iproc_i2c->device, "lost bus arbitration\n"); return -EAGAIN; case M_CMD_STATUS_NACK_ADDR: - dev_dbg(iproc_i2c->device, "NAK addr:0x%02x\n", msg->addr); + dev_err(iproc_i2c->device, "NAK addr:0x%02x\n", msg->addr); return -ENXIO; case M_CMD_STATUS_NACK_DATA: - dev_dbg(iproc_i2c->device, "NAK data\n"); + dev_err(iproc_i2c->device, "NAK data\n"); return -ENXIO; case M_CMD_STATUS_TIMEOUT: - dev_dbg(iproc_i2c->device, "bus timeout\n"); + dev_err(iproc_i2c->device, "bus timeout\n"); return -ETIMEDOUT; case M_CMD_STATUS_FIFO_UNDERRUN: - dev_dbg(iproc_i2c->device, "FIFO under-run\n"); + dev_err(iproc_i2c->device, "FIFO under-run\n"); return -ENXIO; case M_CMD_STATUS_RX_FIFO_FULL: - dev_dbg(iproc_i2c->device, "RX FIFO full\n"); + dev_err(iproc_i2c->device, "RX FIFO full\n"); return -ETIMEDOUT; default: - dev_dbg(iproc_i2c->device, "unknown error code=%d\n", val); + dev_err(iproc_i2c->device, "unknown error code=%d\n", val); /* re-initialize i2c for recovery */ bcm_iproc_i2c_enable_disable(iproc_i2c, false); @@ -964,7 +964,7 @@ static int bcm_iproc_i2c_xfer(struct i2c_adapter *adapter, ret = bcm_iproc_i2c_xfer_internal(iproc_i2c, msgs, process_call); if (ret) { - dev_dbg(iproc_i2c->device, "xfer failed\n"); + dev_err(iproc_i2c->device, "xfer failed\n"); return ret; } From patchwork Fri Apr 18 21:16:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 882427 Received: from 4.mo575.mail-out.ovh.net (4.mo575.mail-out.ovh.net [46.105.59.63]) (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 47AC81B6CE0 for ; Fri, 18 Apr 2025 21:53:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.105.59.63 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745013240; cv=none; b=rYJPBoPgO8FlR1SFzdmw1G7FDl4kLhItgGDD+vFMi9We6BpeoEoiRwhDyEKUBOQ+l2PnWciSEAwPF0ZeuUQMf26wjc09AwnGWetJhvMZp2S9UCGSQvJ7FW9irlxrBekdF/UIg+zFWVgdZlyQNbFN1HmcYztLnC9hrfUm13RvmXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745013240; c=relaxed/simple; bh=TLZPBrBmg9iyGe7OJXTmYOUOYGebh+kY+OAKXk68CDA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AK0Xyn9W/+bmNXyzNk73zif1rRiMPy/b0yu9Dpfdh39FKnyCWyqgcGimijAU0vjK06CaiNNaDDh18/dUAog4CJx2i4FUXzKzUwaGjFJ2dz5BCh9JfISfE71vrkjtGhu+o6IXSuOCIP56wgKAuLn4OJJUkYq3Ga2tH1euFzNiUQU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=etezian.org; arc=none smtp.client-ip=46.105.59.63 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etezian.org Received: from director2.ghost.mail-out.ovh.net (unknown [10.108.2.55]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id 4ZfSJD4yp8z1nvf for ; Fri, 18 Apr 2025 21:17:00 +0000 (UTC) Received: from ghost-submission-5b5ff79f4f-wtzwn (unknown [10.110.168.38]) by director2.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 6EDB31FDCE; Fri, 18 Apr 2025 21:17:00 +0000 (UTC) Received: from etezian.org ([37.59.142.96]) by ghost-submission-5b5ff79f4f-wtzwn with ESMTPSA id z3aTE0zBAmge9wMArzU8bQ (envelope-from ); Fri, 18 Apr 2025 21:17:00 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-96R001abac3a2a-a598-4fc0-aafe-661099c1a667, 9BBFD0B8C49B6260DDB62D1D32C292C5393E7E6E) smtp.auth=andi@etezian.org X-OVh-ClientIp: 178.39.90.92 From: Andi Shyti To: linux-i2c Cc: Andi Shyti Subject: [PATCH 10/10] i2c: iproc: Remove unnecessary double negation Date: Fri, 18 Apr 2025 23:16:35 +0200 Message-ID: <20250418211635.2666234-11-andi.shyti@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250418211635.2666234-1-andi.shyti@kernel.org> References: <20250418211635.2666234-1-andi.shyti@kernel.org> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Ovh-Tracer-Id: 13928507748792601159 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfeefvdduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetnhguihcuufhhhihtihcuoegrnhguihdrshhhhihtiheskhgvrhhnvghlrdhorhhgqeenucggtffrrghtthgvrhhnpefgudevjeetgeetlefhteeuteehgeefhefhkedtvdelheethfehveekudelueeuveenucfkphepuddvjedrtddrtddruddpudejkedrfeelrdeltddrledvpdefjedrheelrddugedvrdelieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomheprghnughisegvthgviihirghnrdhorhhgpdhnsggprhgtphhtthhopedupdhrtghpthhtoheplhhinhhugidqihdvtgesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheejhegmpdhmohguvgepshhmthhpohhuth True is true when greater than '0', no need for double negation inside the if statement. Signed-off-by: Andi Shyti --- drivers/i2c/busses/i2c-bcm-iproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index 9356a16422a3..2d117f242875 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -836,8 +836,8 @@ static int bcm_iproc_i2c_xfer_internal(struct bcm_iproc_i2c_dev *iproc_i2c, struct i2c_msg *msg = &msgs[0]; /* check if bus is busy */ - if (!!(iproc_i2c_rd_reg(iproc_i2c, - M_CMD_OFFSET) & BIT(M_CMD_START_BUSY_SHIFT))) { + if (iproc_i2c_rd_reg(iproc_i2c, + M_CMD_OFFSET) & BIT(M_CMD_START_BUSY_SHIFT)) { dev_warn(iproc_i2c->device, "bus is busy\n"); return -EBUSY; }