23 Dec, 2011

1 commit


01 Nov, 2011

1 commit


13 Dec, 2010

1 commit


24 Nov, 2010

1 commit

  • If CONFIG_SND_DYNAMIC_MINORS is used, assign /dev/snd/seq and
    /dev/snd/timer the usual static minors, and export specific
    module aliases to generate udev module on-demand loading
    instructions:

    $ cat /lib/modules/2.6.33.4-smp/modules.devname
    # Device nodes to trigger on-demand module loading.
    microcode cpu/microcode c10:184
    fuse fuse c10:229
    ppp_generic ppp c108:0
    tun net/tun c10:200
    uinput uinput c10:223
    dm_mod mapper/control c10:236
    snd_timer snd/timer c116:33
    snd_seq snd/seq c116:1

    The last two lines instruct udev to create device nodes, even
    when the modules are not loaded at that time.

    As soon as userspace accesses any of these nodes, the in-kernel
    module-loader will load the module, and the device can be used.

    The header file minor calculation needed to be simplified to
    make __stringify() (supports only two indirections) in
    the MODULE_ALIAS macro work.

    This is part of systemd's effort to get rid of unconditional
    module load instructions and needless init scripts.

    Cc: Lennart Poettering
    Signed-off-by: Kay Sievers
    Signed-off-by: Clemens Ladisch
    Signed-off-by: Takashi Iwai

    Kay Sievers
     

18 Nov, 2010

1 commit


15 Oct, 2010

1 commit

  • All file_operations should get a .llseek operation so we can make
    nonseekable_open the default for future file operations without a
    .llseek pointer.

    The three cases that we can automatically detect are no_llseek, seq_lseek
    and default_llseek. For cases where we can we can automatically prove that
    the file offset is always ignored, we use noop_llseek, which maintains
    the current behavior of not returning an error from a seek.

    New drivers should normally not use noop_llseek but instead use no_llseek
    and call nonseekable_open at open time. Existing drivers can be converted
    to do the same when the maintainer knows for certain that no user code
    relies on calling seek on the device file.

    The generated code is often incorrectly indented and right now contains
    comments that clarify for each added line why a specific variant was
    chosen. In the version that gets submitted upstream, the comments will
    be gone and I will manually fix the indentation, because there does not
    seem to be a way to do that using coccinelle.

    Some amount of new code is currently sitting in linux-next that should get
    the same modifications, which I will do at the end of the merge window.

    Many thanks to Julia Lawall for helping me learn to write a semantic
    patch that does all this.

    ===== begin semantic patch =====
    // This adds an llseek= method to all file operations,
    // as a preparation for making no_llseek the default.
    //
    // The rules are
    // - use no_llseek explicitly if we do nonseekable_open
    // - use seq_lseek for sequential files
    // - use default_llseek if we know we access f_pos
    // - use noop_llseek if we know we don't access f_pos,
    // but we still want to allow users to call lseek
    //
    @ open1 exists @
    identifier nested_open;
    @@
    nested_open(...)
    {

    }

    @ open exists@
    identifier open_f;
    identifier i, f;
    identifier open1.nested_open;
    @@
    int open_f(struct inode *i, struct file *f)
    {

    }

    @ read disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    @@
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
    {

    }

    @ read_no_fpos disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    @@
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
    {
    ... when != off
    }

    @ write @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    @@
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
    {

    }

    @ write_no_fpos @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    @@
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
    {
    ... when != off
    }

    @ fops0 @
    identifier fops;
    @@
    struct file_operations fops = {
    ...
    };

    @ has_llseek depends on fops0 @
    identifier fops0.fops;
    identifier llseek_f;
    @@
    struct file_operations fops = {
    ...
    .llseek = llseek_f,
    ...
    };

    @ has_read depends on fops0 @
    identifier fops0.fops;
    identifier read_f;
    @@
    struct file_operations fops = {
    ...
    .read = read_f,
    ...
    };

    @ has_write depends on fops0 @
    identifier fops0.fops;
    identifier write_f;
    @@
    struct file_operations fops = {
    ...
    .write = write_f,
    ...
    };

    @ has_open depends on fops0 @
    identifier fops0.fops;
    identifier open_f;
    @@
    struct file_operations fops = {
    ...
    .open = open_f,
    ...
    };

    // use no_llseek if we call nonseekable_open
    ////////////////////////////////////////////
    @ nonseekable1 depends on !has_llseek && has_open @
    identifier fops0.fops;
    identifier nso ~= "nonseekable_open";
    @@
    struct file_operations fops = {
    ... .open = nso, ...
    +.llseek = no_llseek, /* nonseekable */
    };

    @ nonseekable2 depends on !has_llseek @
    identifier fops0.fops;
    identifier open.open_f;
    @@
    struct file_operations fops = {
    ... .open = open_f, ...
    +.llseek = no_llseek, /* open uses nonseekable */
    };

    // use seq_lseek for sequential files
    /////////////////////////////////////
    @ seq depends on !has_llseek @
    identifier fops0.fops;
    identifier sr ~= "seq_read";
    @@
    struct file_operations fops = {
    ... .read = sr, ...
    +.llseek = seq_lseek, /* we have seq_read */
    };

    // use default_llseek if there is a readdir
    ///////////////////////////////////////////
    @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier readdir_e;
    @@
    // any other fop is used that changes pos
    struct file_operations fops = {
    ... .readdir = readdir_e, ...
    +.llseek = default_llseek, /* readdir is present */
    };

    // use default_llseek if at least one of read/write touches f_pos
    /////////////////////////////////////////////////////////////////
    @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read.read_f;
    @@
    // read fops use offset
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = default_llseek, /* read accesses f_pos */
    };

    @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write.write_f;
    @@
    // write fops use offset
    struct file_operations fops = {
    ... .write = write_f, ...
    + .llseek = default_llseek, /* write accesses f_pos */
    };

    // Use noop_llseek if neither read nor write accesses f_pos
    ///////////////////////////////////////////////////////////

    @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    identifier write_no_fpos.write_f;
    @@
    // write fops use offset
    struct file_operations fops = {
    ...
    .write = write_f,
    .read = read_f,
    ...
    +.llseek = noop_llseek, /* read and write both use no f_pos */
    };

    @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write_no_fpos.write_f;
    @@
    struct file_operations fops = {
    ... .write = write_f, ...
    +.llseek = noop_llseek, /* write uses no f_pos */
    };

    @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    @@
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = noop_llseek, /* read uses no f_pos */
    };

    @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    @@
    struct file_operations fops = {
    ...
    +.llseek = noop_llseek, /* no read or write fn */
    };
    ===== End semantic patch =====

    Signed-off-by: Arnd Bergmann
    Cc: Julia Lawall
    Cc: Christoph Hellwig

    Arnd Bergmann
     

