From patchwork Fri Jul 5 15:12:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Sa via B4 Relay X-Patchwork-Id: 810727 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 B461514A60C for ; Fri, 5 Jul 2024 15:12:47 +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=1720192367; cv=none; b=GOH8ml8ibUX1IctG/WKLwJOez2n2kZ67JUN6We74rXFvGEeIK9nYe5DkesQfTl/EQff608KxhYkks/7AZclvS1GWxThu8oNkgJ4W7P7KLq8SFPr7J3yjNLPvx8nQ/Y5oaKJCOeTbdaALUXPw/VH7SCx3dW7BGnzgxz/R5t4t73s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720192367; c=relaxed/simple; bh=LneVjNk5SRaJD6DqqwfYMbObYiZgeBxFsU4svVfyNrw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PEE0TVDq0SgLtYIbYsjk0nZR6OnJVcOQKRWn1jzjCmA4YuWHKYH4RohkMj8Y3uKBrSkbzmH25GfLXthVXmlluSv6CBuY2ugImd0VZ42g/Wz89riplWiqi2Almhbe4WUdHe2E4OcLsr21FXnjegy7Ztv+RddYZ1r8WEaLfGu7hj0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pXt7EOjI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pXt7EOjI" Received: by smtp.kernel.org (Postfix) with ESMTPS id 51120C4AF0B; Fri, 5 Jul 2024 15:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720192367; bh=LneVjNk5SRaJD6DqqwfYMbObYiZgeBxFsU4svVfyNrw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=pXt7EOjIvOCgl4v8erQ40Xa1y5hLr1mq06nKnQCU9AWPgmi5Q7Xpb8sEO3D4ld50K 69rti7Km7V9MJxVLRFhI66loAMpUblW37wy/V6fX6Q6xqYQ8Goh+tOg5l9GHX6ql42 ugeN6fmHLAMVXEGHcCmufLJCH3UIaTHzOUjd5hF++8UHmXu5pPp0AzwL9za4vdan4N RPMujORymekQX+SiIXxjK/uyrBbBRRgw0Ntzv8O7VNDJPWLIp2emByyxAoYelmz+/h 5YhT3MEehmauzZV/bYGOK8An6tj6nnFXniogJtVJOvImrpSTnQZN/NYamMLs5t3iag gZowLfqrfIxQw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F5F2C38150; Fri, 5 Jul 2024 15:12:47 +0000 (UTC) From: Nuno Sa via B4 Relay Date: Fri, 05 Jul 2024 17:12:39 +0200 Subject: [PATCH v2 1/4] spi: xcomm: add gpiochip support Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240705-dev-spi-xcomm-gpiochip-v2-1-b10842fc9636@analog.com> References: <20240705-dev-spi-xcomm-gpiochip-v2-0-b10842fc9636@analog.com> In-Reply-To: <20240705-dev-spi-xcomm-gpiochip-v2-0-b10842fc9636@analog.com> To: linux-spi@vger.kernel.org Cc: Mark Brown , Michael Hennerich , Michael Hennerich X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720192365; l=2456; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=sm/LUmqNmbQc+0zUV9BX4JH9pxe+vkMJ6Q/b4sAIHW4=; b=yLlJuu0yEz4OPzzx702Hne37YH8dzQSY5dtmF9bSEbVvw5OGG1j9V91OeZqVZ4skEp+vGmCdE xKZBJ34ZlbQB0S1+sxHoRrDl2hlV+CGRZAc20vqz2ZKWaqG8oK/Kd0A X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-Endpoint-Received: by B4 Relay for nuno.sa@analog.com/20231116 with auth_id=100 X-Original-From: Nuno Sa Reply-To: nuno.sa@analog.com From: Michael Hennerich The hardware can expose one pin as a GPO. Hence, register a simple gpiochip to support it. Signed-off-by: Michael Hennerich Co-developed-by: Nuno Sa Signed-off-by: Nuno Sa --- drivers/spi/spi-xcomm.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-xcomm.c b/drivers/spi/spi-xcomm.c index 63354dd3110fc..063ce75af6504 100644 --- a/drivers/spi/spi-xcomm.c +++ b/drivers/spi/spi-xcomm.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -26,12 +27,15 @@ #define SPI_XCOMM_CMD_UPDATE_CONFIG 0x03 #define SPI_XCOMM_CMD_WRITE 0x04 +#define SPI_XCOMM_CMD_GPIO_SET 0x05 #define SPI_XCOMM_CLOCK 48000000 struct spi_xcomm { struct i2c_client *i2c; + struct gpio_chip gc; + uint16_t settings; uint16_t chipselect; @@ -40,6 +44,42 @@ struct spi_xcomm { uint8_t buf[63]; }; +static void spi_xcomm_gpio_set_value(struct gpio_chip *chip, + unsigned int offset, int val) +{ + struct spi_xcomm *spi_xcomm = gpiochip_get_data(chip); + unsigned char buf[2]; + + buf[0] = SPI_XCOMM_CMD_GPIO_SET; + buf[1] = !!val; + + i2c_master_send(spi_xcomm->i2c, buf, 2); +} + +static int spi_xcomm_gpio_get_direction(struct gpio_chip *chip, + unsigned int offset) +{ + return GPIO_LINE_DIRECTION_OUT; +} + +static int spi_xcomm_gpio_add(struct spi_xcomm *spi_xcomm) +{ + struct device *dev = &spi_xcomm->i2c->dev; + + if (!IS_ENABLED(CONFIG_GPIOLIB)) + return 0; + + spi_xcomm->gc.get_direction = spi_xcomm_gpio_get_direction; + spi_xcomm->gc.set = spi_xcomm_gpio_set_value; + spi_xcomm->gc.can_sleep = 1; + spi_xcomm->gc.base = -1; + spi_xcomm->gc.ngpio = 1; + spi_xcomm->gc.label = spi_xcomm->i2c->name; + spi_xcomm->gc.owner = THIS_MODULE; + + return devm_gpiochip_add_data(dev, &spi_xcomm->gc, spi_xcomm); +} + static int spi_xcomm_sync_config(struct spi_xcomm *spi_xcomm, unsigned int len) { uint16_t settings; @@ -227,7 +267,7 @@ static int spi_xcomm_probe(struct i2c_client *i2c) if (ret < 0) spi_controller_put(host); - return ret; + return spi_xcomm_gpio_add(spi_xcomm); } static const struct i2c_device_id spi_xcomm_ids[] = { From patchwork Fri Jul 5 15:12:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Sa via B4 Relay X-Patchwork-Id: 810728 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 A5CDF14AA0 for ; Fri, 5 Jul 2024 15:12:47 +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=1720192367; cv=none; b=AqosK6ThfnFqKPQMmF6kMfX2vZdFA5c4ESqDX83XMJptATpD4U/AFvU70ivgcb+imYx3qjQkIzaXmut8CGEpm1NgEabkCBvFud8lZQFhu9IKzk9C10pfCHAv6hzHmJOnrdftTodcu41LiSgP3WY5WrYLhIZLp46P6kmBHLuaWEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720192367; c=relaxed/simple; bh=g1wnaCmQJ9WppmXLzG0kuZWH8VubWR52LTeX7Hn8mUo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TyoGTKzSA6wEFrStOnt2YBhKkRIcLaFUBpsHDjwbP8y7zaPh3v9im3HEvqDvem2kV3TlIrPxacLrSjGtRSm1CUwKx10ohZ8hOrY9T9MmY271gYyxx11ugcDyHbVHoLgg2BBdHSd3OdNThtjXr3PTk/d+DUQuiAjBbymwfSlfi/A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lTMv1u17; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lTMv1u17" Received: by smtp.kernel.org (Postfix) with ESMTPS id 5867FC32786; Fri, 5 Jul 2024 15:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720192367; bh=g1wnaCmQJ9WppmXLzG0kuZWH8VubWR52LTeX7Hn8mUo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=lTMv1u17OJl7NUMivuJaOfP4bbYwC2/yP/vGzNb8c9wlYHn+s6uLNEMPCpQ0qf5bW arqx1Io1LUqX5ueC4SmCrmdpH0am0dMWCj5v4Xk0w6AT3WGfeazjXZjlvBspEtZ1E3 V9RJ938nJchGGkrbJWi8Jh+75fWBrd2EpQ/3JW4+5zvhieYGjcWzyIT1WkHCVCmyP4 UzZPTNfv0+oi+W9Q2V0j28IrA1rcyyCotzROsa9KNnjNvMc2QF7HRplvFV5RWjH7n/ LhNgKS7pYJcePDoBLIcuRf1DGOg/TP+LJBRXmcLtRQPHikkvqa8CDQJ+/UtoZ8275Y TBXWHfTajyU9w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50A4BC3DA42; Fri, 5 Jul 2024 15:12:47 +0000 (UTC) From: Nuno Sa via B4 Relay Date: Fri, 05 Jul 2024 17:12:40 +0200 Subject: [PATCH v2 2/4] spi: xcomm: make use of devm_spi_alloc_host() Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240705-dev-spi-xcomm-gpiochip-v2-2-b10842fc9636@analog.com> References: <20240705-dev-spi-xcomm-gpiochip-v2-0-b10842fc9636@analog.com> In-Reply-To: <20240705-dev-spi-xcomm-gpiochip-v2-0-b10842fc9636@analog.com> To: linux-spi@vger.kernel.org Cc: Mark Brown , Michael Hennerich X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720192365; l=939; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=6RJlZH90JdCncjV5ZiRfVjQGYop1z1hLo21odk1aD/A=; b=osI/6myKylZYPHyEDCSsLzHduRcTVpyNgmM7465zYO3+Y133WVjNY+80HwVBPeg0SS1mjrklF HlvMmRz5AwgAVgF7AJbC5wDRn/E58tto5qrxxHzvAHSvsSIXAKnlTF+ X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-Endpoint-Received: by B4 Relay for nuno.sa@analog.com/20231116 with auth_id=100 X-Original-From: Nuno Sa Reply-To: nuno.sa@analog.com From: Nuno Sa Use devm_spi_alloc_host() so that there's no need to call spi_controller_put() in the error path. Signed-off-by: Nuno Sa --- drivers/spi/spi-xcomm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-xcomm.c b/drivers/spi/spi-xcomm.c index 063ce75af6504..5bbc250bc0534 100644 --- a/drivers/spi/spi-xcomm.c +++ b/drivers/spi/spi-xcomm.c @@ -248,7 +248,7 @@ static int spi_xcomm_probe(struct i2c_client *i2c) struct spi_controller *host; int ret; - host = spi_alloc_host(&i2c->dev, sizeof(*spi_xcomm)); + host = devm_spi_alloc_host(&i2c->dev, sizeof(*spi_xcomm)); if (!host) return -ENOMEM; @@ -265,7 +265,7 @@ static int spi_xcomm_probe(struct i2c_client *i2c) ret = devm_spi_register_controller(&i2c->dev, host); if (ret < 0) - spi_controller_put(host); + return ret; return spi_xcomm_gpio_add(spi_xcomm); } From patchwork Fri Jul 5 15:12:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Sa via B4 Relay X-Patchwork-Id: 812282 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 B6D7814B940 for ; Fri, 5 Jul 2024 15:12:47 +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=1720192367; cv=none; b=d+jTgMRj0sG8gXL7RoDs7hIKid0fs43AbAefNdk1rSBylCTEswJ2G7R+9L7uqaCHlE2xbtdcGt7dbjX8su7mWUWLVrxyCrHSHWxuRRP9ADcrMTU1Wq//h4Xj5JhJgf59OdFdyWDuI2vWQvEi372Ls1c/hJRnu+o94yU9Tk5gpis= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720192367; c=relaxed/simple; bh=C3gl2WK1TSzPznrbxiUyJW32vxXqr2qmTN7ggL3NAMk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FRohgh+eVn6yg0sshmXqOeiET+CX/biKe3v+EZIkD8hzRK7TRnYYyJEt6mbkcJE3rpOwhULqNmXc7yPfYfaokQacuMOzwT2BjRnkTHmbyIdzzawI8II4DThZhELpqL6Eut6ki2qjBU03THBP1fSQqz3Xkk2wBQqxJrgiv8TyLR8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jvAHnB89; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jvAHnB89" Received: by smtp.kernel.org (Postfix) with ESMTPS id 682B4C4AF0D; Fri, 5 Jul 2024 15:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720192367; bh=C3gl2WK1TSzPznrbxiUyJW32vxXqr2qmTN7ggL3NAMk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=jvAHnB8907qhKbumFuX8vqMdPGIw+s85MFkGq9RXC9J6uhHhsWEp1vh7r5heH1FqO 6WVz1tGlTtReoWZ4lZBUNXV2TfjECsV43r4XTiABvRvMlG4UW6gJpvoQWfsgyvCsbh Kci6uBOWkcVxeiHrdXWKxES394JE8A5kRhlgr++gPg7wBjzTH0Nm3cio/c97m8BN4v o4S1g+RO4h3BBL3+2loPAKdBE0VmBIq+RcidnGyahrwaM8fSzB/dGaazu3d3Wpos3R qEFdW1jOYmcEjCMT6fFbpk2+afiUiHhuuc3lvytEC/bGbg6yczRt7ecR01KdhfXspx pqhKStHrmkMbg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FC57C3DA41; Fri, 5 Jul 2024 15:12:47 +0000 (UTC) From: Nuno Sa via B4 Relay Date: Fri, 05 Jul 2024 17:12:41 +0200 Subject: [PATCH v2 3/4] spi: xcomm: remove i2c_set_clientdata() Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240705-dev-spi-xcomm-gpiochip-v2-3-b10842fc9636@analog.com> References: <20240705-dev-spi-xcomm-gpiochip-v2-0-b10842fc9636@analog.com> In-Reply-To: <20240705-dev-spi-xcomm-gpiochip-v2-0-b10842fc9636@analog.com> To: linux-spi@vger.kernel.org Cc: Mark Brown , Michael Hennerich X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720192365; l=719; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=vUGNltR14uZYr+gI6pbeIx/V4FQQvYngKNBjnal7db4=; b=QMnksO+NgeIlZJm4SjtLwHEjjIEKU9b6RYKXNQWG4OT8MIuBJoNxjOn5FsytaqiixcZY2fZlu 7kTL7hgbCu/ArFHSp1ZDTkfb8G6ahS5wJmO6EsofmNGw1rR9PhTHTtI X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-Endpoint-Received: by B4 Relay for nuno.sa@analog.com/20231116 with auth_id=100 X-Original-From: Nuno Sa Reply-To: nuno.sa@analog.com From: Nuno Sa i2c_get_clientdata() is not being called anywhere so that we do not need to set clientdata. Signed-off-by: Nuno Sa --- drivers/spi/spi-xcomm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/spi/spi-xcomm.c b/drivers/spi/spi-xcomm.c index 5bbc250bc0534..1cd7d2b9e11c9 100644 --- a/drivers/spi/spi-xcomm.c +++ b/drivers/spi/spi-xcomm.c @@ -261,7 +261,6 @@ static int spi_xcomm_probe(struct i2c_client *i2c) host->flags = SPI_CONTROLLER_HALF_DUPLEX; host->transfer_one_message = spi_xcomm_transfer_one; host->dev.of_node = i2c->dev.of_node; - i2c_set_clientdata(i2c, host); ret = devm_spi_register_controller(&i2c->dev, host); if (ret < 0) From patchwork Fri Jul 5 15:12:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Sa via B4 Relay X-Patchwork-Id: 810726 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 B466214AD30 for ; Fri, 5 Jul 2024 15:12:47 +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=1720192367; cv=none; b=nKHZdkGSsyHERvDbGY7HPR5VJp68m+mEZObbrFL89gLseUX+zKc8DRpLYKlMMIgsXv1HG4NIgYhu4mCBDMb/RNqDGKmDpSboOLFvCdP+L81N5dG+Mog93x5Er3o22zAOv5Pfo8A1UX/Wxjdjy1mdJRtZIqO/w4tCvPCetKfEhUQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720192367; c=relaxed/simple; bh=LN04TIx4OcKchoiNPQVevQlcGCapW/1hpCrOKwQbg6I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=reCKzfU2ZjPg2KxGakemxFe27K71YoZmtVMkYtAQwEpTems1qCaLXX2S8IhLpEQ71GBGZJJl//542wWZJlflsxD9260nH7Ki84jBsHXWo4OD/18QK/km1LH6g+82IwaPGQXNKcPtrrpj5WZpMYM4gTQ/d9VA/mlimx0CL7jYYnI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jASDwhGf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jASDwhGf" Received: by smtp.kernel.org (Postfix) with ESMTPS id 77145C4AF11; Fri, 5 Jul 2024 15:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720192367; bh=LN04TIx4OcKchoiNPQVevQlcGCapW/1hpCrOKwQbg6I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=jASDwhGfh1Jetf39EPdiA259WmTWiq+bHRzahPCFGHL2Lvj05YC3GTGKYj4P32hyN 8sJxF6o0dbBFe5qWYJXoXD78ZMphJfHvCxokTlVcK0qZlDiCJfuT+8+Oes9gCtAWLm B26fOcNPKacuHtjFvu5hslDM+laxGyPdv/BKPneafPJ/Ut+LbXl4JOoBLDBGbveqeJ VntTIq1AA0Fk7HM5reY2sB1RQ+pymFOr+X6G/nCj3lDf1F8m/I0qHjsiEGUgAF3Nxn Pakczcj16OJjFRBwZGmqD1UN+mRQDPd7h6mr3r+JpF9XwgB8x3pJgiVkScRxvOTCxg N/1yoobg0oieQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BDCEC3DA43; Fri, 5 Jul 2024 15:12:47 +0000 (UTC) From: Nuno Sa via B4 Relay Date: Fri, 05 Jul 2024 17:12:42 +0200 Subject: [PATCH v2 4/4] spi: xcomm: fix coding style Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240705-dev-spi-xcomm-gpiochip-v2-4-b10842fc9636@analog.com> References: <20240705-dev-spi-xcomm-gpiochip-v2-0-b10842fc9636@analog.com> In-Reply-To: <20240705-dev-spi-xcomm-gpiochip-v2-0-b10842fc9636@analog.com> To: linux-spi@vger.kernel.org Cc: Mark Brown , Michael Hennerich X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720192365; l=3472; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=ZgTAmJ7IiP/e7QA90qtxl89+pg3ESD6JiaVtHgJhCxY=; b=mmZyYgI6j028rWMPshdA/87V+jdmdoK9pGog9cUMJ7+yuiqzeYPF+aYCnH5vUqMFXU18G+fH+ s19DqRRY0WXCByCDIqcx/BLBGRy01ORQGEt0MX89FwThPTXolUeQKsJ X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-Endpoint-Received: by B4 Relay for nuno.sa@analog.com/20231116 with auth_id=100 X-Original-From: Nuno Sa Reply-To: nuno.sa@analog.com From: Nuno Sa Just cosmetics. No functional change intended. While at it, removed a couple of redundant else if() statements. Signed-off-by: Nuno Sa --- drivers/spi/spi-xcomm.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/spi/spi-xcomm.c b/drivers/spi/spi-xcomm.c index 1cd7d2b9e11c9..846f00e23b717 100644 --- a/drivers/spi/spi-xcomm.c +++ b/drivers/spi/spi-xcomm.c @@ -36,12 +36,12 @@ struct spi_xcomm { struct gpio_chip gc; - uint16_t settings; - uint16_t chipselect; + u16 settings; + u16 chipselect; unsigned int current_speed; - uint8_t buf[63]; + u8 buf[63]; }; static void spi_xcomm_gpio_set_value(struct gpio_chip *chip, @@ -82,8 +82,8 @@ static int spi_xcomm_gpio_add(struct spi_xcomm *spi_xcomm) static int spi_xcomm_sync_config(struct spi_xcomm *spi_xcomm, unsigned int len) { - uint16_t settings; - uint8_t *buf = spi_xcomm->buf; + u16 settings; + u8 *buf = spi_xcomm->buf; settings = spi_xcomm->settings; settings |= len << SPI_XCOMM_SETTINGS_LEN_OFFSET; @@ -96,10 +96,10 @@ static int spi_xcomm_sync_config(struct spi_xcomm *spi_xcomm, unsigned int len) } static void spi_xcomm_chipselect(struct spi_xcomm *spi_xcomm, - struct spi_device *spi, int is_active) + struct spi_device *spi, int is_active) { unsigned long cs = spi_get_chipselect(spi, 0); - uint16_t chipselect = spi_xcomm->chipselect; + u16 chipselect = spi_xcomm->chipselect; if (is_active) chipselect |= BIT(cs); @@ -110,7 +110,8 @@ static void spi_xcomm_chipselect(struct spi_xcomm *spi_xcomm, } static int spi_xcomm_setup_transfer(struct spi_xcomm *spi_xcomm, - struct spi_device *spi, struct spi_transfer *t, unsigned int *settings) + struct spi_device *spi, struct spi_transfer *t, + unsigned int *settings) { if (t->len > 62) return -EINVAL; @@ -148,7 +149,7 @@ static int spi_xcomm_setup_transfer(struct spi_xcomm *spi_xcomm, } static int spi_xcomm_txrx_bufs(struct spi_xcomm *spi_xcomm, - struct spi_device *spi, struct spi_transfer *t) + struct spi_device *spi, struct spi_transfer *t) { int ret; @@ -159,13 +160,13 @@ static int spi_xcomm_txrx_bufs(struct spi_xcomm *spi_xcomm, ret = i2c_master_send(spi_xcomm->i2c, spi_xcomm->buf, t->len + 1); if (ret < 0) return ret; - else if (ret != t->len + 1) + if (ret != t->len + 1) return -EIO; } else if (t->rx_buf) { ret = i2c_master_recv(spi_xcomm->i2c, t->rx_buf, t->len); if (ret < 0) return ret; - else if (ret != t->len) + if (ret != t->len) return -EIO; } @@ -173,12 +174,12 @@ static int spi_xcomm_txrx_bufs(struct spi_xcomm *spi_xcomm, } static int spi_xcomm_transfer_one(struct spi_controller *host, - struct spi_message *msg) + struct spi_message *msg) { struct spi_xcomm *spi_xcomm = spi_controller_get_devdata(host); unsigned int settings = spi_xcomm->settings; struct spi_device *spi = msg->spi; - unsigned cs_change = 0; + unsigned int cs_change = 0; struct spi_transfer *t; bool is_first = true; int status = 0; @@ -187,7 +188,6 @@ static int spi_xcomm_transfer_one(struct spi_controller *host, spi_xcomm_chipselect(spi_xcomm, spi, true); list_for_each_entry(t, &msg->transfers, transfer_list) { - if (!t->tx_buf && !t->rx_buf && t->len) { status = -EINVAL; break;