From patchwork Mon Jun 24 20:46:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13710064 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.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 8817449643 for ; Mon, 24 Jun 2024 20:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719261996; cv=none; b=Yxwncz8tNK43f/5gr8OYo6KcPJTtvaS0o2DUxdHE+HgQsz5HX0KfsWD7/MOzoLTilxqic87Gi0kKAOki/1pmpKGgCReVL02Gjv1CiY6Sz9B4VB77z9tKPdw39927644BnijGjPKPS8Pqs7qtw+8sX0xx28JLrKU0r2RElzRRnWc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719261996; c=relaxed/simple; bh=upztjv25Pksc3Dz/iEL/7RhD28y3vLRW3nFh17Sqo3c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MqG9fBaa4uI6+c+dNN1nEUKbw4E3MmZdbZIoRlGoPkS/fKLBNUj9aJ3CqxMnxCUWuruiMM7YSMyJ0Vwa95ZN1qiwg5j6ZV5atAEITeLXpEgJ4vK/cX+bUkJ/aMDRNyeIGAnwLt/+SGZNez1pASWtz0/i/usF+0ZdTJ1scVxLIBo= 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=n6qn97SK; arc=none smtp.client-ip=209.85.210.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="n6qn97SK" Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-6fa0d077694so2269816a34.0 for ; Mon, 24 Jun 2024 13:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1719261993; x=1719866793; 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=GSBK3Ki9ZCk+SLUNlkl3PuQfRvemuJmKwUzbo0kI5l0=; b=n6qn97SKTihk2e7+h5ujpxfMJqsR5ZZVt04xjmnotua/Bn1POAKVOqw2dhQxeXMAfI xEDo1ZAt5DKD3VUIKfrfO1FWDEqSHfwRNmc8xSy6W8ZwE0BClqJMYTg+HKrDO2KQiyCR jbkM9CvxDC0GvMX7AGuCQvrR9XBmt8kkUfUtLxI7OA0DRWSaWen45gQTe7dJmV8U6RLe 2VoQP5A/j3kb8I4N7WlHinuWzTvPaTLUt1Eu07UBgj2+PamCbFU/TwPDHvkyc4IIbTCJ SPpqQWL3jSt4VBPS+wLDTvrB8dqvv0bXZp7Lh11pzXx084jb8z/EdWzkRP8HVrdJ9TVK T4SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719261993; x=1719866793; 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=GSBK3Ki9ZCk+SLUNlkl3PuQfRvemuJmKwUzbo0kI5l0=; b=h8rPRX7Ayy8V9gxgCuPtF0tjHlAsX/e/4M6EMB7xstYEXQn9kWqG+5g+inuwDqROKr /IjB1fsF70kN8sDDFLZXiZp/YPhRimSlWQ6uZaKQtzuCXmKnBaQH1WYYmAJJECs1i9ih WU4NmUrtf76HmoO5HM6kCqfL0LkiPcEohaPeSG5ptVpYvUSxoxYWo/4jW5DP2WwlTCFT k/ZekjhwPIJ7KpsVpkiiSISWcPzSCLdJkYS22RpBeAL3sLEOEXZADfg7InG0iPPpMnmI HUDbjEMRe8s6EYKFKsuFgGpYNPCS97f2lvx95saOoSWrui/WUA0sFO0I/HRFPZMtE06n aTYA== X-Forwarded-Encrypted: i=1; AJvYcCVdow1NBiovHgfGxmawoI4ULgLGS7Buhllpe6NRlTwARX68ulrocUsfmN/hgzuVErkZDy38LVBwSJUJ6qMsb5l1o1Sxlx0bmLuU X-Gm-Message-State: AOJu0YxxTHjgq8j34oqM+rJvE3usLzgap65iJpVxZM6H65VvDvT/OZQK A8vA+zw2IX5uoyr2oQR1FMkuADl9Y8AoSlikbTREEimgUIzXAMEhN6qiLHDrl/Y= X-Google-Smtp-Source: AGHT+IEwgOwFrf9DOHaWD2v90KNE+gUgBapBNCTryATgRwothFHnMrTK/MjIW3m5Lu9aBAxgAfhr3A== X-Received: by 2002:a05:6870:2d5:b0:259:8321:243b with SMTP id 586e51a60fabf-25d06cc56aemr6137152fac.24.1719261993625; Mon, 24 Jun 2024 13:46:33 -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-25cd4c106dbsm2092849fac.58.2024.06.24.13.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 13:46:33 -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 v3 1/2] spi: add EXPORT_SYMBOL_GPL(devm_spi_optimize_message) Date: Mon, 24 Jun 2024 15:46:07 -0500 Message-ID: <20240624-devm_spi_optimize_message-v3-1-912138c27b66@baylibre.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240624-devm_spi_optimize_message-v3-0-912138c27b66@baylibre.com> References: <20240624-devm_spi_optimize_message-v3-0-912138c27b66@baylibre.com> Precedence: bulk X-Mailing-List: linux-iio@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: d4a0055fdc22 ("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:46:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13710065 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76F2319DF5D for ; Mon, 24 Jun 2024 20:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719261997; cv=none; b=Drkb0T5kp02US9NPMA/iAHOFSyJaHvI2bTP00tAIV0kO6/sMLYHRaMRIIqiO7j8PS4IbqlihjTG56lDwhGo2SAFgGY1RXBlWYCZK7IpSDtBFRSsUfF1FRK1Kz70eep2hV/kaJlwBO0DxEoZmoGlsg2lQ6hCfbbdiTNQYAbpvdBg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719261997; c=relaxed/simple; bh=M5ncsogjwIKi7yTwd3on+qTwjMFKb9OhWUuYpkcn5s4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HM3GEsbnVZ5M9SKRDzeq5mNxpYqH9WMBpUsdEvB483FZZIolESJLgTRm3WIpJjrljJlI2wI7Psd2fHUs64KUI+elyCX8rZDxzmieBWlpMsL3VoiACDq2sDdHk1V8a7rj6VoPJa8GENQF00YZpw/QNfPWo6SEV8EeRYWjviACmUA= 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=ZTx//brT; arc=none smtp.client-ip=209.85.210.43 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="ZTx//brT" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-700a6853664so1584808a34.1 for ; Mon, 24 Jun 2024 13:46:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1719261994; x=1719866794; 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=ZTx//brTD8K18G842k/4ZHXiw/KkGaEtWETy9vIM1vMgW5Sl7JMOfF/fhCGUjHHcn6 Zxs3t+h3cl4hx4Syk6eQgQUmLr/wzdm39GYHxvwEq+AKg1TeKxQYLUMxjMrvQpY8ofLS jIz5HA833nzMUDJr1XoMKbWJvreUNfmwGn/Lk57K3tSJDbH9OAAbr0JhdnZZZ1djPTXo VT2wpTBuM9IB9PaCLb1VgqN/BTatgBrSknDncVDdc5sq80WjfRg1Cip0X3LXJDqZCPUd MsqQAC2mWd6KcRsdscrrLgwdCszJGZq+WUMR864x/cExeWq437VfbFsqjXMOiusCCjAV 4m4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719261994; x=1719866794; 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=pwytk88lRWbhpqzCGpPlkVJHPY8f1/lYkY0G4Yp+sPdqGRwVqIzxmpZau4dthqU0pj W+QUeJiIF/7fRnDbYFPd1MHD4NOHnqrLyO/aMcW8hq+m5objr6xMeLuor1DD4/YEn5iU 8Kf1lFM7JxkHCAw7vX1uSPulYsaH4G0T3iL0pC5p49ypT3Ta18IpGujiL13pD215GmzA HGHqrD2C0nOCxl0tDr4xW2xjOQ1gw9m/E0RQIsd68TQcV8E1LBq+J3NmyBWqhVT3XSL9 HnS1jfmSpGBjpN5tRPv3c67dOljsv60u/yWqElCDoyMc5ZI8a+yUGO2ViV/mvADy9NrU ePAw== X-Forwarded-Encrypted: i=1; AJvYcCVgg12LW8X29i08tI0Hg+oIHd+2qsUjWojkYBU66Av7Z7ltXLKP5b1e/ftmSnpZsmMKo7ppT1cV4gYRT4E2s5vOfcbojAxIPSM4 X-Gm-Message-State: AOJu0Yzw1LZOt3by/+HPYYRJSvYsJhPVOWZhSNNn2avss5pu782IqOnz hhddGlKNF6Tg0tK5xeK66aG8gA36hiuuCeVP7th6VfZAf/VKw+R51xgk29D0hOY= X-Google-Smtp-Source: AGHT+IF7EFvGMEWr3pSOe3ttWzuPOBO9uekNYTXi7CPcw+9uIitHHwkUX7fmGEK32jf/6d5fRZGkyA== X-Received: by 2002:a05:6870:d629:b0:251:2766:deb5 with SMTP id 586e51a60fabf-25d0163f01bmr6692531fac.9.1719261994534; Mon, 24 Jun 2024 13:46:34 -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-25cd4c106dbsm2092849fac.58.2024.06.24.13.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 13:46:34 -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 v3 2/2] iio: adc: ad7944: use devm_spi_optimize_message() Date: Mon, 24 Jun 2024 15:46:08 -0500 Message-ID: <20240624-devm_spi_optimize_message-v3-2-912138c27b66@baylibre.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240624-devm_spi_optimize_message-v3-0-912138c27b66@baylibre.com> References: <20240624-devm_spi_optimize_message-v3-0-912138c27b66@baylibre.com> Precedence: bulk X-Mailing-List: linux-iio@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); } /**