@@ -32,8 +32,6 @@ struct gb_hid {
3232 char * inbuf ;
3333};
3434
35- static DEFINE_MUTEX (gb_hid_open_mutex );
36-
3735/* Routines to get controller's information over greybus */
3836
3937/* Operations performed on greybus */
@@ -346,41 +344,28 @@ static void gb_hid_stop(struct hid_device *hid)
346344static int gb_hid_open (struct hid_device * hid )
347345{
348346 struct gb_hid * ghid = hid -> driver_data ;
349- int ret = 0 ;
350-
351- mutex_lock (& gb_hid_open_mutex );
352- if (!hid -> open ++ ) {
353- ret = gb_hid_set_power (ghid , GB_HID_TYPE_PWR_ON );
354- if (ret < 0 )
355- hid -> open -- ;
356- else
357- set_bit (GB_HID_STARTED , & ghid -> flags );
358- }
359- mutex_unlock (& gb_hid_open_mutex );
347+ int ret ;
360348
361- return ret ;
349+ ret = gb_hid_set_power (ghid , GB_HID_TYPE_PWR_ON );
350+ if (ret < 0 )
351+ return ret ;
352+
353+ set_bit (GB_HID_STARTED , & ghid -> flags );
354+ return 0 ;
362355}
363356
364357static void gb_hid_close (struct hid_device * hid )
365358{
366359 struct gb_hid * ghid = hid -> driver_data ;
367360 int ret ;
368361
369- /*
370- * Protecting hid->open to make sure we don't restart data acquistion
371- * due to a resumption we no longer care about..
372- */
373- mutex_lock (& gb_hid_open_mutex );
374- if (!-- hid -> open ) {
375- clear_bit (GB_HID_STARTED , & ghid -> flags );
376-
377- /* Save some power */
378- ret = gb_hid_set_power (ghid , GB_HID_TYPE_PWR_OFF );
379- if (ret )
380- dev_err (& ghid -> connection -> bundle -> dev ,
381- "failed to power off (%d)\n" , ret );
382- }
383- mutex_unlock (& gb_hid_open_mutex );
362+ clear_bit (GB_HID_STARTED , & ghid -> flags );
363+
364+ /* Save some power */
365+ ret = gb_hid_set_power (ghid , GB_HID_TYPE_PWR_OFF );
366+ if (ret )
367+ dev_err (& ghid -> connection -> bundle -> dev ,
368+ "failed to power off (%d)\n" , ret );
384369}
385370
386371static int gb_hid_power (struct hid_device * hid , int lvl )
0 commit comments