From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.123 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796218757; b=iOSNDcMDTGM0PpI4f6p58JtYpZtF4vUjS/7YQJZXo7aQwqNWFFp7MPDHU/AR+iCOfd2d 8OCmsT1fJWaBG1hhUBoCKBJ/BFf/C9URl87qFddb2XUW6EocdoEc2DWg2xtauxvajrqng MZPu5+5byIlupu6DPx75+M7tyjL8MqkKR+9iQb2y57YTbShM2PiDDsCiAjnGPPx21sVQ3 b+X/pUXRTZ0oq1V+7injTJQbnLo310RiD9upj7aDkTv5ZkFGzJs7boxRtYzSsnyD0cYpz D/rDNcT7FUAbAJft2sIhZ/iTfkJmjNEFSMYNlChmxMlRoWgrXGzZ0uTtKAPiJ+yNJ7A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796218757; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID: Reply-To:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=+k1dgWRfc+oPYuQOHMuPuhcpKSzpeheSfD4Khc4lF1E=; b=CkVUsKcf/erEZnlerIp2cVaIJyPl628E4GDr2oGtc/KIAjqL32TDJTUaEz1q7PmgpsrP 2vAzt4mqeB9MYgKMTOfxfoPCjvs6RswESQYKVT6befiJ46U6c4lN1MfULCP/nkEDDx1TT fKGtETNJfauL5Wkt5SIwYScdbkTXP7sA/foaMMJCw5tCMab3UHJiltXxQ9ycu6bT9pOEO JmYMH1on279Iw+IrBEL3Dofp5A+ZDCdRFJcEaECdVspx06gBK0unbtJfOztCDgNewSyQc 4o8q7A4lkSgREb4G2rAIDYuJFwZ5mtREmDgYlpxHJ3JCwskXYmVNDmliJZfcOu5LxcQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Rn778BEU; arc=none smtp.remote-ip=91.218.175.123 Received: from mta0.migadu.com (unknown [91.218.175.123]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7971F606A31A for ; Wed, 2 Dec 2026 13:39:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7971F606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Rn778BEU X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=JVoUp6oOasWg2pt9DmhiHwY7vALxRGHd7MmdSJC9itA=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796218753; v=1; x=1796823553; b=Rn778BEU/A24f1QpsS/hAJS2Mc4BrQZbyg9k41ToR460v4NrfdALUzSZu5WJLp1EaruGfkON +bHxLJdeELjKbpfn7RKE/4PouYemCla05TYOVbBjdLyHwXF5kuUDmE/PHWEw3eHdE/uIStfB9mT evN5Qs33eXMyMInsTM8Jcz5o= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta11.migadu.com with ESMTPS id 24c89923c28be4ed; Wed, 02 Dec 2026 13:39:13 +0000 X-Mizu-Trace-ID: 24c89923c28be4ed X-Migadu-Flow: FLOW_OUT Date: Wed, 2 Dec 2026 15:39:08 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] iio: dac: rohm-bd79703: Avoid copying chip-data Message-ID: Reply-To: Matti Vaittinen References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="vjIIelvmorxr6daO" Content-Disposition: inline In-Reply-To: --vjIIelvmorxr6daO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =46rom: Matti Vaittinen The bd79703 driver data has been divided into a static, chip specific data, and to an instance specific data, which can be modified at run-time. At the moment, only the instance-specific data is usable after probe, and only chip-type dependent constant 'num_vfs_chan', is copied to instance-specific struct. Upcoming support for bd7971x family of chips will introduce a need to use a few more chip-specific static values at runtime. Copying them to dynamic private data struct would get wasteful. Save some bytes and minimize data copying by storing a pointer to the constant, chip-type specific data, instead of copying all the values into the instance specific data. Signed-off-by: Matti Vaittinen --- drivers/iio/dac/rohm-bd79703.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/iio/dac/rohm-bd79703.c b/drivers/iio/dac/rohm-bd79703.c index 1d58bc1544a1..b6508e1e1c4f 100644 --- a/drivers/iio/dac/rohm-bd79703.c +++ b/drivers/iio/dac/rohm-bd79703.c @@ -38,14 +38,6 @@ static const struct regmap_config bd79703_regmap_config = =3D { .cache_type =3D REGCACHE_MAPLE, }; =20 -/* Dynamic driver private data */ -struct bd79703_data { - struct regmap *regmap; - int vcc_mv; - int vfs_mv; - unsigned int num_vfs_chan; -}; - /* Static, IC type specific data for different variants */ struct bd7970x_chip_data { const char *name; @@ -58,6 +50,14 @@ struct bd7970x_chip_data { unsigned int num_vfs_chan; }; =20 +/* Dynamic driver private data */ +struct bd79703_data { + struct regmap *regmap; + const struct bd7970x_chip_data *cd; + int vcc_mv; + int vfs_mv; +}; + static int bd79703_read_raw(struct iio_dev *idev, struct iio_chan_spec const *chan, int *val, int *val2, long mask) @@ -67,7 +67,7 @@ static int bd79703_read_raw(struct iio_dev *idev, if (mask !=3D IIO_CHAN_INFO_SCALE) return -EINVAL; =20 - if (data->num_vfs_chan > chan->channel) + if (data->cd->num_vfs_chan > chan->channel) *val =3D data->vfs_mv; else *val =3D data->vcc_mv; @@ -224,9 +224,10 @@ static int bd79703_probe(struct spi_device *spi) return dev_err_probe(dev, ret, "Failed to get Vfs\n"); =20 data->vfs_mv =3D ret / 1000; - data->num_vfs_chan =3D cd->num_vfs_chan; } =20 + data->cd =3D cd; + idev->channels =3D cd->channels; idev->num_channels =3D cd->num_channels; idev->modes =3D INDIO_DIRECT_MODE; --=20 2.56.1 --vjIIelvmorxr6daO Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmsQH3wACgkQeFA3/03a ocVtLggAujG+KxLJ92ZFBzAMKGifMKV2jcnER/BBuaLG5YEap3ETGGpa3QZ+phyc CBDBQapCkAkVV9EaPgHi0/VX2sXgV9qiCBQk+16GCQSeYWubG/rwSvKUFxrmGt3N hjODPWBniYvv1P/uDmTb5tfkVgUV3Gh1BKFeSM+vdqSNb72R05KwowTjTOHM6Qyx 7PWoSWujuBunLQ1uzFdnpXTFpXXEJO7Tz/+wohedNMJIy6Meyoo/1tiiJghvAgWY cTSk+jFHaljZJbrm1MFa0E9QtY1mChtNdx0qiVP56qK4RQ/KYXim42Big4T3+SFP xr3k800e72/nbWlJf76DgfzdSlpeMQ== =M2in -----END PGP SIGNATURE----- --vjIIelvmorxr6daO--