summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-steam.c
diff options
context:
space:
mode:
authorVicki Pfau <vi@endrift.com>2023-12-19 19:38:34 -0800
committerJiri Kosina <jkosina@suse.com>2024-01-02 11:20:42 +0100
commit555b818adb97eca70210a49ba3f1d27882dde092 (patch)
tree7ba5c8c218b12a5dd864936447d5f269f140e55a /drivers/hid/hid-steam.c
parent691ead124a0c35e56633dbb73e43711ff3db23ef (diff)
HID: hid-steam: Make client_opened a counter
The client_opened variable was used to track if the hidraw was opened by any clients to silence keyboard/mouse events while opened. However, there was no counting of how many clients were opened, so opening two at the same time and then closing one would fool the driver into thinking it had no remaining opened clients. Signed-off-by: Vicki Pfau <vi@endrift.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'drivers/hid/hid-steam.c')
-rw-r--r--drivers/hid/hid-steam.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
index 57cb58941c9f..667b5b09f931 100644
--- a/drivers/hid/hid-steam.c
+++ b/drivers/hid/hid-steam.c
@@ -125,7 +125,7 @@ struct steam_device {
spinlock_t lock;
struct hid_device *hdev, *client_hdev;
struct mutex report_mutex;
- bool client_opened;
+ unsigned long client_opened;
struct input_dev __rcu *input;
unsigned long quirks;
struct work_struct work_connect;
@@ -648,7 +648,7 @@ static void steam_battery_unregister(struct steam_device *steam)
static int steam_register(struct steam_device *steam)
{
int ret;
- bool client_opened;
+ unsigned long client_opened;
unsigned long flags;
/*
@@ -771,7 +771,7 @@ static int steam_client_ll_open(struct hid_device *hdev)
unsigned long flags;
spin_lock_irqsave(&steam->lock, flags);
- steam->client_opened = true;
+ steam->client_opened++;
spin_unlock_irqrestore(&steam->lock, flags);
steam_input_unregister(steam);
@@ -787,7 +787,7 @@ static void steam_client_ll_close(struct hid_device *hdev)
bool connected;
spin_lock_irqsave(&steam->lock, flags);
- steam->client_opened = false;
+ steam->client_opened--;
connected = steam->connected && !steam->client_opened;
spin_unlock_irqrestore(&steam->lock, flags);
@@ -959,7 +959,7 @@ static void steam_remove(struct hid_device *hdev)
cancel_work_sync(&steam->work_connect);
hid_destroy_device(steam->client_hdev);
steam->client_hdev = NULL;
- steam->client_opened = false;
+ steam->client_opened = 0;
if (steam->quirks & STEAM_QUIRK_WIRELESS) {
hid_info(hdev, "Steam wireless receiver disconnected");
}