/* * Copyright (c) by Jaroslav Kysela * DRAM access routines * * * 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 * */ #include #include #include #include static int snd_gus_dram_poke(struct snd_gus_card *gus, char __user *_buffer, unsigned int address, unsigned int size) { unsigned long flags; unsigned int size1, size2; char buffer[256], *pbuffer; while (size > 0) { size1 = size > sizeof(buffer) ? sizeof(buffer) : size; if (copy_from_user(buffer, _buffer, size1)) return -EFAULT; if (gus->interwave) { spin_lock_irqsave(&gus->reg_lock, flags); snd_gf1_write8(gus, SNDRV_GF1_GB_MEMORY_CONTROL, 0x01); snd_gf1_dram_addr(gus, address); outsb(GUSP(gus, DRAM), buffer, size1); spin_unlock_irqrestore(&gus->reg_lock, flags); address += size1; } else { pbuffer = buffer; size2 = size1; while (size2--) snd_gf1_poke(gus, address++, *pbuffer++); } size -= size1; _buffer += size1; } return 0; } int snd_gus_dram_write(struct snd_gus_card *gus, char __user *buffer, unsigned int address, unsigned int size) { return snd_gus_dram_poke(gus, buffer, address, size); } static int snd_gus_dram_peek(struct snd_gus_card *gus, char __user *_buffer, unsigned int address, unsigned int size, int rom) { unsigned long flags; unsigned int size1, size2; char buffer[256], *pbuffer; while (size > 0) { size1 = size > sizeof(buffer) ? sizeof(buffer) : size; if (gus->interwave) { spin_lock_irqsave(&gus->reg_lock, flags); snd_gf1_write8(gus, SNDRV_GF1_GB_MEMORY_CONTROL, rom ? 0x03 : 0x01); snd_gf1_dram_addr(gus, address); insb(GUSP(gus, DRAM), buffer, size1); snd_gf1_write8(gus, SNDRV_GF1_GB_MEMORY_CONTROL, 0x01); spin_unlock_irqrestore(&gus->reg_lock, flags); address += size1; } else { pbuffer = buffer; size2 = size1; while (size2--) *pbuffer++ = snd_gf1_peek(gus, address++); } if (copy_to_user(_buffer, buffer, size1)) return -EFAULT; size -= size1; _buffer += size1; } return 0; } int snd_gus_dram_read(struct snd_gus_card *gus, char __user *buffer, unsigned int address, unsigned int size, int rom) { return snd_gus_dram_peek(gus, buffer, address, size, rom); } b0c'>root/tools/testing/selftests/powerpc/ptrace/ptrace-tm-gpr.c
diff options
context:
space:
mode:
authorManuel Lauss <manuel.lauss@gmail.com>2017-01-24 10:12:00 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-01-24 10:27:34 -0800
commit3f5c34c6d4688b3b7e1dbc7bbc68a2f03a0d6b0c (patch)
treeb9387d85890c4466d9cf3d3145c95e0b07235234 /tools/testing/selftests/powerpc/ptrace/ptrace-tm-gpr.c
parent62ed8ceda1699acae01b666497f004bfd3d67a6f (diff)
Input: wm97xx - make missing platform data non-fatal
Commit 6480af4915d6 ("power_supply: wm97xx_battery: use power_supply_get_drvdata") made wm97xx platform data mandatory, although it's still optional. This patch fixes an oops during driver probe on one of my MIPS boards with a wm9712. Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> Reviewed-by: Robert Jarzmik <robert.jarzmik@free.fr> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'tools/testing/selftests/powerpc/ptrace/ptrace-tm-gpr.c')