~ubuntu-branches/ubuntu/karmic/linux-ec2/karmic

« back to all changes in this revision

Viewing changes to ubuntu/lirc/lirc_dev/lirc_dev.c

  • Committer: Bazaar Package Importer
  • Author(s): Tim Gardner, Tim Gardner, Andy Whitcroft, John Johansen, Upstream Kernel Changes, Luke Yelavich, Mario Limonciello
  • Date: 2009-10-12 11:27:10 UTC
  • Revision ID: james.westby@ubuntu.com-20091012112710-mpj1bd126qjqg7u4
Tags: 2.6.31-302.7
[ Tim Gardner ]

* [Config] Updateconfigs after rebase to 2.6.31-14.46

* Rebased against linux (2.6.31-14.46)

[ Andy Whitcroft ]

* reinstate armel.mk with no flavours
  - LP: #449637
* [Upstream] elevator: fix fastfail checks to allow merge of readahead
  requests
  - LP: #444915
* [Upstream] block: silently error unsupported empty barriers too
  - LP: #420423

[ John Johansen ]

* SAUCE: AppArmor: Fix mediation of "deleted" paths
  - LP: #415632

[ Tim Gardner ]

* [Config] CONFIG_X86_MCE
  https://lists.ubuntu.com/archives/kernel-team/2009-October/007584.html
* Revert "appletalk: Fix skb leak when ipddp interface is not loaded,
  CVE-2009-2903" - Use patch from 2.6.31.4 which is slightly different.

[ Upstream Kernel Changes ]

* x86: fix csum_ipv6_magic asm memory clobber
* tty: Avoid dropping ldisc_mutex over hangup tty re-initialization
* x86: Don't leak 64-bit kernel register values to 32-bit processes
* tracing: correct module boundaries for ftrace_release
* ftrace: check for failure for all conversions
* futex: fix requeue_pi key imbalance
* futex: Move exit_pi_state() call to release_mm()
* futex: Nullify robust lists after cleanup
* futex: Fix locking imbalance
* NOHZ: update idle state also when NOHZ is inactive
* ima: ecryptfs fix imbalance message
* libata: fix incorrect link online check during probe
* sound: via82xx: move DXS volume controls to PCM interface
* ASoC: WM8350 capture PGA mutes are inverted
* KVM: Prevent overflow in KVM_GET_SUPPORTED_CPUID
* KVM: VMX: flush TLB with INVEPT on cpu migration
* KVM: fix LAPIC timer period overflow
* KVM: SVM: Fix tsc offset adjustment when running nested
* KVM: SVM: Handle tsc in svm_get_msr/svm_set_msr correctly
* net: Fix wrong sizeof
* mm: add_to_swap_cache() must not sleep
* sis5513: fix PIO setup for ATAPI devices
* PIT fixes to unbreak suspend/resume (bug #14222)
* IMA: open new file for read
* ACPI: Clarify resource conflict message
* ACPI: fix Compaq Evo N800c (Pentium 4m) boot hang regression
* net: restore tx timestamping for accelerated vlans
* net: unix: fix sending fds in multiple buffers
* tun: Return -EINVAL if neither IFF_TUN nor IFF_TAP is set.
* tcp: fix CONFIG_TCP_MD5SIG + CONFIG_PREEMPT timer BUG()
* net: Fix sock_wfree() race
* smsc95xx: fix transmission where ZLP is expected
* sky2: Set SKY2_HW_RAM_BUFFER in sky2_init
* appletalk: Fix skb leak when ipddp interface is not loaded
* ax25: Fix possible oops in ax25_make_new
* ax25: Fix SIOCAX25GETINFO ioctl
* sit: fix off-by-one in ipip6_tunnel_get_prl
* Linux 2.6.31.4
* drm/i915: Fix FDI M/N setting according with correct color depth
  - LP: #416792

* linux (2.6.31-13.45)

[ Luke Yelavich ]

* [Config] Add sd_mod to scsi-modules udeb for powerpc

[ Mario Limonciello ]

* SAUCE: Update to LIRC 0.8.6
  - LP: #432678

[ Tim Gardner ]

* [Config] CONFIG_X86_PAT=y
  https://lists.ubuntu.com/archives/kernel-team/2009-October/007477.html
  https://lists.ubuntu.com/archives/kernel-team/2009-October/007534.html

* [Config] Add armel arch to linux-libc-dev arches.
  - LP: #449637

[ Upstream Kernel Changes ]

* e1000e: swap max hw supported frame size between 82574 and 82583
* drm/i915: Initialize HDMI outputs as HDMI connectors, not DVI.
  - LP: #392017
* ALSA: hda - Add quirks for some HP laptops
  - LP: #449742
* ALSA: hda - Add support for HP dv6
  - LP: #449742

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  along with this program; if not, write to the Free Software
18
18
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
19
 *
20
 
 * $Id: lirc_dev.c,v 1.93 2009/03/29 10:55:31 lirc Exp $
 
20
 * $Id: lirc_dev.c,v 1.96 2009/08/31 16:57:55 lirc Exp $
21
21
 *
22
22
 */
23
23
 
106
106
#endif
107
107
};
108
108
 
109
 
static DEFINE_MUTEX(driver_lock);
 
