From patchwork Mon Jun 24 20:10:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 807205 Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) (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 015FD1A01DD for ; Mon, 24 Jun 2024 20:10:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719259850; cv=none; b=iH3n6ywXtI1Wur/uB/2JZu0aywLTpfdBTdIPdXys+GYTsqnQD6JXmTUHA4AWBjyBSV2etOV27fp4FJTGXo2j+KRC+7f+7SKKTuvP3ue+Penw916DFGsxYJgtIA1dKWJ/VcB3K7rG5SFm5UnmDi1fWQfEyRLGNkwos6OuCGmijYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719259850; c=relaxed/simple; bh=gwveKsBVtN7JFtmU94y848i/o5pT/Jhq2LKbTqkccp4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ODA/cNaNzYG5Eg7XmEStQHzXRnx0X+JgQ1R2JWUMCCmf8tBSeDwJR8v+C1yqJhNvL8sLATOhCR2NPXdV1InFM9QrE1AzeFX8+ifou+K3M91F3EF3kKB4AADWabCqsmW9mljztisAOe46C2vuPBkneL2t09KSKB3MSxAxbb6V20s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=fkzpX3pd; arc=none smtp.client-ip=209.85.160.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="fkzpX3pd" Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-25cba5eea69so2301980fac.2 for ; Mon, 24 Jun 2024 13:10:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1719259848; x=1719864648; 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=pynIwSYLtFCFqE/LQh0xYvfYgPBDJkazLg5naxF4gSA=; b=fkzpX3pdQsNMGXaaXbgrCM8rgVlEgWID9r2Jw7nTTqnKu3J4VtKfnXp+CRGTMijmvN xt+KtfzfapDKixaeOzyaZBxbPARuoxrdtVpjPkj2ED1I6U5iaaoWF6LlFP06XotfCEhp b26CvwuJ9XHtbBQMlAAKK3PtQbdg4/wt+ZTOr0m5wN6eP7jM8uBEsZ7bB6pV7A8qptCc d/5U5wTN9GRifeOzHQOnk5a3d3r+4WrwT1PyKHZFG95l27UbXhHqsfctbWTrz4g7beCR PYJt8w0Fn2WxUeLQ0bhYyZRK3WZB+21FxMAGTUzS6DLT7eKDo3sx4iuLVAU5CEmhNdSq FbzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719259848; x=1719864648; 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=pynIwSYLtFCFqE/LQh0xYvfYgPBDJkazLg5naxF4gSA=; b=WaPMjxFJnlMWKeb53jhsHmM3i3KNk6bsUyz7+9rNWBIG/p5are1WGRLHH036iVSP7w claxr8yOsBtPw5EIstX7pkYgtNeRlRXNORhz4fcQSPOxF/oVTMNtf/ryNrAYD0sJthZM U2tTsyVi6w504J+gPUh8kZXeCL9q2G3caJLvQAts03eK5McsZFGNu1Uvm0Ymr0pjkd3f lcFK64kFzBzRoF4viEQFvfexLPNHbwbonl6Sp/jX7hpaEuL8AU7GL0hbDxRDa5/hy0K4 fN331c4FXSVLnULi17b4FqUC525iPEsjxXprBuomi2o/DkKUqRCytJpAGwdLw2XnXUdY 5raw== X-Forwarded-Encrypted: i=1; AJvYcCWsuvzhXAWBvEBMq2zEhomGpCJJsDwaiO1nPwNa3JF4DRVcTHhFNibc3nHBszAyjOIJORDRvNRvqMs60+0DoF0Hod5V0NiMfTnU X-Gm-Message-State: AOJu0YzmGnz0iCm8AahP3UJ1z8e4krA+YrwQZdWoZgY41QD0H2wZEYtZ yqL2zr2ex7w36PyfVBT0aMvCDSNw+XdovdqtKWs03VrdWsFi6L/M/vK3sHDAKp4= X-Google-Smtp-Source: AGHT+IHRPUfp+ZBPyKVGnp8PYVSyxPlPBcZpQHC+Oj3KSMk2tSXxZxcaP2yg1g1kDGwwn06PCl+SEA== X-Received: by 2002:a05:6870:40c8:b0:250:7a8d:1756 with SMTP id 586e51a60fabf-25d0163e8d0mr6380388fac.12.1719259848112; Mon, 24 Jun 2024 13:10:48 -0700 (PDT) Received: from freyr.lechnology.com (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25cd498872csm2056581fac.21.2024.06.24.13.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 13:10:47 -0700 (PDT) From: David Lechner To: Mark Brown , Jonathan Cameron Cc: David Lechner , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , Marcelo Schmitt , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-iio@vger.kernel.org Subject: [PATCH v2 1/2] spi: add EXPORT_SYMBOL_GPL(devm_spi_optimize_message) Date: Mon, 24 Jun 2024 15:10:30 -0500 Message-ID: <20240624-devm_spi_optimize_message-v2-1-58155c0180c2@baylibre.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240624-devm_spi_optimize_message-v2-0-58155c0180c2@baylibre.com> References: <20240624-devm_spi_optimize_message-v2-0-58155c0180c2@baylibre.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.4 devm_spi_optimize_message() is a public function and needs EXPORT_SYMBOL_GPL. Reported-by: Jonathan Cameron Closes: https://lore.kernel.org/linux-iio/20240624204424.6a91a5e4@jic23-huawei/ Fixes: 17436001a6bc ("spi: add devm_spi_optimize_message() helper") Signed-off-by: David Lechner --- drivers/spi/spi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 3f953504244b..814d66fc9753 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -4384,6 +4384,7 @@ int devm_spi_optimize_message(struct device *dev, struct spi_device *spi, return devm_add_action_or_reset(dev, devm_spi_unoptimize_message, msg); } +EXPORT_SYMBOL_GPL(devm_spi_optimize_message); /** * spi_async - asynchronous SPI transfer From patchwork Mon Jun 24 20:10:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 807204 Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (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 D8C3C1A0702 for ; Mon, 24 Jun 2024 20:10:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719259851; cv=none; b=R3IFQub4H2B40UQg/FOrAwZH1nHwUn+tXZjSuZzTR/e8dnjGTW+vS1Nt7A1fG02ZyK/JAdch597auwUAzh7oSw+NX8oGJa6jBvcnY760WlrAmU5qkh2G5f1GHm3/1QR62p/9zBrL+vfQOcpZMKS21/CsOD/XiF9jYShOURHH/+o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719259851; c=relaxed/simple; bh=M5ncsogjwIKi7yTwd3on+qTwjMFKb9OhWUuYpkcn5s4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=krOgZ+MbnrxdmsqCIx7/1VJE9ckUmRMhj43y0qMq0Q5z9ucf6HqFRRAPjcicgRNgWxzOj8wriLtc+49coKTRVLlTGNlQYjAmyVyixk7fpXHwSKWWoWsi55LRqrUaF3nBqDmUNfl8sbdF1pt1tEdLAZhaLUmnXeOm+1+lFWC7dJA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=bUBXqmYl; arc=none smtp.client-ip=209.85.210.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="bUBXqmYl" Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-6f98178ceb3so2738156a34.0 for ; Mon, 24 Jun 2024 13:10:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1719259849; x=1719864649; 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=keq6dAlPadRHMn2hspGHDGXT5Yre2UihnSFV/6UPPyU=; b=bUBXqmYljuFxuT7DhU7xSY/xdwdacs+L9ZrPEUQoUNU6BJ+pLZZCqHGbrv7hLuiGrk q0++qLkOYpikCaijp3/L3I8anJkYqXhGexkOAD1EtjaPNbC+mjISD/CLL6SkmE38VHg2 gzBrOZwnWzLKcXuqP8LKGzNGfM0sOBe10KFEdRKV7bHafwoUPCwwmg/uk6WYY1YjXW9x kO+EVaH5l2HV3WLqgfe9nzfQSx5Auwc9kxZ5hgvh94fhyR8RzMEZOuwjxxEYA7u04mHY jirY+th5GhMCFGeMnQzZ6DaMxWxIUDZbmtz+w6N3tmCx2okvhBrTUKlXaK/R6wJUIp7J V8Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719259849; x=1719864649; 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=keq6dAlPadRHMn2hspGHDGXT5Yre2UihnSFV/6UPPyU=; b=Lb/G5GNUnjxt41Kph2ANjJhTn0lC5tI0oOfie8y9AEfE5b7KDWfh5Z49fQ1B7/vF55 Oy5JcCuuOS+3DceYXOkzOXdbhY5TiCa8/i32lUmvc7EyLKMeaaPKuiSnJ3DQR4NkQVUz bF7PfC5x6WfIwqbUshY4vaUO3RXLFKeinskYkGDwt7NqM7ffXxSrWokdBc1VMvGlDPXo Pg4659aGvPWrbNgOmFTA9t6GxHVHMCUmWXppeJMhoc0Y7KNNW7w3YOtFyzILD3Hwh7f0 mcyaUbDgs2TVBM+dW4Uha4U/rQ0ZNGQgQ9seFOiarcVSet3T7j/QsO523tdHbqFtvhv5 HEHg== X-Forwarded-Encrypted: i=1; AJvYcCXBP7DRYnh+D2qfcHsRWCwY6wjZOamVDvZvoPzW4q45JGXg1lEJ688OFIyZWnXNNyecIPwP3jq7SLC+K9BtkUac2gFjqHQOCVSE X-Gm-Message-State: AOJu0YwCOm/WS3P/PEcgTTFknT5I2EANZynB0bYY8uzM9tPF48O7NSn0 x1GYGIg6lGEsdQzYLkq+pFVaVXYYgpuJieLg1Z699/OEPdh0PVbdSMOjBfkbe48= X-Google-Smtp-Source: AGHT+IEPj9eNpk6KMJ4QV06JOfE04WXPuqL0pHd7jyIaZHBJE1mlZj/2+mYQhvjgxxXtWG6s8pSSQA== X-Received: by 2002:a05:6870:e9a6:b0:258:42c8:7f69 with SMTP id 586e51a60fabf-25d06bf1b66mr5594096fac.23.1719259848943; Mon, 24 Jun 2024 13:10:48 -0700 (PDT) Received: from freyr.lechnology.com (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25cd498872csm2056581fac.21.2024.06.24.13.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 13:10:48 -0700 (PDT) From: David Lechner To: Mark Brown , Jonathan Cameron Cc: David Lechner , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , Marcelo Schmitt , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-iio@vger.kernel.org Subject: [PATCH v2 2/2] iio: adc: ad7944: use devm_spi_optimize_message() Date: Mon, 24 Jun 2024 15:10:31 -0500 Message-ID: <20240624-devm_spi_optimize_message-v2-2-58155c0180c2@baylibre.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240624-devm_spi_optimize_message-v2-0-58155c0180c2@baylibre.com> References: <20240624-devm_spi_optimize_message-v2-0-58155c0180c2@baylibre.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.4 Use new devm_spi_optimize_message() helper to simplify repeated code in the ad7944 driver. Signed-off-by: David Lechner --- drivers/iio/adc/ad7944.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/drivers/iio/adc/ad7944.c b/drivers/iio/adc/ad7944.c index 4602ab5ed2a6..a6ac17c13a29 100644 --- a/drivers/iio/adc/ad7944.c +++ b/drivers/iio/adc/ad7944.c @@ -134,18 +134,12 @@ AD7944_DEFINE_CHIP_INFO(ad7985, ad7944, 16, 0); /* fully differential */ AD7944_DEFINE_CHIP_INFO(ad7986, ad7986, 18, 1); -static void ad7944_unoptimize_msg(void *msg) -{ - spi_unoptimize_message(msg); -} - static int ad7944_3wire_cs_mode_init_msg(struct device *dev, struct ad7944_adc *adc, const struct iio_chan_spec *chan) { unsigned int t_conv_ns = adc->always_turbo ? adc->timing_spec->turbo_conv_ns : adc->timing_spec->conv_ns; struct spi_transfer *xfers = adc->xfers; - int ret; /* * NB: can get better performance from some SPI controllers if we use @@ -175,11 +169,7 @@ static int ad7944_3wire_cs_mode_init_msg(struct device *dev, struct ad7944_adc * spi_message_init_with_transfers(&adc->msg, xfers, 3); - ret = spi_optimize_message(adc->spi, &adc->msg); - if (ret) - return ret; - - return devm_add_action_or_reset(dev, ad7944_unoptimize_msg, &adc->msg); + return devm_spi_optimize_message(dev, adc->spi, &adc->msg); } static int ad7944_4wire_mode_init_msg(struct device *dev, struct ad7944_adc *adc, @@ -188,7 +178,6 @@ static int ad7944_4wire_mode_init_msg(struct device *dev, struct ad7944_adc *adc unsigned int t_conv_ns = adc->always_turbo ? adc->timing_spec->turbo_conv_ns : adc->timing_spec->conv_ns; struct spi_transfer *xfers = adc->xfers; - int ret; /* * NB: can get better performance from some SPI controllers if we use @@ -209,11 +198,7 @@ static int ad7944_4wire_mode_init_msg(struct device *dev, struct ad7944_adc *adc spi_message_init_with_transfers(&adc->msg, xfers, 2); - ret = spi_optimize_message(adc->spi, &adc->msg); - if (ret) - return ret; - - return devm_add_action_or_reset(dev, ad7944_unoptimize_msg, &adc->msg); + return devm_spi_optimize_message(dev, adc->spi, &adc->msg); } static int ad7944_chain_mode_init_msg(struct device *dev, struct ad7944_adc *adc, @@ -221,7 +206,6 @@ static int ad7944_chain_mode_init_msg(struct device *dev, struct ad7944_adc *adc u32 n_chain_dev) { struct spi_transfer *xfers = adc->xfers; - int ret; /* * NB: SCLK has to be low before we toggle CS to avoid triggering the @@ -249,11 +233,7 @@ static int ad7944_chain_mode_init_msg(struct device *dev, struct ad7944_adc *adc spi_message_init_with_transfers(&adc->msg, xfers, 2); - ret = spi_optimize_message(adc->spi, &adc->msg); - if (ret) - return ret; - - return devm_add_action_or_reset(dev, ad7944_unoptimize_msg, &adc->msg); + return devm_spi_optimize_message(dev, adc->spi, &adc->msg); } /**