aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/oss/cmpci.c2
-rw-r--r--sound/oss/sonicvibes.c18
-rw-r--r--sound/oss/vwsnd.c40
3 files changed, 20 insertions, 40 deletions
diff --git a/sound/oss/cmpci.c b/sound/oss/cmpci.c
index 1fbd5137f6d7..de60a059ff5f 100644
--- a/sound/oss/cmpci.c
+++ b/sound/oss/cmpci.c
@@ -1713,7 +1713,7 @@ static int mixer_ioctl(struct cm_state *s, unsigned int cmd, unsigned long arg)
1713 case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ 1713 case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
1714 if (get_user(val, p)) 1714 if (get_user(val, p))
1715 return -EFAULT; 1715 return -EFAULT;
1716 i = generic_hweight32(val); 1716 i = hweight32(val);
1717 for (j = i = 0; i < SOUND_MIXER_NRDEVICES; i++) { 1717 for (j = i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
1718 if (!(val & (1 << i))) 1718 if (!(val & (1 << i)))
1719 continue; 1719 continue;
diff --git a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c
index 69a4b8778b51..4471757b7985 100644
--- a/sound/oss/sonicvibes.c
+++ b/sound/oss/sonicvibes.c
@@ -407,24 +407,6 @@ static inline unsigned ld2(unsigned int x)
407 return r; 407 return r;
408} 408}
409 409
410/*
411 * hweightN: returns the hamming weight (i.e. the number
412 * of bits set) of a N-bit word
413 */
414
415#ifdef hweight32
416#undef hweight32
417#endif
418
419static inline unsigned int hweight32(unsigned int w)
420{
421 unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
422 res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
423 res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
424 res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
425 return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
426}
427
428/* --------------------------------------------------------------------- */ 410/* --------------------------------------------------------------------- */
429 411
430/* 412/*
diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c
index b372e88e857f..5f140c7586b3 100644
--- a/sound/oss/vwsnd.c
+++ b/sound/oss/vwsnd.c
@@ -248,27 +248,6 @@ typedef struct lithium {
248} lithium_t; 248} lithium_t;
249 249
250/* 250/*
251 * li_create initializes the lithium_t structure and sets up vm mappings
252 * to access the registers.
253 * Returns 0 on success, -errno on failure.
254 */
255
256static int __init li_create(lithium_t *lith, unsigned long baseaddr)
257{
258 static void li_destroy(lithium_t *);
259
260 spin_lock_init(&lith->lock);
261 lith->page0 = ioremap_nocache(baseaddr + LI_PAGE0_OFFSET, PAGE_SIZE);
262 lith->page1 = ioremap_nocache(baseaddr + LI_PAGE1_OFFSET, PAGE_SIZE);
263 lith->page2 = ioremap_nocache(baseaddr + LI_PAGE2_OFFSET, PAGE_SIZE);
264 if (!lith->page0 || !lith->page1 || !lith->page2) {
265 li_destroy(lith);
266 return -ENOMEM;
267 }
268 return 0;
269}
270
271/*
272 * li_destroy destroys the lithium_t structure and vm mappings. 251 * li_destroy destroys the lithium_t structure and vm mappings.
273 */ 252 */
274 253
@@ -289,6 +268,25 @@ static void li_destroy(lithium_t *lith)
289} 268}
290 269
291/* 270/*
271 * li_create initializes the lithium_t structure and sets up vm mappings
272 * to access the registers.
273 * Returns 0 on success, -errno on failure.
274 */
275
276static int __init li_create(lithium_t *lith, unsigned long baseaddr)
277{
278 spin_lock_init(&lith->lock);
279 lith->page0 = ioremap_nocache(baseaddr + LI_PAGE0_OFFSET, PAGE_SIZE);
280 lith->page1 = ioremap_nocache(baseaddr + LI_PAGE1_OFFSET, PAGE_SIZE);
281 lith->page2 = ioremap_nocache(baseaddr + LI_PAGE2_OFFSET, PAGE_SIZE);
282 if (!lith->page0 || !lith->page1 || !lith->page2) {
283 li_destroy(lith);
284 return -ENOMEM;
285 }
286 return 0;
287}
288
289/*
292 * basic register accessors - read/write long/byte 290 * basic register accessors - read/write long/byte
293 */ 291 */
294 292