@@ -1586,7 +1586,7 @@ struct wiiproto_handler {
1586
1586
void (* func )(struct wiimote_data * wdata , const __u8 * payload );
1587
1587
};
1588
1588
1589
- static struct wiiproto_handler handlers [] = {
1589
+ static const struct wiiproto_handler handlers [] = {
1590
1590
{ .id = WIIPROTO_REQ_STATUS , .size = 6 , .func = handler_status },
1591
1591
{ .id = WIIPROTO_REQ_STATUS , .size = 2 , .func = handler_status_K },
1592
1592
{ .id = WIIPROTO_REQ_DATA , .size = 21 , .func = handler_data },
@@ -1618,19 +1618,19 @@ static int wiimote_hid_event(struct hid_device *hdev, struct hid_report *report,
1618
1618
u8 * raw_data , int size )
1619
1619
{
1620
1620
struct wiimote_data * wdata = hid_get_drvdata (hdev );
1621
- struct wiiproto_handler * h ;
1621
+ const struct wiiproto_handler * h ;
1622
1622
int i ;
1623
1623
unsigned long flags ;
1624
1624
1625
1625
if (size < 1 )
1626
1626
return - EINVAL ;
1627
1627
1628
- spin_lock_irqsave (& wdata -> state .lock , flags );
1629
-
1630
1628
for (i = 0 ; handlers [i ].id ; ++ i ) {
1631
1629
h = & handlers [i ];
1632
1630
if (h -> id == raw_data [0 ] && h -> size < size ) {
1631
+ spin_lock_irqsave (& wdata -> state .lock , flags );
1633
1632
h -> func (wdata , & raw_data [1 ]);
1633
+ spin_unlock_irqrestore (& wdata -> state .lock , flags );
1634
1634
break ;
1635
1635
}
1636
1636
}
@@ -1639,8 +1639,6 @@ static int wiimote_hid_event(struct hid_device *hdev, struct hid_report *report,
1639
1639
hid_warn (hdev , "Unhandled report %hhu size %d\n" , raw_data [0 ],
1640
1640
size );
1641
1641
1642
- spin_unlock_irqrestore (& wdata -> state .lock , flags );
1643
-
1644
1642
return 0 ;
1645
1643
}
1646
1644
0 commit comments