109
static DEFINE_MUTEX(lirc_dev_lock);
110
110
 
111
111
static struct irctl *irctls[MAX_IRCTL_DEVICES];
112
112
static struct file_operations fops;
307
307
                }
308
308
        }
309
309
 
310
 
        if (d->owner == NULL) {
311
 
                printk(KERN_ERR "lirc_dev: lirc_register_driver: "
312
 
                                    "no module owner registered\n");
313
 
                err = -EBADRQC;
314
 
                goto out;
315
 
        }
316
 
 
317
 
        mutex_lock(&driver_lock);
 
310
        mutex_lock(&lirc_dev_lock);
318
311
 
319
312
        minor = d->minor;
320
313
 
421
414
#endif
422
415
        }
423
416
        ir->attached = 1;
424
 
        mutex_unlock(&driver_lock);
 
417
        mutex_unlock(&lirc_dev_lock);
425
418
 
426
419
/*
427
420
 * Recent kernels should handle this autmatically by increasing/decreasing
445
438
        devfs_remove(DEV_LIRC "/%i", ir->d.minor);
446
439
#endif
447
440
out_lock:
448
 
        mutex_unlock(&driver_lock);
 
441
        mutex_unlock(&lirc_dev_lock);
449
442
out:
450
443
        return err;
451
444
}
468
461
 
469
462
        ir = irctls[minor];
470
463
 
471
 
        mutex_lock(&driver_lock);
 
464
        mutex_lock(&lirc_dev_lock);
472
465
 
473
466
        if (ir->d.minor != minor) {
474
467
                printk(KERN_ERR "lirc_dev: lirc_unregister_driver: "
475
468
                       "minor (%d) device not registered!", minor);
476
 
                mutex_unlock(&driver_lock);
 
469
                mutex_unlock(&lirc_dev_lock);
477
470
                return -ENOENT;
478
471
        }
479
472
 
531
524
        lirc_device_destroy(lirc_class,
532
525
                            MKDEV(IRCTL_DEV_MAJOR, ir->d.minor));
533
526
 
534
 
        mutex_unlock(&driver_lock);
 
527
        mutex_unlock(&lirc_dev_lock);
535
528
 
536
529
/*
537
530
 * Recent kernels should handle this autmatically by increasing/decreasing
564
557
        if (ir->d.fops && ir->d.fops->open)
565
558
                return ir->d.fops->open(inode, file);
566
559
 
567
 
        if (mutex_lock_interruptible(&driver_lock))
 
560
        if (mutex_lock_interruptible(&lirc_dev_lock))
568
561
                return -ERESTARTSYS;
569
562
 
570
563
        if (ir->d.minor == NOPLUG) {
577
570
                goto error;
578
571
        }
579
572
 
580
 
        if (ir->d.owner != NULL && try_module_get(ir->d.owner)) {
 
573
        if (try_module_get(ir->d.owner)) {
581
574
                ++ir->open;
582
575
                retval = ir->d.set_use_inc(ir->d.data);
583
576
 
598
591
                if (ir->task)
599
592
                        wake_up_process(ir->task);
600
593
#endif
601
 
        } else {
602
 
                if (ir->d.owner == NULL)
603
 
                        dprintk(LOGHEAD "no module owner!!!\n",
604
 
                                ir->d.name, ir->d.minor);
605
 
 
606
 
                retval = -ENODEV;
607
594
        }
608
 
 
609
595
 error:
610
596
        if (ir)
611
597
                dprintk(LOGHEAD "open result = %d\n", ir->d.name, ir->d.minor,
612
598
                        retval);
613
599
 
614
 
        mutex_unlock(&driver_lock);
 
600
        mutex_unlock(&lirc_dev_lock);
615
601
 
616
602
        return retval;
617
603
}
626
612
        if (ir->d.fops && ir->d.fops->release)
627
613
                return ir->d.fops->release(inode, file);
628
614
 
629
 
        if (mutex_lock_interruptible(&driver_lock))
 
615
        if (mutex_lock_interruptible(&lirc_dev_lock))
630
616
                return -ERESTARTSYS;
631
617
 
632
618
        --ir->open;
639
625
                kfree(ir);
640
626
        }
641
627
 
642
 
        mutex_unlock(&driver_lock);
 
628
        mutex_unlock(&lirc_dev_lock);
643
629
 
644
630
        return 0;
645
631
}
784
770
 
785
771
                cmd = _IOC(_IOC_DIR(cmd32), _IOC_TYPE(cmd32), _IOC_NR(cmd32),
786
772
                           (_IOC_TYPECHECK(unsigned long)));
787
 
                ret = irctl_ioctl(file->f_path.dentry->d_inode, file,
 
773
                ret = irctl_ioctl(file->f_dentry->d_inode, file,
788
774
                                  cmd, (unsigned long)(&val));
789
775
 
790
776
                set_fs(old_fs);
818
804
                 */
819
805
                lock_kernel();
820
806
                cmd = cmd32;
821
 
                ret = irctl_ioctl(file->f_path.dentry->d_inode,
 
807
                ret = irctl_ioctl(file->f_dentry->d_inode,
822
808
                                  file, cmd, arg);
823
809
                unlock_kernel();
824
810
                return ret;