[PATCH] crystalhd: Misc improvements for crystalhd_lnx.c

Ameya Palande 2ameya at gmail.com
Tue Feb 23 19:47:25 UTC 2010


This patch does following improvements:

1. Follow kernel style for comments
2. Reorganize code for readability improvement
3. Use PCI_VDEVICE macro in pci id table
4. Use __devexit_p for pci driver remove function

Signed-off-by: Ameya Palande <2ameya at gmail.com>
To: Naren Sankar <nsankar at broadcom.com>
Cc: Greg Kroah-Hartman <greg at kroah.com>
Cc: Jarod Wilson <jarod at wilsonet.com>
Cc: Scott Davilla <davilla at 4pi.com>
Cc: Manu Abraham <abraham.manu at gmail.com>
Cc: devel at linuxdriverproject.org
---
I have done only following testing due to lack of hardware:
1. Compilation
2. checkpatch.pl

 drivers/staging/crystalhd/crystalhd_lnx.c |   62 +++++++++++-----------------
 1 files changed, 24 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/crystalhd/crystalhd_lnx.c b/drivers/staging/crystalhd/crystalhd_lnx.c
index 1f36b4d..9704c23 100644
--- a/drivers/staging/crystalhd/crystalhd_lnx.c
+++ b/drivers/staging/crystalhd/crystalhd_lnx.c
@@ -1,28 +1,19 @@
 /***************************************************************************
- * Copyright (c) 2005-2009, Broadcom Corporation.
- *
- *  Name: crystalhd_lnx . c
- *
- *  Description:
- *		BCM70010 Linux driver
- *
- *  HISTORY:
- *
- **********************************************************************
- * This file is part of the crystalhd device driver.
- *
- * This driver is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 2 of the License.
- *
- * This driver is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this driver.  If not, see <http://www.gnu.org/licenses/>.
- **********************************************************************/
+  BCM70010 Linux driver
+  Copyright (c) 2005-2009, Broadcom Corporation.
+
+  This driver is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, version 2 of the License.
+
+  This driver is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this driver.  If not, see <http://www.gnu.org/licenses/>.
+***************************************************************************/
 
 #include <linux/version.h>
 
@@ -268,7 +259,7 @@ static int chd_dec_api_cmd(struct crystalhd_adp *adp, unsigned long ua,
 	return rc;
 }
 
-/* ========================= API interfaces =================================*/
+/* API interfaces */
 static int chd_dec_ioctl(struct inode *in, struct file *fd,
 			 unsigned int cmd, unsigned long ua)
 {
@@ -701,23 +692,21 @@ int chd_dec_pci_resume(struct pci_dev *pdev)
 #endif
 
 static struct pci_device_id chd_dec_pci_id_table[] = {
-/*	vendor, device, subvendor, subdevice, class, classmask, driver_data */
-	{ 0x14e4, 0x1612, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 },
+	{ PCI_VDEVICE(BROADCOM, 0x1612), 8 },
 	{ 0, },
 };
+MODULE_DEVICE_TABLE(pci, chd_dec_pci_id_table);
 
-struct pci_driver bc_chd_70012_driver = {
+static struct pci_driver bc_chd_70012_driver = {
 	.name     = "Broadcom 70012 Decoder",
 	.probe    = chd_dec_pci_probe,
-	.remove   = chd_dec_pci_remove,
+	.remove   = __devexit_p(chd_dec_pci_remove),
 	.id_table = chd_dec_pci_id_table,
 #ifdef CONFIG_PM
 	.suspend  = chd_dec_pci_suspend,
 	.resume   = chd_dec_pci_resume
 #endif
 };
-MODULE_DEVICE_TABLE(pci, chd_dec_pci_id_table);
-
 
 void chd_set_log_level(struct crystalhd_adp *adp, char *arg)
 {
@@ -744,7 +733,7 @@ struct crystalhd_adp *chd_get_adp(void)
 	return g_adp_info;
 }
 
-int __init chd_dec_module_init(void)
+static int __init chd_dec_module_init(void)
 {
 	int rc;
 
@@ -759,22 +748,19 @@ int __init chd_dec_module_init(void)
 
 	return rc;
 }
+module_init(chd_dec_module_init);
 
-void __exit chd_dec_module_cleanup(void)
+static void __exit chd_dec_module_cleanup(void)
 {
 	BCMLOG(BCMLOG_DATA, "unloading crystalhd %d.%d.%d \n",
 	       crystalhd_kmod_major, crystalhd_kmod_minor, crystalhd_kmod_rev);
 
 	pci_unregister_driver(&bc_chd_70012_driver);
 }
-
+module_exit(chd_dec_module_cleanup);
 
 MODULE_AUTHOR("Naren Sankar <nsankar at broadcom.com>");
 MODULE_AUTHOR("Prasad Bolisetty <prasadb at broadcom.com>");
 MODULE_DESCRIPTION(CRYSTAL_HD_NAME);
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("bcm70012");
-
-module_init(chd_dec_module_init);
-module_exit(chd_dec_module_cleanup);
-
-- 
1.6.3.3




More information about the devel mailing list