From 9411d323ebe3eec413002cf33f25b1568fbf2f86 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 5 Aug 2012 22:55:38 +0000 Subject: [PATCH] lirc_sir: make device registration work (Closes: #680762) svn path=/dists/sid/linux/; revision=19311 --- debian/changelog | 1 + ...rc_sir-make-device-registration-work.patch | 126 ++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 128 insertions(+) create mode 100644 debian/patches/bugfix/all/media-lirc_sir-make-device-registration-work.patch diff --git a/debian/changelog b/debian/changelog index 50332f766..c5eed3ec2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -61,6 +61,7 @@ linux (3.2.26-1) UNRELEASED; urgency=low - Drop kconfig options; restrictions can only be disabled by sysctl - Change the audit message type from AUDIT_AVC (1400) to AUDIT_ANON_LINK (1702) + * lirc_sir: make device registration work (Closes: #680762) -- Ben Hutchings Tue, 24 Jul 2012 02:20:37 +0100 diff --git a/debian/patches/bugfix/all/media-lirc_sir-make-device-registration-work.patch b/debian/patches/bugfix/all/media-lirc_sir-make-device-registration-work.patch new file mode 100644 index 000000000..ded869a53 --- /dev/null +++ b/debian/patches/bugfix/all/media-lirc_sir-make-device-registration-work.patch @@ -0,0 +1,126 @@ +From: Jarod Wilson +Date: Mon, 4 Jun 2012 13:05:24 -0300 +Subject: [media] lirc_sir: make device registration work + +commit 4b71ca6bce8fab3d08c61bf330e781f957934ae1 upstream. + +For one, the driver device pointer needs to be filled in, or the lirc core +will refuse to load the driver. And we really need to wire up all the +platform_device bits. This has been tested via the lirc sourceforge tree +and verified to work, been sitting there for months, finally getting +around to sending it. :\ + +CC: Josh Boyer +Signed-off-by: Jarod Wilson +Signed-off-by: Mauro Carvalho Chehab +--- + drivers/staging/media/lirc/lirc_sir.c | 60 +++++++++++++++++++++++++++++++-- + 1 file changed, 58 insertions(+), 2 deletions(-) + +diff --git a/drivers/staging/media/lirc/lirc_sir.c b/drivers/staging/media/lirc/lirc_sir.c +index 945d962..4afc3b4 100644 +--- a/drivers/staging/media/lirc/lirc_sir.c ++++ b/drivers/staging/media/lirc/lirc_sir.c +@@ -52,6 +52,7 @@ + #include + #include + #include ++#include + #ifdef LIRC_ON_SA1100 + #include + #ifdef CONFIG_SA1100_COLLIE +@@ -487,9 +488,11 @@ static struct lirc_driver driver = { + .owner = THIS_MODULE, + }; + ++static struct platform_device *lirc_sir_dev; + + static int init_chrdev(void) + { ++ driver.dev = &lirc_sir_dev->dev; + driver.minor = lirc_register_driver(&driver); + if (driver.minor < 0) { + printk(KERN_ERR LIRC_DRIVER_NAME ": init_chrdev() failed.\n"); +@@ -1215,20 +1218,71 @@ static int init_lirc_sir(void) + return 0; + } + ++static int __devinit lirc_sir_probe(struct platform_device *dev) ++{ ++ return 0; ++} ++ ++static int __devexit lirc_sir_remove(struct platform_device *dev) ++{ ++ return 0; ++} ++ ++static struct platform_driver lirc_sir_driver = { ++ .probe = lirc_sir_probe, ++ .remove = __devexit_p(lirc_sir_remove), ++ .driver = { ++ .name = "lirc_sir", ++ .owner = THIS_MODULE, ++ }, ++}; + + static int __init lirc_sir_init(void) + { + int retval; + ++ retval = platform_driver_register(&lirc_sir_driver); ++ if (retval) { ++ printk(KERN_ERR LIRC_DRIVER_NAME ": Platform driver register " ++ "failed!\n"); ++ return -ENODEV; ++ } ++ ++ lirc_sir_dev = platform_device_alloc("lirc_dev", 0); ++ if (!lirc_sir_dev) { ++ printk(KERN_ERR LIRC_DRIVER_NAME ": Platform device alloc " ++ "failed!\n"); ++ retval = -ENOMEM; ++ goto pdev_alloc_fail; ++ } ++ ++ retval = platform_device_add(lirc_sir_dev); ++ if (retval) { ++ printk(KERN_ERR LIRC_DRIVER_NAME ": Platform device add " ++ "failed!\n"); ++ retval = -ENODEV; ++ goto pdev_add_fail; ++ } ++ + retval = init_chrdev(); + if (retval < 0) +- return retval; ++ goto fail; ++ + retval = init_lirc_sir(); + if (retval) { + drop_chrdev(); +- return retval; ++ goto fail; + } ++ + return 0; ++ ++fail: ++ platform_device_del(lirc_sir_dev); ++pdev_add_fail: ++ platform_device_put(lirc_sir_dev); ++pdev_alloc_fail: ++ platform_driver_unregister(&lirc_sir_driver); ++ return retval; + } + + static void __exit lirc_sir_exit(void) +@@ -1236,6 +1290,8 @@ static void __exit lirc_sir_exit(void) + drop_hardware(); + drop_chrdev(); + drop_port(); ++ platform_device_unregister(lirc_sir_dev); ++ platform_driver_unregister(&lirc_sir_driver); + printk(KERN_INFO LIRC_DRIVER_NAME ": Uninstalled.\n"); + } + diff --git a/debian/patches/series b/debian/patches/series index 79814738f..80172061f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -388,3 +388,4 @@ features/all/bql/ixgbe-add-support-for-byte-queue-limits.patch features/all/bql/igb-ixgbe-netdev_tx_reset_queue-incorrectly-called-from-tx-init.patch features/all/bql/skge-add-byte-queue-limit-support.patch features/all/bql/r8169-add-byte-queue-limit-support.patch +bugfix/all/media-lirc_sir-make-device-registration-work.patch