Changeset 299
- Timestamp:
- Feb 21, 2008, 7:31:22 AM (17 years ago)
- Location:
- GPL/branches/alsa-resync1/alsa-kernel
- Files:
-
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/alsa-resync1/alsa-kernel/core/makefile.os2
r246 r299 33 33 #=================================================================== 34 34 FILE1 = sound.obj init.obj memory.obj memalloc.obj sgbuf.obj 35 FILE2 = control.obj device.obj misc.obj wrappers.obj 35 FILE2 = control.obj device.obj misc.obj wrappers.obj misc_driver.obj 36 36 #FILE3 = sound_oss.obj info_oss.obj isadma.obj 37 37 FILE4 = pcm.obj pcm_native.obj pcm_lib.obj pcm_misc.obj pcm_timer.obj pcm_memory.obj -
GPL/branches/alsa-resync1/alsa-kernel/core/misc.c
r210 r299 26 26 #include <sound/core.h> 27 27 28 #ifdef TARGET_OS229 #include <linux/firmware.h>30 #endif /* TARGET_OS2 */31 32 28 int snd_task_name(struct task_struct *task, char *name, size_t size) 33 29 { … … 41 37 } 42 38 43 void destroy_workqueue(struct workqueue_struct *wq)44 {45 #if 046 flush_workqueue(wq);47 kill_proc(wq->task_pid, SIGKILL, 1);48 if (wq->task_pid >= 0)49 wait_for_completion(&wq->thread_exited);50 #endif51 kfree(wq);52 }53 54 struct workqueue_struct *create_workqueue(const char *name)55 {56 struct workqueue_struct *wq;57 58 //BUG_ON(strlen(name) > 10);59 60 wq = kmalloc(sizeof(*wq), GFP_KERNEL);61 if (!wq)62 return NULL;63 memset(wq, 0, sizeof(*wq));64 65 spin_lock_init(&wq->lock);66 INIT_LIST_HEAD(&wq->worklist);67 init_waitqueue_head(&wq->more_work);68 init_waitqueue_head(&wq->work_done);69 wq->name = name;70 #if 071 init_completion(&wq->thread_exited);72 wq->task_pid = kernel_thread(xworker_thread, wq, 0);73 if (wq->task_pid < 0) {74 printk(KERN_ERR "snd: failed to start thread %s\n", name);75 destroy_workqueue(wq);76 wq = NULL;77 }78 #endif79 return wq;80 }81 82 static void __x_queue_work(struct workqueue_struct *wq, struct work_struct *work)83 {84 unsigned long flags;85 86 spin_lock_irqsave(&wq->lock, flags);87 work->wq_data = wq;88 list_add_tail(&work->entry, &wq->worklist);89 wake_up(&wq->more_work);90 spin_unlock_irqrestore(&wq->lock, flags);91 }92 93 int queue_work(struct workqueue_struct *wq, struct work_struct *work)94 {95 if (!test_and_set_bit(0, &work->pending)) {96 __x_queue_work(wq, work);97 return 1;98 }99 return 0;100 }101 102 static void delayed_work_timer_fn(unsigned long __data)103 {104 struct work_struct *work = (struct work_struct *)__data;105 struct workqueue_struct *wq = work->wq_data;106 107 __x_queue_work(wq, work);108 }109 110 int queue_delayed_work(struct workqueue_struct *wq, struct work_struct *work, unsigned long delay)111 {112 struct timer_list *timer = &work->timer;113 114 if (!test_and_set_bit(0, &work->pending)) {115 work->wq_data = work;116 timer->expires = jiffies + delay;117 timer->data = (unsigned long)work;118 timer->function = delayed_work_timer_fn;119 add_timer(timer);120 return 1;121 }122 return 0;123 }124 39 125 40 void release_and_free_resource(struct resource *res) … … 129 44 kfree(res); 130 45 } 131 }132 133 int mod_firmware_load(const char *fn, char **fp)134 {135 return 0;136 }137 138 static int snd_try_load_firmware(const char *path, const char *name,139 struct firmware *firmware)140 {141 char filename[30 + FIRMWARE_NAME_MAX];142 143 sprintf(filename, "%s/%s", path, name);144 firmware->size = mod_firmware_load(filename, (char **)&firmware->data);145 if (firmware->size)146 printk(KERN_INFO "Loaded '%s'.", filename);147 return firmware->size;148 }149 150 int request_firmware(const struct firmware **fw, const char *name,151 struct device *device)152 {153 struct firmware *firmware;154 155 *fw = NULL;156 firmware = kmalloc(sizeof *firmware, GFP_KERNEL);157 if (!firmware)158 return -ENOMEM;159 if (!snd_try_load_firmware("/lib/firmware", name, firmware) &&160 !snd_try_load_firmware("/lib/hotplug/firmware", name, firmware) &&161 !snd_try_load_firmware("/usr/lib/hotplug/firmware", name, firmware)) {162 kfree(firmware);163 return -EIO;164 }165 *fw = firmware;166 return 0;167 }168 169 void release_firmware(const struct firmware *fw)170 {171 if (fw) {172 vfree(fw->data);173 kfree(fw);174 }175 46 } 176 47 -
GPL/branches/alsa-resync1/alsa-kernel/core/misc_driver.c
r298 r299 1 /* 2 * Misc and compatibility things 3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz> 4 * 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * 20 */ 21 1 #define __NO_VERSION__ 22 2 #include <sound/driver.h> 23 #include <linux/init.h>24 #include <linux/sched.h>25 #include <linux/time.h>26 3 #include <sound/core.h> 27 4 … … 30 7 #endif /* TARGET_OS2 */ 31 8 32 int snd_task_name(struct task_struct *task, char *name, size_t size) 33 { 34 unsigned int idx; 35 36 snd_assert(task != NULL && name != NULL && size >= 2, return -EINVAL); 37 for (idx = 0; idx < sizeof(task->comm) && idx + 1 < size; idx++) 38 name[idx] = task->comm[idx]; 39 name[idx] = '\0'; 40 return 0; 41 } 42 43 void destroy_workqueue(struct workqueue_struct *wq) 9 void snd_compat_destroy_workqueue(struct workqueue_struct *wq) 44 10 { 45 11 #if 0 46 flush_workqueue(wq);12 snd_compat_flush_workqueue(wq); 47 13 kill_proc(wq->task_pid, SIGKILL, 1); 48 14 if (wq->task_pid >= 0) … … 52 18 } 53 19 54 struct workqueue_struct * create_workqueue(const char *name)20 struct workqueue_struct *snd_compat_create_workqueue(const char *name) 55 21 { 56 22 struct workqueue_struct *wq; … … 91 57 } 92 58 93 int queue_work(struct workqueue_struct *wq, struct work_struct *work)59 int snd_compat_queue_work(struct workqueue_struct *wq, struct work_struct *work) 94 60 { 95 61 if (!test_and_set_bit(0, &work->pending)) { … … 108 74 } 109 75 110 int queue_delayed_work(struct workqueue_struct *wq, struct work_struct *work, unsigned long delay)76 int snd_compat_queue_delayed_work(struct workqueue_struct *wq, struct work_struct *work, unsigned long delay) 111 77 { 112 78 struct timer_list *timer = &work->timer; 113 79 114 80 if (!test_and_set_bit(0, &work->pending)) { 115 work->wq_data = w ork;81 work->wq_data = wq; 116 82 timer->expires = jiffies + delay; 117 83 timer->data = (unsigned long)work; … … 121 87 } 122 88 return 0; 123 }124 125 void release_and_free_resource(struct resource *res)126 {127 if (res) {128 release_resource(res);129 kfree(res);130 }131 89 } 132 90 … … 175 133 } 176 134 177 /**178 * snd_pci_quirk_lookup - look up a PCI SSID quirk list179 * @pci: pci_dev handle180 * @list: quirk list, terminated by a null entry181 *182 * Look through the given quirk list and finds a matching entry183 * with the same PCI SSID. When subdevice is 0, all subdevice184 * values may match.185 *186 * Returns the matched entry pointer, or NULL if nothing matched.187 */188 const struct snd_pci_quirk *189 snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list)190 {191 const struct snd_pci_quirk *q;192 193 for (q = list; q->subvendor; q++)194 if (q->subvendor == pci->subsystem_vendor &&195 (!q->subdevice || q->subdevice == pci->subsystem_device))196 return q;197 return NULL;198 }199 -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/adriver.h
r290 r299 213 213 typedef int irqreturn_t; 214 214 215 216 /* workqueue-alike; 2.5.45 */ 217 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) 218 #include <linux/workqueue.h> 219 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 45) && !defined(__WORK_INITIALIZER) 220 #define SND_WORKQUEUE_COMPAT 221 struct workqueue_struct; 215 222 struct work_struct { 216 223 unsigned long pending; … … 235 242 int snd_compat_schedule_work(struct work_struct *work); 236 243 #define schedule_work(w) snd_compat_schedule_work(w) 244 struct workqueue_struct *snd_compat_create_workqueue(const char *name); 245 #define create_workqueue(name) snd_compat_create_workqueue((name)) 246 void snd_compat_flush_workqueue(struct workqueue_struct *wq); 247 #define flush_workqueue(wq) snd_compat_flush_workqueue((wq)); 248 void snd_compat_destroy_workqueue(struct workqueue_struct *wq); 249 #define destroy_workqueue(wq) snd_compat_destroy_workqueue((wq)); 250 int snd_compat_queue_work(struct workqueue_struct *wq, struct work_struct *work); 251 #define queue_work(wq, work) snd_compat_queue_work((wq), (work)) 252 int snd_compat_queue_delayed_work(struct workqueue_struct *wq, struct work_struct *work, unsigned long delay); 253 #define queue_delayed_work(wq, work, delay) snd_compat_queue_delayed_work((wq), (work), (delay)) 254 #endif /* < 2.5.45 */ 255 #endif /* < 2.6.0 */ 237 256 238 257 /* 2.5 new modules */ -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/core.h
r290 r299 25 25 #include <linux/sched.h> /* wake_up() */ 26 26 #include <asm/semaphore.h> 27 #ifndef TARGET_OS2 //TODO: implement linux/rwsem.h, workqueue.h28 27 #include <linux/rwsem.h> /* struct rw_semaphore */ 29 28 #include <linux/workqueue.h> /* struct workqueue_struct */ 30 #endif /* !TARGET_OS2 */31 29 #include <sound/typedefs.h> 32 30
Note:
See TracChangeset
for help on using the changeset viewer.