Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Sai Teja Aluvala <aluvala.sai.teja@intel.com>,
	 linux-wireless@vger.kernel.org
Cc: kiran.k@intel.com, chethan.tumkur.narayan@intel.com,
	Luiz Augusto von Dentz	 <luiz.dentz@gmail.com>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v1 1/1] rfkill: add rfkill_hard_blocked() helper
Date: Wed, 30 Sep 2026 13:40:23 +0200	[thread overview]
Message-ID: <a612cb0f1cfc09b7ec7f494f22f8cc8d3ba61f10.camel@sipsolutions.net> (raw)
In-Reply-To: <3305da8e844c9d0a5de5848b596d16de8d462048.1790752797.git.aluvala.sai.teja@intel.com>

On Wed, 2026-09-30 at 13:12 +0530, Sai Teja Aluvala wrote:
> rfkill_blocked() reports the effective block state, i.e. set when the
> device is either hardware or software blocked, and rfkill_soft_blocked()
> reports only the software state. There is no equivalent accessor for
> the hardware-only state, and struct rfkill is opaque to drivers, so a
> caller that needs to distinguish a hardware block from a software block
> cannot do so.
> 
> Add rfkill_hard_blocked(), which reads RFKILL_BLOCK_HW under
> rfkill->lock in the same way as rfkill_soft_blocked(), together with a
> stub returning false when CONFIG_RFKILL is disabled.
> 
> The first user is the Bluetooth HCI debugfs force_hw_rfkill test hook,
> which must report and compare against the hardware state only.

Probably should CC Bluetooth list (done now) for a change that's prep
for BT infrastructure.

The user is:

https://lore.kernel.org/linux-bluetooth/af7525184b7c910d8f5bc313805ac31293711c19.1790752799.git.aluvala.sai.teja@intel.com/

which does two things with it:

 1) refuse debugfs write when it's already hw-blocked by some real hw

 2) show the rfkill's hw-blocked status in debugfs read

The tool that's intended to use the debugfs file is this:

https://lore.kernel.org/linux-bluetooth/66971d6f85d714f2728b29fada7136d5a2fbb3c2.1790752800.git.aluvala.sai.teja@intel.com/

It implicitly uses the write part by failing if the write fails, and
explicitly uses the read part by checking that it applied.

The write part could be easily checked in the tool from userspace via
rfkill sysfs (it already accesses that), and the validation against
sysfs already happens on the read as well there, so IMHO neither is
necessary - the tool could check sysfs before starting the test and
abort if it's already hw blocked before, and the debugfs read isn't
necessary at all since it reflects the exact same value as the rfkill
sysfs read, so validating both is useless.


However, if BT folks disagree with my assessment then feel free to just
merge this patch along with the user.

johannes

      reply	other threads:[~2026-09-30 11:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30  7:42 [PATCH v1 0/1] rfkill: expose hardware-only block state Sai Teja Aluvala
2026-09-30  7:42 ` [PATCH v1 1/1] rfkill: add rfkill_hard_blocked() helper Sai Teja Aluvala
2026-09-30 11:40   ` Johannes Berg [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=a612cb0f1cfc09b7ec7f494f22f8cc8d3ba61f10.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=aluvala.sai.teja@intel.com \
    --cc=chethan.tumkur.narayan@intel.com \
    --cc=kiran.k@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luiz.dentz@gmail.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