09 Apr, 2010

1 commit


15 Jan, 2010

1 commit


07 Jan, 2009

1 commit

  • Several subsystem open handlers dereference the fops_get() return value
    without checking it for nullness. This opens a race condition between the
    open handler and module unloading.

    A module can be marked as being unloaded (MODULE_STATE_GOING) before its
    exit function is called and gets the chance to unregister the driver.
    During that window open handlers can still be called, and fops_get() will
    fail in try_module_get() and return a NULL pointer.

    This change checks the fops_get() return value and returns -ENODEV if NULL.

    Reported-by: Alan Jenkins
    Signed-off-by: Laurent Pinchart
    Acked-by: Takashi Iwai
    Cc: Al Viro
    Cc: Dave Airlie
    Acked-by: Mauro Carvalho Chehab
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Laurent Pinchart
     

17 Oct, 2008

1 commit


13 Aug, 2008

1 commit


01 Aug, 2008

2 commits

  • When compiled with CONFIG_SND_DYNAMIC_MINORS the ALSA core is fine
    to have more than 8 PCM devices per card, except one place - the
    SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE ioctl, which will not enumerate
    devices > 7. This patch fixes the issue, changing the devices list
    organisation.

    Instead of adding new device to the tail, the list is now kept always
    ordered (by card number, then device number). Thus, during enumeration,
    it is easy to discover the fact that there is no more given card's
    devices.

    Additionally the device field of struct snd_pcm had to be changed to int,
    as its "unsignednity" caused a lot of problems when comparing it to
    potentially negative signed values. (-1 is 0xffffffff or even more then ;-)

    Signed-off-by: Pawel Moll
    Signed-off-by: Takashi Iwai
    Signed-off-by: Jaroslav Kysela

    Pawel MOLL
     
  • This reverts commit fb3d6f2b77bdec75d45aa9d4464287ed87927866.

    New, updated patch with same subject replaces this commit.

    Signed-off-by: Jaroslav Kysela

    Jaroslav Kysela
     

30 Jul, 2008

1 commit

  • When compiled with CONFIG_SND_DYNAMIC_MINORS the ALSA core is fine
    to have more than 8 PCM devices per card, except one place - the
    SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE ioctl, which will not enumerate
    devices > 7. This patch fixes the issue, changing the devices list
    organisation.

    Instead of adding new device to the tail, the list is now kept always
    ordered (by card number, then device number). Thus, during enumeration,
    it is easy to discover the fact that there is no more given card's
    devices. The same limit was present in OSS emulation code. It has
    been fixed as well.

    Additionally the device field of struct snd_pcm is now int, instead of
    unsigned int, as there is no obvious reason for keeping it unsigned.
    This caused a lot of problems with comparing this value with other
    (almost always signed) variables. There is just one more place where
    device number is unsigned - in struct snd_pcm_info, which should be
    also sorted out in future.

    Signed-off-by: Pawel MOLL
    Signed-off-by: Jaroslav Kysela

    Pawel MOLL
     

15 Jul, 2008

