devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 7/7] iio: accel: kx022a: align with subsystem way
Date: Mon, 2 Dec 2024 08:46:46 +0200	[thread overview]
Message-ID: <a52bce75-c1df-453a-b54e-2dfbeb9c285e@gmail.com> (raw)
In-Reply-To: <20241130182628.3d35817b@jic23-huawei>

On 30/11/2024 20:26, Jonathan Cameron wrote:
> On Sat, 30 Nov 2024 18:15:06 +0000
> Jonathan Cameron <jic23@kernel.org> wrote:
> 
>> On Thu, 28 Nov 2024 11:03:40 +0200
>> Matti Vaittinen <mazziesaccount@gmail.com> wrote:
>>
>>> Many of the Kionix/ROHM accelerometers have a "PC1 - bit" which enables
>>> the accelerometer. While a sensor configuration like ODR, g-range, FIFO
>>> status etc. are changed, the PC1 bit must be cleared (sensor must be
>>> disabled). (See the description for different CNTL registers [1])
>>>
>>> In order to ensure this the kx022a driver uses a mutex, which is locked
>>> when the PC1 bit is cleared, and held for the duration of the
>>> configuration, and released after PC1 bit is set again (enabling the
>>> sensor).
>>>
>>> The locking and PC1 bit toggling was implemented using functions:
>>> kx022a_turn_off_lock() and kx022a_turn_on_unlock().
>>>
>>> Based on a discussions [2], the IIO subsystem prefers open-coding the
>>> locking with scoped_guard() over these functions.
>>>
>>> Drop the kx022a_turn_off_lock() and kx022a_turn_on_unlock() and use
>>> scoped_guard() instead.
>>>
>>> [1]: https://fscdn.rohm.com/kionix/en/datasheet/kx022acr-z-e.pdf
>>> [2]: https://lore.kernel.org/all/20241126175550.4a8bedf3@jic23-huawei/
>>>
>>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>>
>>> ---
>>> Revision history:
>>> v2 => v3:
>>>   - New patch
>>>
>>> NOTE: This patch uses the if_not_cond_guard() which is currently missing
>>> the iio_testing.
>>> https://lore.kernel.org/all/20241001-cleanup-if_not_cond_guard-v1-1-7753810b0f7a@baylibre.com/T/#m69982b23da9f71e72d84855b34e9b142cb3a1920
>>
>> Looks good to me.  If no one else comments, I'll pick this up when
>> I have the precursor available (so hopefully just after rc1)
> or maybe not.
> https://lore.kernel.org/all/CAHk-=whn07tnDosPfn+UcAtWHBcLg=KqA16SHVv0GV4t8P1fHw@mail.gmail.com/
> 
> Seems Linus is unconvinced.
> Hmmm. We might have to roll back the uses of cond_guard() entirely.
> Which will be a pain.  Ah well. Sometimes an idea turns out to not be as useful
> as it initially seemed.
> 46 instances to get rid of in the tree today...

Ouch! :( Sorry to hear Jonathan.

Yours,
	-- Matti

      reply	other threads:[~2024-12-02  6:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-28  9:01 [PATCH v3 0/7] Support ROHM KX134ACR-LBZ Matti Vaittinen
2024-11-28  9:01 ` [PATCH v3 1/7] iio: accel: kx022a: Use cleanup.h helpers Matti Vaittinen
2024-11-30 18:05   ` Jonathan Cameron
2024-11-28  9:02 ` [PATCH v3 2/7] iio: accel: kx022a: Support ICs with different G-ranges Matti Vaittinen
2024-12-02 10:25   ` Mehdi Djait
2024-12-02 11:05     ` Matti Vaittinen
2024-11-28  9:02 ` [PATCH v3 3/7] dt-bindings: ROHM KX134ACR-LBZ Matti Vaittinen
2024-11-28  9:02 ` [PATCH v3 4/7] iio: kx022a: Support " Matti Vaittinen
2024-11-30 18:06   ` Jonathan Cameron
2024-11-28  9:03 ` [PATCH v3 5/7] dt-bindings: iio: kx022a: Support KX134-1211 Matti Vaittinen
2024-11-28  9:03 ` [PATCH v3 6/7] iio: accel: " Matti Vaittinen
2024-11-30 18:07   ` Jonathan Cameron
2024-11-28  9:03 ` [PATCH v3 7/7] iio: accel: kx022a: align with subsystem way Matti Vaittinen
2024-11-28 17:20   ` kernel test robot
2024-11-30 18:08     ` Jonathan Cameron
2024-11-28 17:31   ` kernel test robot
2024-11-28 17:52   ` kernel test robot
2024-11-30 18:15   ` Jonathan Cameron
2024-11-30 18:26     ` Jonathan Cameron
2024-12-02  6:46       ` Matti Vaittinen [this message]

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=a52bce75-c1df-453a-b54e-2dfbeb9c285e@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=robh@kernel.org \
    /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).