/* * Manuel Jander. * * Based on the work of: * Vojtech Pavlik * Raymond Ingles * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * * Based 90% on Vojtech Pavlik pcigame driver. * Merged and modified by Manuel Jander, for the OpenVortex * driver. (email: mjander@embedded.cl). */ #include #include #include #include #include "au88x0.h" #include #include #if IS_REACHABLE(CONFIG_GAMEPORT) #define VORTEX_GAME_DWAIT 20 /* 20 ms */ static unsigned char vortex_game_read(struct gameport *gameport) { vortex_t *vortex = gameport_get_port_data(gameport); return hwread(vortex->mmio, VORTEX_GAME_LEGACY); } static void vortex_game_trigger(struct gameport *gameport) { vortex_t *vortex = gameport_get_port_data(gameport); hwwrite(vortex->mmio, VORTEX_GAME_LEGACY, 0xff); } static int vortex_game_cooked_read(struct gameport *gameport, int *axes, int *buttons) { vortex_t *vortex = gameport_get_port_data(gameport); int i; *buttons = (~hwread(vortex->mmio, VORTEX_GAME_LEGACY) >> 4) & 0xf; for (i = 0; i < 4; i++) { axes[i] = hwread(vortex->mmio, VORTEX_GAME_AXIS + (i * AXIS_SIZE)); if (axes[i] == AXIS_RANGE) axes[i] = -1; } return 0; } static int vortex_game_open(struct gameport *gameport, int mode) { vortex_t *vortex = gameport_get_port_data(gameport); switch (mode) { case GAMEPORT_MODE_COOKED: hwwrite(vortex->mmio, VORTEX_CTRL2, hwread(vortex->mmio, VORTEX_CTRL2) | CTRL2_GAME_ADCMODE); msleep(VORTEX_GAME_DWAIT); return 0; case GAMEPORT_MODE_RAW: hwwrite(vortex->mmio, VORTEX_CTRL2, hwread(vortex->mmio, VORTEX_CTRL2) & ~CTRL2_GAME_ADCMODE); return 0; default: return -1; } return 0; } static int vortex_gameport_register(vortex_t *vortex) { struct gameport *gp; vortex->gameport = gp = gameport_allocate_port(); if (!gp) { dev_err(vortex->card->dev, "cannot allocate memory for gameport\n"); return -ENOMEM; } gameport_set_name(gp, "AU88x0 Gameport"); gameport_set_phys(gp, "pci%s/gameport0", pci_name(vortex->pci_dev)); gameport_set_dev_parent(gp, &vortex->pci_dev->dev); gp->read = vortex_game_read; gp->trigger = vortex_game_trigger; gp->cooked_read = vortex_game_cooked_read; gp->open = vortex_game_open; gameport_set_port_data(gp, vortex); gp->fuzz = 64; gameport_register_port(gp); return 0; } static void vortex_gameport_unregister(vortex_t * vortex) { if (vortex->gameport) { gameport_unregister_port(vortex->gameport); vortex->gameport = NULL; } } #else static inline int vortex_gameport_register(vortex_t * vortex) { return -ENOSYS; } static inline void vortex_gameport_unregister(vortex_t * vortex) { } #endif e='context' onchange='this.form.submit();'>space:mode:
authorThomas Gleixner <tglx@linutronix.de>2017-01-31 09:37:34 +0100
committerThomas Gleixner <tglx@linutronix.de>2017-01-31 21:47:58 +0100
commit0becc0ae5b42828785b589f686725ff5bc3b9b25 (patch)
treebe6d0e1f37c38ed0a7dd5da2d4b1e93f0fb43101 /drivers/usb/serial/keyspan_usa26msg.h
parent24c2503255d35c269b67162c397a1a1c1e02f6ce (diff)
x86/mce: Make timer handling more robust
Erik reported that on a preproduction hardware a CMCI storm triggers the BUG_ON in add_timer_on(). The reason is that the per CPU MCE timer is started by the CMCI logic before the MCE CPU hotplug callback starts the timer with add_timer_on(). So the timer is already queued which triggers the BUG. Using add_timer_on() is pretty pointless in this code because the timer is strictlty per CPU, initialized as pinned and all operations which arm the timer happen on the CPU to which the timer belongs. Simplify the whole machinery by using mod_timer() instead of add_timer_on() which avoids the problem because mod_timer() can handle already queued timers. Use __start_timer() everywhere so the earliest armed expiry time is preserved. Reported-by: Erik Veijola <erik.veijola@intel.com> Tested-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Borislav Petkov <bp@alien8.de> Cc: Tony Luck <tony.luck@intel.com> Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1701310936080.3457@nanos Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/usb/serial/keyspan_usa26msg.h')