linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Matti Vaittinen <mazziesaccount@gmail.com>,
	Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Cc: Matti Vaittinen <mazziesaccount@gmail.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/3] iio: gts: Simplify available scales building
Date: Thu, 28 Nov 2024 18:49:58 +0200	[thread overview]
Message-ID: <cover.1732811829.git.mazziesaccount@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]

Simplify the available scales building.

Building the available scales tables looks confusing. It has also been a
source of a few memory leaks.

https://lore.kernel.org/lkml/20241016012453.2013302-1-ruanjinjie@huawei.com/
https://lore.kernel.org/lkml/20241011095512.3667549-1-ruanjinjie@huawei.com/

Attempt making it a bit less error prone by simplifying some error paths
using __free(kfree) from the cleanup.h. Try doing this without
introducing variables in the middle of a function while also improving
the logic of the functions. This is possble by splitting the long scale
building logic in a couple of different, well purposed functions, and
finally streamlining the logic a bit by taking out one extra 'total gains
to scales'-conversion.

Inspired by the discussion here:
https://lore.kernel.org/lkml/2d16bf36-57d3-4c54-bbee-2e7d93399f29@gmail.com/

Matti Vaittinen (3):
  iio: gts: Simplify using __free
  iio: gts: split table-building function
  iio: gts: simplify scale table build

 drivers/iio/industrialio-gts-helper.c | 171 ++++++++++++++------------
 1 file changed, 91 insertions(+), 80 deletions(-)


base-commit: a61ff7eac77e86de828fe28c4e42b8ae9ec2b195
-- 
2.47.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2024-11-28 16:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-28 16:49 Matti Vaittinen [this message]
2024-11-28 16:50 ` [PATCH 1/3] iio: gts: Simplify using __free Matti Vaittinen
2024-11-30 17:51   ` Jonathan Cameron
2024-12-02  6:44     ` Matti Vaittinen
2024-11-28 16:50 ` [PATCH 2/3] iio: gts: split table-building function Matti Vaittinen
2024-11-28 16:51 ` [PATCH 3/3] iio: gts: simplify scale table build Matti Vaittinen
2024-11-30 18:01   ` Jonathan Cameron
2024-12-02  6:06     ` Matti Vaittinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1732811829.git.mazziesaccount@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).