Return-path: Envelope-to: dsd@gentoo.org Delivery-date: Sun, 09 Jan 2005 00:25:48 +0000 Received: from dev.gentoo.org [156.56.111.197] by localhost with POP3 (fetchmail-6.2.5) for dsd@localhost (single-drop); Sun, 09 Jan 2005 00:40:35 +0000 (GMT) Received: from sa3.bezeqint.net ([192.115.104.17]) by smtp.gentoo.org with esmtp (Exim 4.42) id 1CnQtw-0001gt-Gh for dsd@gentoo.org; Sun, 09 Jan 2005 00:25:48 +0000 Received: from localhost (unknown [127.0.0.1]) by sa3.bezeqint.net (Bezeq International SMTP out Mail Server) with ESMTP id 755E433986; Sun, 9 Jan 2005 02:13:55 +0200 (IST) Received: from sa3.bezeqint.net ([127.0.0.1]) by localhost (sa3 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12461-04; Sun, 9 Jan 2005 02:13:54 +0200 (IST) Received: from localhost (unknown [81.218.119.22]) by sa3.bezeqint.net (Bezeq International SMTP out Mail Server) with ESMTP; Sun, 9 Jan 2005 02:13:54 +0200 (IST) Received: by localhost (Postfix, from userid 1000) id 826C542A1; Sun, 9 Jan 2005 02:44:01 +0200 (IST) Date: Sun, 9 Jan 2005 02:44:01 +0200 From: Sasha Khapyorsky To: goldberg@prep2.technion.ac.il, marvstod@comcast.com Cc: dsd@gentoo.org, discuss@linmodems.org Subject: [patch] amrmo_init.c for 2.6.10 Message-ID: <20050109004401.GA12246@tecr> Mail-Followup-To: goldberg@prep2.technion.ac.il, marvstod@comcast.com, dsd@gentoo.org, discuss@linmodems.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6i X-Virus-Scanned: amavisd-new at bezeqint.net X-Virus-Scan: scanned X-Spam-Checker-Version: SpamAssassin 3.0.2-gr0 (2004-11-16) on zog.reactivated.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,NO_DNS_FOR_FROM autolearn=no version=3.0.2-gr0 Hello Jacques, MarvS, Below is patch for slmodem-2.9.9[-alsa]/drivers/amrmo_init.c . This should fix 2.6.10 incompatibilities and still work with earlier kernels. Thanks and Best Regards, Sasha. --- orig/drivers/amrmo_init.c +++ mod/drivers/amrmo_init.c @@ -58,6 +58,9 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #define OLD_KERNEL 1 #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) +#define pci_register_driver(drv) ( pci_register_driver(drv) ? 0 : -ENODEV ) +#endif #ifdef OLD_KERNEL #define iminor(i) MINOR((i)->i_rdev) @@ -350,7 +353,8 @@ if (count > sizeof(amrmo->ibuf)) count = sizeof(amrmo->ibuf); ret = amrmo_card_read(amrmo->card,amrmo->ibuf,count); - copy_to_user(buffer,amrmo->ibuf,ret); + if(copy_to_user(buffer,amrmo->ibuf,ret)) + return -EFAULT; return ret; } @@ -363,7 +367,8 @@ return -EFAULT; if (count > sizeof(amrmo->obuf)) count = sizeof(amrmo->obuf); - copy_from_user(amrmo->obuf,buffer,count); + if(copy_from_user(amrmo->obuf,buffer,count)) + return -EFAULT; ret = amrmo_card_write(amrmo->card,amrmo->obuf,count); return ret; } @@ -692,6 +697,7 @@ static int __init amrmo_init(void) { struct pci_dev *dev = NULL; + int err; #ifdef OLD_KERNEL if (!pci_present()) return -ENODEV; @@ -717,7 +723,7 @@ if (dev->driver && dev->driver->remove) dev->driver->remove(dev); dev->driver = NULL; -#else +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) struct device *reldev = get_device(&dev->dev); AMRMO_DBG("device %04x:%04x is grabbed by driver %s: try to release\n", dev->vendor,dev->device, @@ -727,6 +733,9 @@ device_release_driver(reldev); put_device(reldev); } +#else + AMRMO_DBG("device %04x:%04x is grabbed by another driver\n", + dev->vendor,dev->device); #endif } } @@ -739,13 +748,12 @@ return err; } #endif - - if (!pci_register_driver(&amrmo_pci_driver)) { + if ((err = pci_register_driver(&amrmo_pci_driver)) < 0) { pci_unregister_driver(&amrmo_pci_driver); #ifndef OLD_KERNEL class_simple_destroy(amrmo_class); #endif - return -ENODEV; + return err; } if(register_chrdev(AMRMO_MAJOR, "slamr", &amrmo_fops) < 0) {