Skip to contentSkip to conversation

HID: sony: Fix uninitialized spinlocks

PATCH In review Frank Praznik 3 participants 3 messages Feb 23, 2015 – Feb 27, 2015 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: sony: Fix uninitialized spinlocks

---
 drivers/hid/hid-sony.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-sony.c +3 -1
index 9e0987d..27f67e7 100644
@@ -805,7 +805,7 @@ union sixaxis_output_report_01 {
 #define SIXAXIS_REPORT_0xF2_SIZE 17
 #define SIXAXIS_REPORT_0xF5_SIZE 8
 
-static spinlock_t sony_dev_list_lock;
+static DEFINE_SPINLOCK(sony_dev_list_lock);
 static LIST_HEAD(sony_device_list);
 static DEFINE_IDA(sony_device_id_allocator);
 
@@ -1965,6 +1965,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		return -ENOMEM;
 	}
 
+	spin_lock_init(&sc->lock);
+
 	sc->quirks = quirks;
 	hid_set_drvdata(hdev, sc);
 	sc->hdev = hdev;
Signature · 1 line
2.1.0
#1 lore raw
Quoted 10 lines · Frank Praznik
---
 drivers/hid/hid-sony.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-sony.c +0 -0
index 9e0987d..27f67e7 100644

drivers/hid/hid-sony.c union sixaxis_output_report_01 { · line 810

Quoted 7 lines
drivers/hid/hid-sony.c +1 -1
@@ -805,7 +805,7 @@ union sixaxis_output_report_01 {
 #define SIXAXIS_REPORT_0xF2_SIZE 17
 #define SIXAXIS_REPORT_0xF5_SIZE 8
 
-static spinlock_t sony_dev_list_lock;
+static DEFINE_SPINLOCK(sony_dev_list_lock);
 static LIST_HEAD(sony_device_list);
 static DEFINE_IDA(sony_device_id_allocator);

This hunk was already in my tree from earlier today.

drivers/hid/hid-sony.c static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) · line 1972

Quoted 10 lines
drivers/hid/hid-sony.c +2 -0
@@ -1965,6 +1965,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		return -ENOMEM;
 	}
 
+	spin_lock_init(&sc->lock);
+
 	sc->quirks = quirks;
 	hid_set_drvdata(hdev, sc);
 	sc->hdev = hdev;

I have applied this one from your patch. I have also added a bit of changelog.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
Acked-by
#2 lore raw
Quoted 27 lines · Jiri Kosina
Quoted 10 lines · Frank Praznik
---
 drivers/hid/hid-sony.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-sony.c +0 -0
index 9e0987d..27f67e7 100644

drivers/hid/hid-sony.c union sixaxis_output_report_01 { · line 810

Quoted 7 lines
drivers/hid/hid-sony.c +1 -1
@@ -805,7 +805,7 @@ union sixaxis_output_report_01 {
 #define SIXAXIS_REPORT_0xF2_SIZE 17
 #define SIXAXIS_REPORT_0xF5_SIZE 8
 
-static spinlock_t sony_dev_list_lock;
+static DEFINE_SPINLOCK(sony_dev_list_lock);
 static LIST_HEAD(sony_device_list);
 static DEFINE_IDA(sony_device_id_allocator);

This hunk was already in my tree from earlier today.

Quoted 5 lines
drivers/hid/hid-sony.c +0 -0
@@ -1965,6 +1965,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		return -ENOMEM;
 	}
 
Quoted 8 lines

drivers/hid/hid-sony.c static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) · line 1972

Quoted 5 lines
drivers/hid/hid-sony.c +2 -0
+	spin_lock_init(&sc->lock);
+
 	sc->quirks = quirks;
 	hid_set_drvdata(hdev, sc);
 	sc->hdev = hdev;

I have applied this one from your patch. I have also added a bit of changelog.

I should be able to test it on monday, but I guess that patch is so simple that it is not really required...?

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html