Skip to content

Commit 3374cd1

Browse files
committed
Merge branch 'topic/core-cleanup' into for-linus
2 parents e40152e + 670ff6a commit 3374cd1

26 files changed

Lines changed: 829 additions & 492 deletions

File tree

‎Documentation/DocBook/writing-an-alsa-driver.tmpl‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5518,34 +5518,41 @@ struct _snd_pcm_runtime {
55185518
]]>
55195519
</programlisting>
55205520
</informalexample>
5521+
5522+
For the raw data, <structfield>size</structfield> field must be
5523+
set properly. This specifies the maximum size of the proc file access.
55215524
</para>
55225525

55235526
<para>
5524-
The callback is much more complicated than the text-file
5525-
version. You need to use a low-level I/O functions such as
5527+
The read/write callbacks of raw mode are more direct than the text mode.
5528+
You need to use a low-level I/O functions such as
55265529
<function>copy_from/to_user()</function> to transfer the
55275530
data.
55285531

55295532
<informalexample>
55305533
<programlisting>
55315534
<![CDATA[
5532-
static long my_file_io_read(struct snd_info_entry *entry,
5535+
static ssize_t my_file_io_read(struct snd_info_entry *entry,
55335536
void *file_private_data,
55345537
struct file *file,
55355538
char *buf,
5536-
unsigned long count,
5537-
unsigned long pos)
5539+
size_t count,
5540+
loff_t pos)
55385541
{
5539-
long size = count;
5540-
if (pos + size > local_max_size)
5541-
size = local_max_size - pos;
5542-
if (copy_to_user(buf, local_data + pos, size))
5542+
if (copy_to_user(buf, local_data + pos, count))
55435543
return -EFAULT;
5544-
return size;
5544+
return count;
55455545
}
55465546
]]>
55475547
</programlisting>
55485548
</informalexample>
5549+
5550+
If the size of the info entry has been set up properly,
5551+
<structfield>count</structfield> and <structfield>pos</structfield> are
5552+
guaranteed to fit within 0 and the given size.
5553+
You don't have to check the range in the callbacks unless any
5554+
other condition is required.
5555+
55495556
</para>
55505557

55515558
</chapter>

‎include/sound/info.h‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ struct snd_info_entry_ops {
5151
unsigned short mode, void **file_private_data);
5252
int (*release)(struct snd_info_entry *entry,
5353
unsigned short mode, void *file_private_data);
54-
long (*read)(struct snd_info_entry *entry, void *file_private_data,
55-
struct file *file, char __user *buf,
56-
unsigned long count, unsigned long pos);
57-
long (*write)(struct snd_info_entry *entry, void *file_private_data,
58-
struct file *file, const char __user *buf,
59-
unsigned long count, unsigned long pos);
60-
long long (*llseek)(struct snd_info_entry *entry,
61-
void *file_private_data, struct file *file,
62-
long long offset, int orig);
63-
unsigned int(*poll)(struct snd_info_entry *entry,
64-
void *file_private_data, struct file *file,
65-
poll_table *wait);
54+
ssize_t (*read)(struct snd_info_entry *entry, void *file_private_data,
55+
struct file *file, char __user *buf,
56+
size_t count, loff_t pos);
57+
ssize_t (*write)(struct snd_info_entry *entry, void *file_private_data,
58+
struct file *file, const char __user *buf,
59+
size_t count, loff_t pos);
60+
loff_t (*llseek)(struct snd_info_entry *entry,
61+
void *file_private_data, struct file *file,
62+
loff_t offset, int orig);
63+
unsigned int (*poll)(struct snd_info_entry *entry,
64+
void *file_private_data, struct file *file,
65+
poll_table *wait);
6666
int (*ioctl)(struct snd_info_entry *entry, void *file_private_data,
6767
struct file *file, unsigned int cmd, unsigned long arg);
6868
int (*mmap)(struct snd_info_entry *entry, void *file_private_data,

‎sound/atmel/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ config SND_ATMEL_AC97C
1212
tristate "Atmel AC97 Controller (AC97C) driver"
1313
select SND_PCM
1414
select SND_AC97_CODEC
15-
depends on DW_DMAC && AVR32
15+
depends on (DW_DMAC && AVR32) || ARCH_AT91
1616
help
1717
ALSA sound driver for the Atmel AC97 controller.
1818

0 commit comments

Comments
 (0)