Skip to contentSkip to conversation

rfkill: fix rfkill_set_states() to set the hw state

PATCH In review Alan Jenkins 2 participants 2 messages Jul 12, 2009 – Jul 13, 2009 Rfkill

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rfkill: fix rfkill_set_states() to set the hw state

The point of this function is to set the software and hardware state at the same time. When I tried to use it, I found it was only setting the software state.

---
net/rfkill/core.c | 4 ++++

1 files changed, 4 insertions(+), 0 deletions(-)
net/rfkill/core.c +0 -0
index 79693fe..db9948e 100644
@@ -549,6 +549,10 @@ void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw)
	swprev = !!(rfkill->state & RFKILL_BLOCK_SW);
	hwprev = !!(rfkill->state & RFKILL_BLOCK_HW);
	__rfkill_set_sw_state(rfkill, sw);

+ if (hw)
+ rfkill->state |= RFKILL_BLOCK_HW;
+ else
+ rfkill->state &= ~RFKILL_BLOCK_HW;

	spin_unlock_irqrestore(&rfkill->lock, flags);
Signature · 1 line
1.5.4.3
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Alan Jenkins

The point of this function is to set the software and hardware state at the same time. When I tried to use it, I found it was only setting the software state.

Oops, thanks.

This is for 2.6.31, obviously.

Quoted 21 lines

---
net/rfkill/core.c | 4 ++++

1 files changed, 4 insertions(+), 0 deletions(-)
net/rfkill/core.c +4 -0
index 79693fe..db9948e 100644
@@ -549,6 +549,10 @@ void rfkill_set_states(struct rfkill *rfkill, bool 
 sw, bool hw)
 	swprev = !!(rfkill->state & RFKILL_BLOCK_SW);
 	hwprev = !!(rfkill->state & RFKILL_BLOCK_HW);
 	__rfkill_set_sw_state(rfkill, sw);
+	if (hw)
+		rfkill->state |= RFKILL_BLOCK_HW;
+	else
+		rfkill->state &= ~RFKILL_BLOCK_HW;
 
 	spin_unlock_irqrestore(&rfkill->lock, flags);