From nobody Wed Feb 11 03:44:25 2026 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 6970B2C2ADE for ; Tue, 22 Apr 2025 22:08:51 +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=1745359733; cv=none; b=soDtfYKKkiRxLjATYVm5H8YhAyUO51VKRFdWFVaFohqR/rJaiq+IaEw07oLuEss9YUkLcUxkXTZmQoWM87XFsq7oTU2RDfOZjFM8H3aL+PP23Yol3Jedv9uK9XB5S9d4ERTUGnE1X0b3XYxN+4VjQUBWya2gM149xipmE7H0HaA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745359733; c=relaxed/simple; bh=bNzghGrt115+ZKNUZFU+xQJSBPkqwVs5iV+9xGBsm0g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F0KxyNA5NqnepBOOf0JufLt1iDacd89XbhgCTwpujyk4/mxGKpf+dFpfnRjdgL3MKdVgmYnvCoVxzXdntWgvAYpo16vVRne4OKz4ZmL4EHYVq9ZiRSlrA8Auc9M4xLw5NXc92eAbhKeBj9PRl1qI8W+UEBTLfMoh2Qy7vFFhufY= 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=wwP0vpVX; 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="wwP0vpVX" Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-72c09f8369cso1821209a34.3 for ; Tue, 22 Apr 2025 15:08:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1745359730; x=1745964530; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=OcAjMtDsEwOO8O58Cs5cDx4aKARQOhUbmH4snH5r6Ms=; b=wwP0vpVXveZpmTzOqMCFvr2+JpZPkCrlyyBPngKI7UH1rQ3ONsXMczrsodi5+qk/oN YgL8aDq27iBcdk5Vm6va03r0k1viRip3K7PNbySL8DwVNhAj7nIFLvx6eHWRTCN5/dse K5QFJMRNv/P64JpCI3Z04l4DTy5WnU7wH8afVcPJX5pF3Wu1uCXGjuE12cP+mnsyFyMZ oR7LXtggDdU7ns7ACc2xOPLODQBhWMxUiYVnLbxHnHaSEMm4EkmqoczwKxdLi4c1tHyL bBdJvo6kR1xKPnsJb400nUD/5UeLRPOJn1FZBdxHcndiNJHiAIoT+5J2ql1uuZndc/Ld S34A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745359730; x=1745964530; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OcAjMtDsEwOO8O58Cs5cDx4aKARQOhUbmH4snH5r6Ms=; b=XHLUQVR74esTXWgg4NtbLLjISAdq7aVxOXbvDMi+xbdMOS5RYYz/bdXE3SJbpeukt6 xiRZabu/mKX/Xv7BdKiATVGfTw/6qxi5T8xty0JBaTZpY6OiR/vC6ZNfDOMFm9k+EERZ xQJFrwiY9+fZOkSpoSBRYyVI/bizB8c89JUXYZrELOfMbU5/mlOvEUcY4Lc2GIGhgIKl wgsru9qDG0wP8jAjino1brVhrf/4EpeDYSDbHB9l5SL8E4UTvZ9h5x8zx6PLkAm8Yu8y w33VySqqI48E90H5fmtqOi35nh21qUd71GYx8OgeCCGRL5uoOm9tBcTD0P6MrnURfwP8 68Ug== X-Forwarded-Encrypted: i=1; AJvYcCUwDPp9mtXrUCqpLLGyZ8EmL+POnqgAO2vFyqE8sYEqWSXk/AvUqWArVOVohWeN+JidGbuBnFJu2E4xemQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yzk1N+V5P7mzimos7gcISBfDJ3PREkgZEXk+gMpFFrXAy8nSe8/ YPggWla7hmJ2mqThem4ONNAbpWbZyaVnT2MAFOTaofnotmIaBkZzo0cT6WTkzaQ= X-Gm-Gg: ASbGncsJg7J33j7uDjxMaLemNa6CgxcifGA+X4MXuzrRPrLQgBx/qaI6xuvskOSNFNI DTcTgcQ2abn+if3H9cs6X+zQTt7XNpVvtEfz+0BMQkaEXl4DjUUR4OLMWL1eU2BPcxR+Mt/zY7Y 2tSVFn8lRnfq4C+ckKijHZjb1obLxdPSSWqLMEvu04/pBCM9U0BcBP+j8dhh2Ly/ENqLRRZT/Jp rq58KSUS1bBflJfGo+omObKPZTZwDTO0q5S3s9UweVzUeFpsD5pibpXxU88X+rI2g2gUBx85Bs6 USIOKG+taxDgbvttMG7iVYLe9rzo2AK+60es0jjLHpmcoE4= X-Google-Smtp-Source: AGHT+IHzzwKW3y0fInhdjWSpsuJ5JmWctR16v6GWhHHGSelSclI2sxPnML9dTnb8TnnyDMSSFW1wDQ== X-Received: by 2002:a05:6830:61cb:b0:72a:1dfc:c981 with SMTP id 46e09a7af769-730063304edmr11661860a34.25.1745359730406; Tue, 22 Apr 2025 15:08:50 -0700 (PDT) Received: from [127.0.1.1] ([2600:8803:e7e4:1d00:c8d1:e0ed:ce8b:96a3]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-730048848dfsm2265938a34.52.2025.04.22.15.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 15:08:50 -0700 (PDT) From: David Lechner Date: Tue, 22 Apr 2025 17:07:51 -0500 Subject: [PATCH v2 6/6] iio: adc: at91-sama5d2: use IIO_DECLARE_BUFFER_WITH_TS Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250422-iio-introduce-iio_declare_buffer_with_ts-v2-6-3fd36475c706@baylibre.com> References: <20250422-iio-introduce-iio_declare_buffer_with_ts-v2-0-3fd36475c706@baylibre.com> In-Reply-To: <20250422-iio-introduce-iio_declare_buffer_with_ts-v2-0-3fd36475c706@baylibre.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Lars-Peter Clausen , Michael Hennerich , Eugen Hristev , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1674; i=dlechner@baylibre.com; h=from:subject:message-id; bh=bNzghGrt115+ZKNUZFU+xQJSBPkqwVs5iV+9xGBsm0g=; b=owEBbQGS/pANAwAKAcLMIAH/AY/AAcsmYgBoCBNjAzzt1sRYLcJPXzefhzYxHcbR4XNJFDKvZ JN6D57NVvyJATMEAAEKAB0WIQTsGNmeYg6D1pzYaJjCzCAB/wGPwAUCaAgTYwAKCRDCzCAB/wGP wFKfB/45NebbapbIP3t4eBe7IDDKz2IX0X7vuL1EOiu0sCj5YLzAqoCos3aGbC3nAYBmnTV/9hu cGfDIiEMSXlDgH7ASvPN7SFQ/ANjGO2xc896/FcMxGq/kyx3dOp33a9ienXD+mFjne9N1/PXWIg oO+XPo6f+HtvNvjb/uyALdwB822D7BpmRJ2i765kt5mysIPkY5yd1SBIXUu4sT9gLI9lMfV+oIo MqxuocA4UYA0VEMFVRssN3TAOhlHC5i+k06k7VuE04rpLH+kqyuHDcLJvBuDJnsLBOsic2D2h+q 5Kbts705K+v72L/z4sznTI1YwjSMGRe0UILK+jAPLEOzrS4u X-Developer-Key: i=dlechner@baylibre.com; a=openpgp; fpr=8A73D82A6A1F509907F373881F8AF88C82F77C03 Use IIO_DECLARE_BUFFER_WITH_TS to declare the buffer that gets used with iio_push_to_buffers_with_ts(). This makes the code a bit easier to read and understand. Signed-off-by: David Lechner --- This is an alternative to [1]. [1]: https://lore.kernel.org/linux-iio/20250418-iio-prefer-aligned_s64-time= stamp-v1-2-4c6080710516@baylibre.com/ --- drivers/iio/adc/at91-sama5d2_adc.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama= 5d2_adc.c index 414610afcb2c4128a63cf76767803c32cb01ac5e..4ebaeb41aa4568e2461506471af= 0540af9d1a041 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -586,15 +586,6 @@ struct at91_adc_temp { u16 saved_oversampling; }; =20 -/* - * Buffer size requirements: - * No channels * bytes_per_channel(2) + timestamp bytes (8) - * Divided by 2 because we need half words. - * We assume 32 channels for now, has to be increased if needed. - * Nobody minds a buffer being too big. - */ -#define AT91_BUFFER_MAX_HWORDS ((32 * 2 + 8) / 2) - struct at91_adc_state { void __iomem *base; int irq; @@ -616,8 +607,8 @@ struct at91_adc_state { struct at91_adc_temp temp_st; struct iio_dev *indio_dev; struct device *dev; - /* Ensure naturally aligned timestamp */ - u16 buffer[AT91_BUFFER_MAX_HWORDS] __aligned(8); + /* We assume 32 channels for now, has to be increased if needed.*/ + IIO_DECLARE_BUFFER_WITH_TS(u16, buffer, 32); /* * lock to prevent concurrent 'single conversion' requests through * sysfs. --=20 2.43.0