pcsp.c (6bd0dd5f0ec67f654ebf95be8ef414afae1eecb7) pcsp.c (45203832df2fa9e94ca0a249ddb20d2b077e58cc)
1/*
2 * PC-Speaker driver for Linux
3 *
4 * Copyright (C) 1997-2001 David Woodhouse
5 * Copyright (C) 2001-2008 Stas Sergeev
6 */
7
8#include <linux/init.h>

--- 43 unchanged lines hidden (view full) ---

52 return -EIO;
53 }
54
55 if (loops_per_jiffy >= PCSP_MIN_LPJ && tp.tv_nsec <= PCSP_MIN_PERIOD_NS)
56 min_div = MIN_DIV;
57 else
58 min_div = MAX_DIV;
59#if PCSP_DEBUG
1/*
2 * PC-Speaker driver for Linux
3 *
4 * Copyright (C) 1997-2001 David Woodhouse
5 * Copyright (C) 2001-2008 Stas Sergeev
6 */
7
8#include <linux/init.h>

--- 43 unchanged lines hidden (view full) ---

52 return -EIO;
53 }
54
55 if (loops_per_jiffy >= PCSP_MIN_LPJ && tp.tv_nsec <= PCSP_MIN_PERIOD_NS)
56 min_div = MIN_DIV;
57 else
58 min_div = MAX_DIV;
59#if PCSP_DEBUG
60 printk("PCSP: lpj=%li, min_div=%i, res=%li\n",
60 printk(KERN_DEBUG "PCSP: lpj=%li, min_div=%i, res=%li\n",
61 loops_per_jiffy, min_div, tp.tv_nsec);
62#endif
63
64 div = MAX_DIV / min_div;
65 order = fls(div) - 1;
66
67 pcsp_chip.max_treble = min(order, PCSP_MAX_TREBLE);
68 pcsp_chip.treble = min(pcsp_chip.max_treble, PCSP_DEFAULT_TREBLE);

--- 24 unchanged lines hidden (view full) ---

93 int err;
94
95 if (devnum != 0)
96 return -EINVAL;
97
98 hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
99 pcsp_chip.timer.function = pcsp_do_timer;
100
61 loops_per_jiffy, min_div, tp.tv_nsec);
62#endif
63
64 div = MAX_DIV / min_div;
65 order = fls(div) - 1;
66
67 pcsp_chip.max_treble = min(order, PCSP_MAX_TREBLE);
68 pcsp_chip.treble = min(pcsp_chip.max_treble, PCSP_DEFAULT_TREBLE);

--- 24 unchanged lines hidden (view full) ---

93 int err;
94
95 if (devnum != 0)
96 return -EINVAL;
97
98 hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
99 pcsp_chip.timer.function = pcsp_do_timer;
100
101 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
102 if (err < 0)
103 return err;
101 card = snd_card_new(index, id, THIS_MODULE, 0);
102 if (!card)
103 return -ENOMEM;
104
105 err = snd_pcsp_create(card);
106 if (err < 0) {
107 snd_card_free(card);
108 return err;
109 }
110 err = snd_pcsp_new_pcm(&pcsp_chip);
111 if (err < 0) {

--- 125 unchanged lines hidden ---
104
105 err = snd_pcsp_create(card);
106 if (err < 0) {
107 snd_card_free(card);
108 return err;
109 }
110 err = snd_pcsp_new_pcm(&pcsp_chip);
111 if (err < 0) {

--- 125 unchanged lines hidden ---