From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 B97343101C2 for ; Thu, 18 Jun 2026 14:44:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781793865; cv=none; b=GArYq9z8dOgdQUBTv+mW0NwBVRFNzf0fil1YvsGP9Lowb2Ym48oxfDF+A19CwlGTEFPMP+fbJaXQWSLU6e357C2YVaN6IwIWoSjdLtv+2syVWWJgTQTTDYWHrbwpy5HCT1QcKWA5o/N1eU5LKABxi6DUvC6UgON+T7ORVLUi8hw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781793865; c=relaxed/simple; bh=Yu6YeUOnFWPrCqIB5YEhtWIJyvV2BtUwFJn4XL9Gr70=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SRpz5NQRvrwLG+LCUS0yIh28xtvREyM6FQMG6VIwqFq7MVwKsNelmkWvNGT60s9PcKvRbCNA2PUBBYORxfnW+C1vFa8GqJh+tY+jJlSw7yVelgq06u8zInyUslBDM4h5XZizpA5bf1mLeNF6FgyPKfcfRSlQHgq9iOiwo44eP0U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PeZm+h0M; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PeZm+h0M" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-463f1165e16so882192f8f.0 for ; Thu, 18 Jun 2026 07:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781793862; x=1782398662; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=LemwOVSIrC22MjpNchRABfurYl4fHAx2ajxQmykJZ0A=; b=PeZm+h0MeG/A4/vv6gjIH0cRQLAoj4HR9JrACHWMuI476CY1k5gxpPl4O1f7KE/bra kaINdOfHenQopsMxCwSzvrhxH0snVHNZZNFYrArNkbfbFu9M4SLt5RP1/hI5UjYPSG+7 uZ8sBJiEb18lP2gu4tl5zLgmgsVmREZ8uRatSMWukfDqGnp1CBKoyRSQjshkfFrFtz4u Sm53tA+s4coHz+RTU3+DyNUtjb2p2EDXnt1b0z3D26bgzWyX/i8N2s7y8a3EF0PVdhm+ A8Hxy8ifIkZO6i889+NLb5uWt7u64mXks1uiFqczlrpmwYtrHsALfv4900rh4FmX5Nwn w1WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781793862; x=1782398662; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LemwOVSIrC22MjpNchRABfurYl4fHAx2ajxQmykJZ0A=; b=nVLJm6KlNwRNhnsLNN/EG/w6i01TlRhVZJJ37dm0G++jbgCbO4Zh/0z978nOuBiu95 yg3nGaiOVe4HN+O06X6a2PTxAbHRd/2m9osfmnkUw1eyLNxlUTHY6DMOo6aoWBZvtzEi XJifzqitcsM4VWT4fhi1QgIGjds5lxvsxyaCBvRySnVEFH21TjGHKvL3ICazJlIsczyh ZWQbtQALK6msPES3VI1kuimsv/y4eJOCIteTQIq0rbw/3uIwD2fu3ens36f+wSXrAj2V LV3YUT0R7pqL6TWPELQNoVHpp9dFy/n0uvBsWG07Mw829BwZ3Qowd4OfH71B9LwtlSbW Ltcw== X-Forwarded-Encrypted: i=1; AFNElJ/am4PrFPSia291jERyPaAoNN/2uLyHb/EcXWuk7JNELQa9TdUTgppX2dMSEH2e0V5qFTJdIv2YiXqd46Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yz2e0vKUXw2CnrHyRDkKh8bf0K7KA4V4F6Vn8dHx7KkXJLQuiIG HotAw70ExM9H2NBFbUYht9SRQyzCWR8loj7qxShnzfh5yjy1i5MGbqqr X-Gm-Gg: AfdE7clz4CWvvvhqszYNZAMkkGZdLoY13NNwzIVrO+lSbwLsxNv6ZQFk8lz4fkDI0IF PpzysBjg7C0VMFWmY/vJ/2ZkC+4hpfZS2OIjpRWAFFNmkNdJOh96AbE/BGxLBFPWM8zpzXHkE2R L/SOmpKLWyNqsb2oqLvdV1SLM7FLK+8+ny+8wggN1faX51LGSA4LG9pAVWSJSvDrEExCCN4YuPP DcSIgoCjiBnt6Yh8knpmaSd1bYiHfAe9wBnQDsehaMWtOmcAxSpU2KJArrULqXJkhpvq84a8dfQ os1l1kfxTf0NZg+YWr7p94mmg07xsdGTnY5EuUUho9QY3jKW/XAvCMFku7Jrsmqpoz+avv/628t r+MGPjo0ENFKWBSVjm4f1DNPQm6jkgKArf4u9/jDltgscO6tGaYQzhxMmNihzIWchDxjq5SRAYT z+/Wbp X-Received: by 2002:adf:e811:0:b0:460:1233:ecf2 with SMTP id ffacd0b85a97d-4623908e11dmr12410883f8f.30.1781793861659; Thu, 18 Jun 2026 07:44:21 -0700 (PDT) Received: from nsa ([148.63.225.166]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4620b1083e3sm20736217f8f.20.2026.06.18.07.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 07:44:21 -0700 (PDT) Date: Thu, 18 Jun 2026 15:45:23 +0100 From: Nuno =?utf-8?B?U8Oh?= To: rodrigo.alencar@analog.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-hardening@vger.kernel.org, Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Jonathan Corbet , Shuah Khan , Kees Cook , "Gustavo A. R. Silva" Subject: Re: [PATCH v6 05/16] iio: core: support 64-bit register through debugfs Message-ID: References: <20260618-ad9910-iio-driver-v6-0-79125ffbe430@analog.com> <20260618-ad9910-iio-driver-v6-5-79125ffbe430@analog.com> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260618-ad9910-iio-driver-v6-5-79125ffbe430@analog.com> On Thu, Jun 18, 2026 at 02:27:21PM +0100, Rodrigo Alencar via B4 Relay wrote: > From: Rodrigo Alencar > > Add debugfs_reg64_access function pointer field into iio_info and modify > file operation callbacks to favor 64-bit variant when it is available. > > Signed-off-by: Rodrigo Alencar > --- > drivers/iio/industrialio-core.c | 33 ++++++++++++++++++++++++--------- > include/linux/iio/iio-opaque.h | 2 +- > include/linux/iio/iio.h | 4 ++++ > 3 files changed, 29 insertions(+), 10 deletions(-) > > @@ -471,7 +485,8 @@ static void iio_device_register_debugfs(struct iio_dev *indio_dev) > { > struct iio_dev_opaque *iio_dev_opaque; > > - if (indio_dev->info->debugfs_reg_access == NULL) > + if (!indio_dev->info->debugfs_reg_access && > + !indio_dev->info->debugfs_reg64_access) > return; Not really that important but should dev_warn() in case someone gives both callbacks? Can't use both anyways. (We now have agentic help reviewing the code so maybe even if someone does it for some reason it won't pass review :)) - Nuno Sá > > if (!iio_debugfs_dentry) > diff --git a/include/linux/iio/iio-opaque.h b/include/linux/iio/iio-opaque.h > index b87841a355f8..98330385e08d 100644 > --- a/include/linux/iio/iio-opaque.h > +++ b/include/linux/iio/iio-opaque.h > @@ -73,7 +73,7 @@ struct iio_dev_opaque { > #if defined(CONFIG_DEBUG_FS) > struct dentry *debugfs_dentry; > unsigned int cached_reg_addr; > - char read_buf[20]; > + char read_buf[24]; > unsigned int read_buf_len; > #endif > }; > diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h > index 711c00f67371..1c7d12af22da 100644 > --- a/include/linux/iio/iio.h > +++ b/include/linux/iio/iio.h > @@ -484,6 +484,7 @@ struct iio_trigger; /* forward declaration */ > * @update_scan_mode: function to configure device and scan buffer when > * channels have changed > * @debugfs_reg_access: function to read or write register value of device > + * @debugfs_reg64_access: function to read or write 64-bit register value of device > * @fwnode_xlate: fwnode based function pointer to obtain channel specifier index. > * @hwfifo_set_watermark: function pointer to set the current hardware > * fifo watermark level; see hwfifo_* entries in > @@ -572,6 +573,9 @@ struct iio_info { > int (*debugfs_reg_access)(struct iio_dev *indio_dev, > unsigned int reg, unsigned int writeval, > unsigned int *readval); > + int (*debugfs_reg64_access)(struct iio_dev *indio_dev, > + unsigned int reg, u64 writeval, > + u64 *readval); > int (*fwnode_xlate)(struct iio_dev *indio_dev, > const struct fwnode_reference_args *iiospec); > int (*hwfifo_set_watermark)(struct iio_dev *indio_dev, unsigned int val); > > -- > 2.43.0 > >