From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) (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 BA06A3115A2 for ; Sat, 21 Mar 2026 19:27:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774121237; cv=none; b=MQEavY54QiUoNQzn3irdj+CKqnrlL2hDYsNj/0Dcw3HVjyR+OCN2a17xSxflldZPJ5UlzT2yB143XsoofFTDIEkstBj6WeVRXEL9Gmgjoevexfhf09KEv4ZRctGTeAjZex4kD3yhhfQetz2xb2dVmyVszd6lGMJONZo+psKMoE4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774121237; c=relaxed/simple; bh=lOCZbhE3NKkdYTlRDV1FldKTuUpoHr7tpaEtvwGYBkw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=svnjSNAVLmVfACOU7aNPntc7Pf6Hv00Eafy4uhSBBTo7YVQutVs2mwixvcHo+vqZJaQNSpqCevJxOb8nCT+wrV7/d2Q2/JbN6F4bVVNKlaPN2Im5kZJXKW0Js6n+wzyqLubIPugO8sr/Rw7Kqna9yTnYzdqGW2tUj/UV4ZYLTkU= 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=d5U9TlQT; arc=none smtp.client-ip=209.85.161.53 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="d5U9TlQT" Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-67c2c733c24so790651eaf.2 for ; Sat, 21 Mar 2026 12:27:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1774121233; x=1774726033; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Qx+nu7/Wx18RNPJ/e4nhvsPL7FRVDVMDYIX30C/ItEs=; b=d5U9TlQT8u1jBLg1KrRvoZL7kwRs6XxbPOd2sAxosapRwFY970AVTAFYaiHj8eDPIt hofcRgV7qwWtLhHRxXyQWZRAhLh7tMzpty9P1Aw0+iSkFlFuC7nOitX4IWeX5VQGQ8wk b1kQ4fAaBGs9ij/TIJgoHxTiC92DORZa3PJZBwB4gmf0tYXm9Zi/olj0pOHrTKhe6ECG m8y96pwfZX3Pt3HQ0G/cMHik/sIiAGRVLqJsHmJ/uw1A5+rL/8RVBEHnUv/WmlvZKew1 4Gnhax8u88KMWcgkDh+5Q4cFJj0v2Efka8Bm8fv6yQEG5Sr/MB6QSnoMYFz/hBm85S8n DB0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774121233; x=1774726033; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Qx+nu7/Wx18RNPJ/e4nhvsPL7FRVDVMDYIX30C/ItEs=; b=mm+ev6BJooYXlgPiDW6Rm8CCph9a0JLtRYVbBrvZ/BU5Cl88Jgmw7SGzoLbgWlkVG2 JZj44mviqgbJdE50dAQOmeCwlJbTtUnjotrayYbgXflDA0B72JkenIN0X3veLX+6buFB 2p+UImKT9gapUxHVZLFy4oGu8E4gPvN2yZJKbBiPTMGUqgHvS2nXYHbb/FbuO1bZDEFF lZIqZPUTwIUaCCEIILM6J5GNCg33iNznkaN1wwO+Dj3uZ1arQFgMjdv2k8Emr7aT+oL/ carvIDInod+tvFvbjXZfSCHE2fPVgtjsElxdbnl8TgZ8CoLi7acFcz/qdnWJ1Uemupb0 feiw== X-Forwarded-Encrypted: i=1; AJvYcCXihBjyHo+s+p+jPbLHxqMDKCRjVZGO4/3HeeN/3oAqmISD5gq8pok3t2W9VMV4K7auxY8eV8YNoLGX7EY=@vger.kernel.org X-Gm-Message-State: AOJu0Yw8syopGSiTuIVbbADzja0FbM4QDKB5LdSkDGQxucl9TjFQmYTu Oj3gER50gaX2CfyrXiJP3sy164nhWr65wX0q3k5n5hpcUYtm+Eukkxt7KXVQwVWbCMc= X-Gm-Gg: ATEYQzz1Hc66YSotLhYUSQh55OzEerYg27YOLPd6r282qJX3a6PB+KaSkrcuobf3ks9 mP/eQuRoANdvC//y2kB1jBQ3J9fOAZTSuslngPsGq7ZXQ7W8zfJaIsmZ6B5ra0mBGrN3QIPKWX5 QHofxa2ca6kXo/8dstFrhPBfc+MStNL7QA5LFLqs1okctZff2egOETMOTlWzP9/Sg59Te5aI6uk 0AkGWCLz7RLbm8Qk5U/MiedW82GCSZzmETaMUVmZgn5gy84OdlrP8VmmAyKoF4TQT+RouvrrvS8 KgW0F7gg7W9T5ho+9RSuFAuDtfYZFZpwLI95u/RRYYdKXAZoTYJf54U5LrYzkjzEj+KS270PpcP 3w3tE530YaK4tjQTajod+xHXXAaQtRednoTnEx57oCWZqGnLg8LhpZERWeh1sq/DoaYZyb4Cpza dVjNEwJLO6ncx64zyHZr/+EVj5FcNjr9YhW8QS/7VH7IivAyQ24TpScQgz1e8RfONZtbLJ41HHu 5cmtzfdKpoF X-Received: by 2002:a05:6820:2909:b0:67d:e184:979a with SMTP id 006d021491bc7-67de1849afbmr760543eaf.7.1774121233367; Sat, 21 Mar 2026 12:27:13 -0700 (PDT) Received: from ?IPV6:2600:8803:e7e4:500:8e89:f58e:e4e6:5567? ([2600:8803:e7e4:500:8e89:f58e:e4e6:5567]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-67c252e0d18sm3488414eaf.7.2026.03.21.12.27.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 Mar 2026 12:27:11 -0700 (PDT) Message-ID: <0269d645-633e-4ad0-8326-ecdd5f4f47fd@baylibre.com> Date: Sat, 21 Mar 2026 14:27:10 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] iio: adc: ti-adc161s626: use DMA-safe memory for spi_read() To: Jonathan Cameron Cc: =?UTF-8?Q?Nuno_S=C3=A1?= , Andy Shevchenko , Matt Ranostay , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260314-iio-adc-ti-adc161s626-fix-scan-buf-v1-0-56243b11e87b@baylibre.com> <20260314-iio-adc-ti-adc161s626-fix-scan-buf-v1-2-56243b11e87b@baylibre.com> <20260316183117.4dde7386@jic23-huawei> Content-Language: en-US From: David Lechner In-Reply-To: <20260316183117.4dde7386@jic23-huawei> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/16/26 1:31 PM, Jonathan Cameron wrote: > On Sat, 14 Mar 2026 18:13:32 -0500 > David Lechner wrote: > >> Add a DMA-safe buffer and use it for spi_read() instead of a stack >> memory. All SPI buffers must be DMA-safe. >> ... >> diff --git a/drivers/iio/adc/ti-adc161s626.c b/drivers/iio/adc/ti-adc161s626.c >> index 1d427548e0b3..6416d6a7ada0 100644 >> --- a/drivers/iio/adc/ti-adc161s626.c >> +++ b/drivers/iio/adc/ti-adc161s626.c >> @@ -70,6 +70,7 @@ struct ti_adc_data { >> >> u8 read_size; >> u8 shift; >> + u8 buf[3] __aligned(IIO_DMA_MINALIGN); > On this. There is new generic infrastructure for marking these. > https://elixir.bootlin.com/linux/v7.0-rc3/source/include/linux/dma-mapping.h#L720 > https://lore.kernel.org/all/01ea88055ded4d70cac70ba557680fd5fa7d9ff5.1767601130.git.mst@redhat.com/ > > Would look like > __dma_from_device_group_begin(); > u8 buf[3]; > __dma_from_device_group_end(); > > Do you think we should adopt them rather than doing our own thing? I have mixed thoughts on this. Pros: * This would make it more obvious it should be at the end of the struct but doesn't hurt if it isn't. Cons: * It is more verbose. * There doesn't seem to be __dma_to_device_group_begin(), so it isn't clear what we should do for tx buffers. > Slowly though I don't want the noise of a mass conversion. > > As normal, advantage of standard infrastructure is cutting down > in subsystem specific magic. > > I 'think' result is the same (though it also forces the trailing padding if anything > comes after this and needs it).