[alsa-devel] [PATCH 0/6] Misc ALSA changes, documentation, style
From: Antonio Ospite ao2@amarulasolutions.com
Hi,
here are some fixes for things I noticed while studying ALSA.
I'd like some feedback especially on patch 1. Patches 2 and 3 are documentation fixes. Patches 4, 5 and 6, are basically style fixes.
Feel free to discard patch 6 if you find it too invasive, it's just cosmetics but some maintainers don't like big style changes even if they are in the "right" direction. I don't know alsa devs' position about that.
I am sending the whole series to alsa-devel and CCing topic specific mailing lists or developers on a per-patch basis.
Thanks, Antonio
Antonio Ospite (6): Force a cast to silence a warning from "sparse" Documentation/DocBook/writing-an-alsa-driver.tmpl: fix some thinkos Documentation/DocBook/writing-an-alsa-driver.tmpl: fix some typos sound/usb/caiaq/device.c: fix use of MODULE_SUPPORTED_DEVICES() sound/usb/card.c: cosmetics, remove a leading space sound/core/pcm_native.c: cosmetics, fix use of spaces
Documentation/DocBook/writing-an-alsa-driver.tmpl | 11 +- include/sound/memalloc.h | 2 +- sound/core/pcm_native.c | 120 ++++++++++----------- sound/usb/caiaq/device.c | 8 +- sound/usb/card.c | 2 +- 5 files changed, 71 insertions(+), 72 deletions(-)
From: Antonio Ospite ao2@amarulasolutions.com
Some audio drivers are calling snd_dma_continuous_data(GFP_KERNEL) which makes "sparse" give a warning:
$ make C=2 M=sound/usb modules ... sound/usb/6fire/pcm.c:625:25: warning: cast from restricted gfp_t sound/usb/caiaq/audio.c:845:41: warning: cast from restricted gfp_t sound/usb/usx2y/usbusx2yaudio.c:997:54: warning: cast from restricted gfp_t sound/usb/usx2y/usbusx2yaudio.c:1001:54: warning: cast from restricted gfp_t sound/usb/usx2y/usx2yhwdeppcm.c:774:54: warning: cast from restricted gfp_t sound/usb/usx2y/usx2yhwdeppcm.c:778:54: warning: cast from restricted gfp_t
Add __force to the cast to silence the warning.
Signed-off-by: Antonio Ospite ao2@amarulasolutions.com ---
CCing linux-kernel on just this patch of the series as there may be comments about this practice of forcing casts.
Regards, Antonio
include/sound/memalloc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h index 844af65..cf15b82 100644 --- a/include/sound/memalloc.h +++ b/include/sound/memalloc.h @@ -37,7 +37,7 @@ struct snd_dma_device { #ifndef snd_dma_pci_data #define snd_dma_pci_data(pci) (&(pci)->dev) #define snd_dma_isa_data() NULL -#define snd_dma_continuous_data(x) ((struct device *)(unsigned long)(x)) +#define snd_dma_continuous_data(x) ((struct device *)(__force unsigned long)(x)) #endif
From: Antonio Ospite ao2@amarulasolutions.com
Signed-off-by: Antonio Ospite ao2@amarulasolutions.com --- Documentation/DocBook/writing-an-alsa-driver.tmpl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/Documentation/DocBook/writing-an-alsa-driver.tmpl b/Documentation/DocBook/writing-an-alsa-driver.tmpl index fb32aea..da2f443 100644 --- a/Documentation/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/DocBook/writing-an-alsa-driver.tmpl @@ -871,9 +871,8 @@ <para> This function itself doesn't allocate the data space. The data must be allocated manually beforehand, and its pointer is passed - as the argument. This pointer is used as the - (<parameter>chip</parameter> identifier in the above example) - for the instance. + as the argument. This pointer (<parameter>chip</parameter> in the + above example) is used as the identifier for the instance. </para>
<para> @@ -2304,7 +2303,7 @@ struct _snd_pcm_runtime { <constant>SNDRV_PCM_INFO_XXX</constant>. Here, at least, you have to specify whether the mmap is supported and which interleaved format is supported. - When the is supported, add the + When the hardware supports mmap, add the <constant>SNDRV_PCM_INFO_MMAP</constant> flag here. When the hardware supports the interleaved or the non-interleaved formats, <constant>SNDRV_PCM_INFO_INTERLEAVED</constant> or
From: Antonio Ospite ao2@amarulasolutions.com
s/PAUSE_PUSE/PAUSE_PUSH/ s/happense/happens/
Signed-off-by: Antonio Ospite ao2@amarulasolutions.com --- Documentation/DocBook/writing-an-alsa-driver.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/DocBook/writing-an-alsa-driver.tmpl b/Documentation/DocBook/writing-an-alsa-driver.tmpl index da2f443..c0781bb 100644 --- a/Documentation/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/DocBook/writing-an-alsa-driver.tmpl @@ -2897,7 +2897,7 @@ struct _snd_pcm_runtime {
<para> When the pcm supports the pause operation (given in the info - field of the hardware table), the <constant>PAUSE_PUSE</constant> + field of the hardware table), the <constant>PAUSE_PUSH</constant> and <constant>PAUSE_RELEASE</constant> commands must be handled here, too. The former is the command to pause the pcm, and the latter to restart the pcm again. @@ -3084,7 +3084,7 @@ struct _snd_pcm_runtime { <section id="pcm-interface-interrupt-handler-timer"> <title>High frequency timer interrupts</title> <para> - This happense when the hardware doesn't generate interrupts + This happens when the hardware doesn't generate interrupts at the period boundary but issues timer interrupts at a fixed timer rate (e.g. es1968 or ymfpci drivers). In this case, you need to check the current hardware
From: Antonio Ospite ao2@amarulasolutions.com
It looks like MODULE_SUPPORTED_DEVICES() is not implemented yet, but still, having the entries in the list consistently separated by commas and with balanced parenthesis won't hurt.
Signed-off-by: Antonio Ospite ao2@amarulasolutions.com --- sound/usb/caiaq/device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c index c828f81..e4d6dbb 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c @@ -48,10 +48,10 @@ MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," "{Native Instruments, Audio 8 DJ}," "{Native Instruments, Traktor Audio 2}," "{Native Instruments, Session I/O}," - "{Native Instruments, GuitarRig mobile}" - "{Native Instruments, Traktor Kontrol X1}" - "{Native Instruments, Traktor Kontrol S4}" - "{Native Instruments, Maschine Controller}"); + "{Native Instruments, GuitarRig mobile}," + "{Native Instruments, Traktor Kontrol X1}," + "{Native Instruments, Traktor Kontrol S4}," + "{Native Instruments, Maschine Controller}}");
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */
Antonio Ospite ospite@studenti.unina.it wrote:
From: Antonio Ospite ao2@amarulasolutions.com
It looks like MODULE_SUPPORTED_DEVICES() is not implemented yet, but still, having the entries in the list consistently separated by commas and with balanced parenthesis won't hurt.
Signed-off-by: Antonio Ospite ao2@amarulasolutions.com
Acked-by: Daniel Mack zonque@gmail.com
Thanks!
sound/usb/caiaq/device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c index c828f81..e4d6dbb 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c @@ -48,10 +48,10 @@ MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," "{Native Instruments, Audio 8 DJ}," "{Native Instruments, Traktor Audio 2}," "{Native Instruments, Session I/O},"
"{Native Instruments, GuitarRig mobile}"
"{Native Instruments, Traktor Kontrol X1}"
"{Native Instruments, Traktor Kontrol S4}"
"{Native Instruments, Maschine Controller}");
"{Native Instruments, GuitarRig mobile},"
"{Native Instruments, Traktor Kontrol X1},"
"{Native Instruments, Traktor Kontrol S4},"
"{Native Instruments, Maschine Controller}}");
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */
At Tue, 29 Jan 2013 07:33:53 +0800, Daniel Mack wrote:
Antonio Ospite ospite@studenti.unina.it wrote:
From: Antonio Ospite ao2@amarulasolutions.com
It looks like MODULE_SUPPORTED_DEVICES() is not implemented yet, but still, having the entries in the list consistently separated by commas and with balanced parenthesis won't hurt.
Signed-off-by: Antonio Ospite ao2@amarulasolutions.com
Acked-by: Daniel Mack zonque@gmail.com
The patches didn't reach me, possibly because of a problem of my server I've hit in this morning.
Antonio, could you repost the patch to me (and add Daniels' ack)?
thanks,
Takashi
On Tue, 29 Jan 2013 08:33:29 +0100 Takashi Iwai tiwai@suse.de wrote:
At Tue, 29 Jan 2013 07:33:53 +0800, Daniel Mack wrote:
Antonio Ospite ospite@studenti.unina.it wrote:
From: Antonio Ospite ao2@amarulasolutions.com
It looks like MODULE_SUPPORTED_DEVICES() is not implemented yet, but still, having the entries in the list consistently separated by commas and with balanced parenthesis won't hurt.
Signed-off-by: Antonio Ospite ao2@amarulasolutions.com
Acked-by: Daniel Mack zonque@gmail.com
The patches didn't reach me, possibly because of a problem of my server I've hit in this morning.
Antonio, could you repost the patch to me (and add Daniels' ack)?
I will, I guess you missed the other patches in the same series as well? Should I re-send all of them to you only?
Just for the record, in cases like this I'd import MBOX data from mailing list archives[1] and remove duplicate messages in my email client (Sylpheed). This way Message-IDs are intact and threads won't be broken on reply.
Regards, Antonio
[1] http://mailman.alsa-project.org/pipermail/alsa-devel/2013-January.txt.gz
At Tue, 29 Jan 2013 11:08:33 +0100, Antonio Ospite wrote:
On Tue, 29 Jan 2013 08:33:29 +0100 Takashi Iwai tiwai@suse.de wrote:
At Tue, 29 Jan 2013 07:33:53 +0800, Daniel Mack wrote:
Antonio Ospite ospite@studenti.unina.it wrote:
From: Antonio Ospite ao2@amarulasolutions.com
It looks like MODULE_SUPPORTED_DEVICES() is not implemented yet, but still, having the entries in the list consistently separated by commas and with balanced parenthesis won't hurt.
Signed-off-by: Antonio Ospite ao2@amarulasolutions.com
Acked-by: Daniel Mack zonque@gmail.com
The patches didn't reach me, possibly because of a problem of my server I've hit in this morning.
Antonio, could you repost the patch to me (and add Daniels' ack)?
I will, I guess you missed the other patches in the same series as well? Should I re-send all of them to you only?
Yes. You don't have to resend to ML in this case. (BTW, did you add me to Cc in the original posts?)
Just for the record, in cases like this I'd import MBOX data from mailing list archives[1] and remove duplicate messages in my email client (Sylpheed). This way Message-IDs are intact and threads won't be broken on reply.
That's fine.
thanks,
Takashi
On Tue, 29 Jan 2013 11:50:18 +0100 Takashi Iwai tiwai@suse.de wrote:
At Tue, 29 Jan 2013 11:08:33 +0100, Antonio Ospite wrote:
On Tue, 29 Jan 2013 08:33:29 +0100 Takashi Iwai tiwai@suse.de wrote:
[...]
The patches didn't reach me, possibly because of a problem of my server I've hit in this morning.
Antonio, could you repost the patch to me (and add Daniels' ack)?
I will, I guess you missed the other patches in the same series as well? Should I re-send all of them to you only?
Yes. You don't have to resend to ML in this case.
Done.
(BTW, did you add me to Cc in the original posts?)
Yes, I did.
Regards, Antonio
From: Antonio Ospite ao2@amarulasolutions.com
Signed-off-by: Antonio Ospite ao2@amarulasolutions.com --- sound/usb/card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/usb/card.c b/sound/usb/card.c index ccf95cf..803953a 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -646,7 +646,7 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) as->substream[0].need_setup_ep = as->substream[1].need_setup_ep = true; } - } + } } else { /* * otherwise we keep the rest of the system in the dark
From: Antonio Ospite ao2@amarulasolutions.com
Misc cosmetics fixes:
* Indent with TABs instead of spaces
* Remove trailing spaces
* Remove excess of leading spaces. I left labels with one space indentation to be consistent with other labels used in the file.
Signed-off-by: Antonio Ospite ao2@amarulasolutions.com --- sound/core/pcm_native.c | 120 +++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 60 deletions(-)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 09b4286..022bad1 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -161,7 +161,7 @@ static const char * const snd_pcm_hw_param_names[] = { }; #endif
-int snd_pcm_hw_refine(struct snd_pcm_substream *substream, +int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { unsigned int k; @@ -214,7 +214,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, if (i->empty) printk("empty"); else - printk("%c%u %u%c", + printk("%c%u %u%c", i->openmin ? '(' : '[', i->min, i->max, i->openmax ? ')' : ']'); printk(" -> "); @@ -223,8 +223,8 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, #ifdef RULES_DEBUG if (i->empty) printk("empty\n"); - else - printk("%c%u %u%c\n", + else + printk("%c%u %u%c\n", i->openmin ? '(' : '[', i->min, i->max, i->openmax ? ')' : ']'); #endif @@ -236,7 +236,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
for (k = 0; k < constrs->rules_num; k++) rstamps[k] = 0; - for (k = 0; k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; k++) + for (k = 0; k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; k++) vstamps[k] = (params->rmask & (1 << k)) ? 1 : 0; do { again = 0; @@ -266,7 +266,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, if (i->empty) printk("empty"); else - printk("%c%u %u%c", + printk("%c%u %u%c", i->openmin ? '(' : '[', i->min, i->max, i->openmax ? ')' : ']'); } @@ -282,7 +282,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, if (i->empty) printk("empty"); else - printk("%c%u %u%c", + printk("%c%u %u%c", i->openmin ? '(' : '[', i->min, i->max, i->openmax ? ')' : ']'); } @@ -321,7 +321,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, m = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); if (snd_mask_min(m) == snd_mask_max(m) && - snd_interval_min(i) == snd_interval_max(i)) { + snd_interval_min(i) == snd_interval_max(i)) { changed = substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_FIFO_SIZE, params); if (changed < 0) @@ -563,7 +563,7 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream, runtime->stop_threshold = params->stop_threshold; runtime->silence_threshold = params->silence_threshold; runtime->silence_size = params->silence_size; - params->boundary = runtime->boundary; + params->boundary = runtime->boundary; if (snd_pcm_running(substream)) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && runtime->silence_size > 0) @@ -640,7 +640,7 @@ static int snd_pcm_status_user(struct snd_pcm_substream *substream, { struct snd_pcm_status status; int res; - + memset(&status, 0, sizeof(status)); res = snd_pcm_status(substream, &status); if (res < 0) @@ -655,7 +655,7 @@ static int snd_pcm_channel_info(struct snd_pcm_substream *substream, { struct snd_pcm_runtime *runtime; unsigned int channel; - + channel = info->channel; runtime = substream->runtime; snd_pcm_stream_lock_irq(substream); @@ -676,7 +676,7 @@ static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream, { struct snd_pcm_channel_info info; int res; - + if (copy_from_user(&info, _info, sizeof(info))) return -EFAULT; res = snd_pcm_channel_info(substream, &info); @@ -767,7 +767,7 @@ static int snd_pcm_action_single(struct action_ops *ops, int state) { int res; - + res = ops->pre_action(substream, state); if (res < 0) return res; @@ -877,7 +877,7 @@ static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state) struct snd_pcm_runtime *runtime = substream->runtime; snd_pcm_trigger_tstamp(substream); runtime->hw_ptr_jiffies = jiffies; - runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) / + runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) / runtime->rate; runtime->status->state = state; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && @@ -1553,7 +1553,7 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime; int result = 0; - + if (PCM_RUNTIME_CHECK(substream)) return -ENXIO; runtime = substream->runtime; @@ -1683,7 +1683,7 @@ static int snd_pcm_unlink(struct snd_pcm_substream *substream) kfree(substream->group); } relink_to_local(substream); - _end: + _end: write_unlock_irq(&snd_pcm_link_rwlock); up_write(&snd_pcm_link_rwsem); return res; @@ -1795,7 +1795,7 @@ static int snd_pcm_hw_rule_rate(struct snd_pcm_hw_params *params, return snd_interval_list(hw_param_interval(params, rule->var), snd_pcm_known_rates.count, snd_pcm_known_rates.list, hw->rates); -} +}
static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) @@ -1808,7 +1808,7 @@ static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params, t.openmax = 0; t.integer = 1; return snd_interval_refine(hw_param_interval(params, rule->var), &t); -} +}
int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream) { @@ -1835,98 +1835,98 @@ int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream) SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, snd_pcm_hw_rule_sample_bits, NULL, - SNDRV_PCM_HW_PARAM_FORMAT, + SNDRV_PCM_HW_PARAM_FORMAT, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, snd_pcm_hw_rule_div, NULL, SNDRV_PCM_HW_PARAM_FRAME_BITS, SNDRV_PCM_HW_PARAM_CHANNELS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, snd_pcm_hw_rule_mul, NULL, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, SNDRV_PCM_HW_PARAM_CHANNELS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, snd_pcm_hw_rule_mulkdiv, (void*) 8, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, snd_pcm_hw_rule_mulkdiv, (void*) 8, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, snd_pcm_hw_rule_div, NULL, SNDRV_PCM_HW_PARAM_FRAME_BITS, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_pcm_hw_rule_mulkdiv, (void*) 1000000, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_PERIOD_TIME, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_pcm_hw_rule_mulkdiv, (void*) 1000000, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_BUFFER_TIME, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, snd_pcm_hw_rule_div, NULL, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, snd_pcm_hw_rule_div, NULL, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_PERIODS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, snd_pcm_hw_rule_mulkdiv, (void*) 8, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, snd_pcm_hw_rule_muldivk, (void*) 1000000, SNDRV_PCM_HW_PARAM_PERIOD_TIME, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, snd_pcm_hw_rule_mul, NULL, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_PERIODS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, snd_pcm_hw_rule_mulkdiv, (void*) 8, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, snd_pcm_hw_rule_muldivk, (void*) 1000000, SNDRV_PCM_HW_PARAM_BUFFER_TIME, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, snd_pcm_hw_rule_muldivk, (void*) 8, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, snd_pcm_hw_rule_muldivk, (void*) 8, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, snd_pcm_hw_rule_mulkdiv, (void*) 1000000, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, snd_pcm_hw_rule_mulkdiv, (void*) 1000000, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) @@ -1941,9 +1941,9 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) int err; unsigned int mask = 0;
- if (hw->info & SNDRV_PCM_INFO_INTERLEAVED) + if (hw->info & SNDRV_PCM_INFO_INTERLEAVED) mask |= 1 << SNDRV_PCM_ACCESS_RW_INTERLEAVED; - if (hw->info & SNDRV_PCM_INFO_NONINTERLEAVED) + if (hw->info & SNDRV_PCM_INFO_NONINTERLEAVED) mask |= 1 << SNDRV_PCM_ACCESS_RW_NONINTERLEAVED; if (hw->info & SNDRV_PCM_INFO_MMAP) { if (hw->info & SNDRV_PCM_INFO_INTERLEAVED) @@ -1990,7 +1990,7 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) if (err < 0) return err;
- err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, snd_pcm_hw_rule_buffer_bytes_max, substream, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -1); if (err < 0) @@ -2004,7 +2004,7 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) }
if (!(hw->rates & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))) { - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_pcm_hw_rule_rate, hw, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) @@ -2192,12 +2192,12 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) goto __error; return err;
- __error: + __error: module_put(pcm->card->module); - __error2: - snd_card_file_remove(pcm->card, file); - __error1: - return err; + __error2: + snd_card_file_remove(pcm->card, file); + __error1: + return err; }
static int snd_pcm_release(struct inode *inode, struct file *file) @@ -2444,7 +2444,7 @@ static int snd_pcm_hwsync(struct snd_pcm_substream *substream) snd_pcm_stream_unlock_irq(substream); return err; } - + static int snd_pcm_delay(struct snd_pcm_substream *substream, snd_pcm_sframes_t __user *res) { @@ -2484,7 +2484,7 @@ static int snd_pcm_delay(struct snd_pcm_substream *substream, err = -EFAULT; return err; } - + static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream, struct snd_pcm_sync_ptr __user *_sync_ptr) { @@ -2498,7 +2498,7 @@ static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream, if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags))) return -EFAULT; if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct snd_pcm_mmap_control))) - return -EFAULT; + return -EFAULT; status = runtime->status; control = runtime->control; if (sync_ptr.flags & SNDRV_PCM_SYNC_PTR_HWSYNC) { @@ -2529,7 +2529,7 @@ static int snd_pcm_tstamp(struct snd_pcm_substream *substream, int __user *_arg) { struct snd_pcm_runtime *runtime = substream->runtime; int arg; - + if (get_user(arg, _arg)) return -EFAULT; if (arg < 0 || arg > SNDRV_PCM_TSTAMP_TYPE_LAST) @@ -2539,7 +2539,7 @@ static int snd_pcm_tstamp(struct snd_pcm_substream *substream, int __user *_arg) runtime->tstamp_type = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC; return 0; } - + static int snd_pcm_common_ioctl1(struct file *file, struct snd_pcm_substream *substream, unsigned int cmd, void __user *arg) @@ -2801,7 +2801,7 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, { mm_segment_t fs; int result; - + fs = snd_enter_user(); switch (substream->stream) { case SNDRV_PCM_STREAM_PLAYBACK: @@ -2945,7 +2945,7 @@ static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait) struct snd_pcm_file *pcm_file; struct snd_pcm_substream *substream; struct snd_pcm_runtime *runtime; - unsigned int mask; + unsigned int mask; snd_pcm_uframes_t avail;
pcm_file = file->private_data; @@ -2984,7 +2984,7 @@ static unsigned int snd_pcm_capture_poll(struct file *file, poll_table * wait) struct snd_pcm_file *pcm_file; struct snd_pcm_substream *substream; struct snd_pcm_runtime *runtime; - unsigned int mask; + unsigned int mask; snd_pcm_uframes_t avail;
pcm_file = file->private_data; @@ -3039,7 +3039,7 @@ static int snd_pcm_mmap_status_fault(struct vm_area_struct *area, { struct snd_pcm_substream *substream = area->vm_private_data; struct snd_pcm_runtime *runtime; - + if (substream == NULL) return VM_FAULT_SIGBUS; runtime = substream->runtime; @@ -3076,7 +3076,7 @@ static int snd_pcm_mmap_control_fault(struct vm_area_struct *area, { struct snd_pcm_substream *substream = area->vm_private_data; struct snd_pcm_runtime *runtime; - + if (substream == NULL) return VM_FAULT_SIGBUS; runtime = substream->runtime; @@ -3152,7 +3152,7 @@ static int snd_pcm_mmap_data_fault(struct vm_area_struct *area, unsigned long offset; struct page * page; size_t dma_bytes; - + if (substream == NULL) return VM_FAULT_SIGBUS; runtime = substream->runtime; @@ -3290,9 +3290,9 @@ EXPORT_SYMBOL(snd_pcm_mmap_data); static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area) { struct snd_pcm_file * pcm_file; - struct snd_pcm_substream *substream; + struct snd_pcm_substream *substream; unsigned long offset; - + pcm_file = file->private_data; substream = pcm_file->substream; if (PCM_RUNTIME_CHECK(substream))
participants (3)
-
Antonio Ospite
-
Daniel Mack
-
Takashi Iwai