Lines Matching +full:lock +full:- +full:state
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (c) 2011-2013 David Herrmann <dh.herrmann@gmail.com>
15 #include "hid-wiimote.h"
26 struct wiimote_debug *dbg = f->private_data; in wiidebug_eeprom_read()
27 struct wiimote_data *wdata = dbg->wdata; in wiidebug_eeprom_read()
34 return -EINVAL; in wiidebug_eeprom_read()
44 spin_lock_irqsave(&wdata->state.lock, flags); in wiidebug_eeprom_read()
45 wdata->state.cmd_read_size = s; in wiidebug_eeprom_read()
46 wdata->state.cmd_read_buf = buf; in wiidebug_eeprom_read()
49 spin_unlock_irqrestore(&wdata->state.lock, flags); in wiidebug_eeprom_read()
53 size = wdata->state.cmd_read_size; in wiidebug_eeprom_read()
55 spin_lock_irqsave(&wdata->state.lock, flags); in wiidebug_eeprom_read()
56 wdata->state.cmd_read_buf = NULL; in wiidebug_eeprom_read()
57 spin_unlock_irqrestore(&wdata->state.lock, flags); in wiidebug_eeprom_read()
64 return -EIO; in wiidebug_eeprom_read()
67 return -EFAULT; in wiidebug_eeprom_read()
100 struct wiimote_debug *dbg = f->private; in wiidebug_drm_show()
105 spin_lock_irqsave(&dbg->wdata->state.lock, flags); in wiidebug_drm_show()
106 drm = dbg->wdata->state.drm; in wiidebug_drm_show()
107 spin_unlock_irqrestore(&dbg->wdata->state.lock, flags); in wiidebug_drm_show()
121 return single_open(f, wiidebug_drm_show, i->i_private); in wiidebug_drm_open()
127 struct seq_file *sf = f->private_data; in wiidebug_drm_write()
128 struct wiimote_debug *dbg = sf->private; in wiidebug_drm_write()
135 return -EINVAL; in wiidebug_drm_write()
139 return -EFAULT; in wiidebug_drm_write()
153 spin_lock_irqsave(&dbg->wdata->state.lock, flags); in wiidebug_drm_write()
154 dbg->wdata->state.flags &= ~WIIPROTO_FLAG_DRM_LOCKED; in wiidebug_drm_write()
155 wiiproto_req_drm(dbg->wdata, (__u8) i); in wiidebug_drm_write()
157 dbg->wdata->state.flags |= WIIPROTO_FLAG_DRM_LOCKED; in wiidebug_drm_write()
158 spin_unlock_irqrestore(&dbg->wdata->state.lock, flags); in wiidebug_drm_write()
179 return -ENOMEM; in wiidebug_init()
181 dbg->wdata = wdata; in wiidebug_init()
183 dbg->eeprom = debugfs_create_file("eeprom", S_IRUSR, in wiidebug_init()
184 dbg->wdata->hdev->debug_dir, dbg, &wiidebug_eeprom_fops); in wiidebug_init()
186 dbg->drm = debugfs_create_file("drm", S_IRUSR, in wiidebug_init()
187 dbg->wdata->hdev->debug_dir, dbg, &wiidebug_drm_fops); in wiidebug_init()
189 spin_lock_irqsave(&wdata->state.lock, flags); in wiidebug_init()
190 wdata->debug = dbg; in wiidebug_init()
191 spin_unlock_irqrestore(&wdata->state.lock, flags); in wiidebug_init()
199 struct wiimote_debug *dbg = wdata->debug; in wiidebug_deinit()
205 spin_lock_irqsave(&wdata->state.lock, flags); in wiidebug_deinit()
206 wdata->debug = NULL; in wiidebug_deinit()
207 spin_unlock_irqrestore(&wdata->state.lock, flags); in wiidebug_deinit()
209 debugfs_remove(dbg->drm); in wiidebug_deinit()
210 debugfs_remove(dbg->eeprom); in wiidebug_deinit()