2 commits

  • * 'bkl-removal' of git://git.lwn.net/linux-2.6: (146 commits)
    IB/umad: BKL is not needed for ib_umad_open()
    IB/uverbs: BKL is not needed for ib_uverbs_open()
    bf561-coreb: BKL unneeded for open()
    Call fasync() functions without the BKL
    snd/PCM: fasync BKL pushdown
    ipmi: fasync BKL pushdown
    ecryptfs: fasync BKL pushdown
    Bluetooth VHCI: fasync BKL pushdown
    tty_io: fasync BKL pushdown
    tun: fasync BKL pushdown
    i2o: fasync BKL pushdown
    mpt: fasync BKL pushdown
    Remove BKL from remote_llseek v2
    Make FAT users happier by not deadlocking
    x86-mce: BKL pushdown
    vmwatchdog: BKL pushdown
    vmcp: BKL pushdown
    via-pmu: BKL pushdown
    uml-random: BKL pushdown
    uml-mmapper: BKL pushdown
    ...

    Linus Torvalds
     
  • Jonathan Corbet
     

10 Jul, 2008

1 commit


21 Jun, 2008

1 commit


21 May, 2008

1 commit

  • There is a race from when a device is created with device_create() and
    then the drvdata is set with a call to dev_set_drvdata() in which a
    sysfs file could be open, yet the drvdata will be NULL, causing all
    sorts of bad things to happen.

    This patch fixes the problem by using the new function,
    device_create_drvdata().

    Cc: Kay Sievers
    Cc: Jaroslav Kysela
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

15 Feb, 2008

1 commit

  • The sound drivers and the pnpbios core test for current->root != NULL. This
    test seems to be unnecessary since we always have rootfs mounted before
    initializing the drivers.

    Signed-off-by: Jan Blunck
    Acked-by: Christoph Hellwig
    Cc: Bjorn Helgaas
    Cc: Jaroslav Kysela
    Acked-by: Takashi Iwai
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Blunck
     

01 Feb, 2008

1 commit

  • This header file exists only for some hacks to adapt alsa-driver
    tree. It's useless for building in the kernel. Let's move a few
    lines in it to sound/core.h and remove it.
    With this patch, sound/driver.h isn't removed but has just a single
    compile warning to include it. This should be really killed in
    future.

    Signed-off-by: Takashi Iwai
    Signed-off-by: Jaroslav Kysela

    Takashi Iwai
     

16 Oct, 2007

2 commits


20 Jul, 2007

1 commit


13 Feb, 2007

1 commit

  • Many struct file_operations in the kernel can be "const". Marking them const
    moves these to the .rodata section, which avoids false sharing with potential
    dirty data. In addition it'll catch accidental writes at compile time to
    these shared resources.

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

09 Feb, 2007

1 commit


30 Jan, 2007

1 commit

  • The recent change for a new sysfs tree with card* object breaks the
    /sys/class/sound tree if CONFIG_SYSFS_DEPRECATED is enabled.
    The device in each entry doesn't point the correct device object:

    /sys/class/sound
    ...
    |-- pcmC0D0c
    | |-- dev
    | |-- device -> ../../../class/sound/card0
    | |-- pcm_class
    | |-- power
    | | `-- wakeup
    | |-- subsystem -> ../../../class/sound
    | `-- uevent

    Also, this change breaks some drivers (like sound/arm/*) referring
    card->dev directly to obtain the device object for memory handling.

    This patch reverts the semantics of card->dev to the former version,
    which points to a real device object. The card* object is stored in a
    new card->card_dev field, instead. The device parent is chosen either
    card->dev or card->card_dev according to CONFIG_SYSFS_DEPRECATED to
    keep the tree compatibility.
    Also, card* isn't created if CONFIG_SYSFS_DEPRECATED is enabled. The
    reason of card* object is a root of all beloing devices, and it makes
    little sense if each sound device points to the real device object
    directly.

    Signed-off-by: Takashi Iwai
    Acked-by: Monty Montgomery
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

02 Dec, 2006

1 commit

  • Converts from using struct "class_device" to "struct device" making
    everything show up properly in /sys/devices/ with symlinks from the
    /sys/class directory.

    It also makes the struct sound_card to show up as a "real" device
    where all the different sound class devices are placed as childs
    and different card attribute files can hang off of. /sys/class/sound is
    still a flat directory, but the symlink targets of all devices belonging
    to the same card, point the the /sys/devices tree below the new card
    device object.

    Thanks to Kay for the updates to this patch.

    Signed-off-by: Kay Sievers
    Acked-by: Jaroslav Kysela
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

23 Sep, 2006

2 commits


13 Jul, 2006

1 commit


27 Jun, 2006

1 commit


23 Jun, 2006

4 commits


29 Mar, 2006

1 commit

  • Mark the f_ops members of inodes as const, as well as fix the
    ripple-through this causes by places that copy this f_ops and then "do
    stuff" with it.

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

22 Mar, 2006

2 commits


04 Jan, 2006

1 commit