aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmeya Palande <2ameya@gmail.com>2010-02-24 13:18:28 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-03 19:43:04 -0500
commit21b0838c1a03686277e0cfeda42015e4538b9ea3 (patch)
tree7bf4aa8b54e5105298979d27d780f9294a90fe99
parent092579690107ffdf9b146de7e67379d8434e9bb0 (diff)
Staging: crystalhd: Misc improvements for crystalhd_lnx.c
This patch does following improvements: 1. Follow kernel style for comments 2. Reorganize code for readability improvement 3. Use PCI helper macros 4. Use __devinit, __devexit, __devexit_p at necessary places 5. Mark functions and data as static when it is not exported Signed-off-by: Ameya Palande <2ameya@gmail.com> Cc: Naren Sankar <nsankar@broadcom.com> Cc: Jarod Wilson <jarod@wilsonet.com> Cc: Scott Davilla <davilla@4pi.com> Cc: Manu Abraham <abraham.manu@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/crystalhd/crystalhd_cmds.c4
-rw-r--r--drivers/staging/crystalhd/crystalhd_lnx.c77
-rw-r--r--drivers/staging/crystalhd/crystalhd_misc.c3
3 files changed, 35 insertions, 49 deletions
diff --git a/drivers/staging/crystalhd/crystalhd_cmds.c b/drivers/staging/crystalhd/crystalhd_cmds.c
index 39c641d6b672..26145a8d0f78 100644
--- a/drivers/staging/crystalhd/crystalhd_cmds.c
+++ b/drivers/staging/crystalhd/crystalhd_cmds.c
@@ -948,7 +948,7 @@ BC_STATUS crystalhd_user_close(struct crystalhd_cmd *ctx, struct crystalhd_user
948 * 948 *
949 * Called at the time of driver load. 949 * Called at the time of driver load.
950 */ 950 */
951BC_STATUS crystalhd_setup_cmd_context(struct crystalhd_cmd *ctx, 951BC_STATUS __devinit crystalhd_setup_cmd_context(struct crystalhd_cmd *ctx,
952 struct crystalhd_adp *adp) 952 struct crystalhd_adp *adp)
953{ 953{
954 int i = 0; 954 int i = 0;
@@ -983,7 +983,7 @@ BC_STATUS crystalhd_setup_cmd_context(struct crystalhd_cmd *ctx,
983 * 983 *
984 * Called at the time of driver un-load. 984 * Called at the time of driver un-load.
985 */ 985 */
986BC_STATUS crystalhd_delete_cmd_context(struct crystalhd_cmd *ctx) 986BC_STATUS __devexit crystalhd_delete_cmd_context(struct crystalhd_cmd *ctx)
987{ 987{
988 BCMLOG(BCMLOG_DBG, "Deleting Command context..\n"); 988 BCMLOG(BCMLOG_DBG, "Deleting Command context..\n");
989 989
diff --git a/drivers/staging/crystalhd/crystalhd_lnx.c b/drivers/staging/crystalhd/crystalhd_lnx.c
index 1f36b4db6fce..3eac70aa213c 100644
--- a/drivers/staging/crystalhd/crystalhd_lnx.c
+++ b/drivers/staging/crystalhd/crystalhd_lnx.c
@@ -1,28 +1,19 @@
1/*************************************************************************** 1/***************************************************************************
2 * Copyright (c) 2005-2009, Broadcom Corporation. 2 BCM70010 Linux driver
3 * 3 Copyright (c) 2005-2009, Broadcom Corporation.
4 * Name: crystalhd_lnx . c 4
5 * 5 This driver is free software; you can redistribute it and/or modify
6 * Description: 6 it under the terms of the GNU General Public License as published by
7 * BCM70010 Linux driver 7 the Free Software Foundation, version 2 of the License.
8 * 8
9 * HISTORY: 9 This driver is distributed in the hope that it will be useful,
10 * 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ********************************************************************** 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * This file is part of the crystalhd device driver. 12 GNU General Public License for more details.
13 * 13
14 * This driver is free software; you can redistribute it and/or modify 14 You should have received a copy of the GNU General Public License
15 * it under the terms of the GNU General Public License as published by 15 along with this driver. If not, see <http://www.gnu.org/licenses/>.
16 * the Free Software Foundation, version 2 of the License. 16***************************************************************************/
17 *
18 * This driver is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this driver. If not, see <http://www.gnu.org/licenses/>.
25 **********************************************************************/
26 17
27#include <linux/version.h> 18#include <linux/version.h>
28 19
@@ -268,7 +259,7 @@ static int chd_dec_api_cmd(struct crystalhd_adp *adp, unsigned long ua,
268 return rc; 259 return rc;
269} 260}
270 261
271/* ========================= API interfaces =================================*/ 262/* API interfaces */
272static int chd_dec_ioctl(struct inode *in, struct file *fd, 263static int chd_dec_ioctl(struct inode *in, struct file *fd,
273 unsigned int cmd, unsigned long ua) 264 unsigned int cmd, unsigned long ua)
274{ 265{
@@ -358,7 +349,7 @@ static const struct file_operations chd_dec_fops = {
358 .release = chd_dec_close, 349 .release = chd_dec_close,
359}; 350};
360 351
361static int chd_dec_init_chdev(struct crystalhd_adp *adp) 352static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp)
362{ 353{
363 crystalhd_ioctl_data *temp; 354 crystalhd_ioctl_data *temp;
364 struct device *dev; 355 struct device *dev;
@@ -420,7 +411,7 @@ fail:
420 return rc; 411 return rc;
421} 412}
422 413
423static void chd_dec_release_chdev(struct crystalhd_adp *adp) 414static void __devexit chd_dec_release_chdev(struct crystalhd_adp *adp)
424{ 415{
425 crystalhd_ioctl_data *temp = NULL; 416 crystalhd_ioctl_data *temp = NULL;
426 if (!adp) 417 if (!adp)
@@ -446,7 +437,7 @@ static void chd_dec_release_chdev(struct crystalhd_adp *adp)
446 crystalhd_delete_elem_pool(adp); 437 crystalhd_delete_elem_pool(adp);
447} 438}
448 439
449static int chd_pci_reserve_mem(struct crystalhd_adp *pinfo) 440static int __devinit chd_pci_reserve_mem(struct crystalhd_adp *pinfo)
450{ 441{
451 int rc; 442 int rc;
452 unsigned long bar2 = pci_resource_start(pinfo->pdev, 2); 443 unsigned long bar2 = pci_resource_start(pinfo->pdev, 2);
@@ -499,7 +490,7 @@ static int chd_pci_reserve_mem(struct crystalhd_adp *pinfo)
499 return 0; 490 return 0;
500} 491}
501 492
502static void chd_pci_release_mem(struct crystalhd_adp *pinfo) 493static void __devexit chd_pci_release_mem(struct crystalhd_adp *pinfo)
503{ 494{
504 if (!pinfo) 495 if (!pinfo)
505 return; 496 return;
@@ -514,7 +505,7 @@ static void chd_pci_release_mem(struct crystalhd_adp *pinfo)
514} 505}
515 506
516 507
517static void chd_dec_pci_remove(struct pci_dev *pdev) 508static void __devexit chd_dec_pci_remove(struct pci_dev *pdev)
518{ 509{
519 struct crystalhd_adp *pinfo; 510 struct crystalhd_adp *pinfo;
520 BC_STATUS sts = BC_STS_SUCCESS; 511 BC_STATUS sts = BC_STS_SUCCESS;
@@ -542,7 +533,7 @@ static void chd_dec_pci_remove(struct pci_dev *pdev)
542 g_adp_info = NULL; 533 g_adp_info = NULL;
543} 534}
544 535
545static int chd_dec_pci_probe(struct pci_dev *pdev, 536static int __devinit chd_dec_pci_probe(struct pci_dev *pdev,
546 const struct pci_device_id *entry) 537 const struct pci_device_id *entry)
547{ 538{
548 struct crystalhd_adp *pinfo; 539 struct crystalhd_adp *pinfo;
@@ -621,7 +612,6 @@ static int chd_dec_pci_probe(struct pci_dev *pdev,
621 g_adp_info = pinfo; 612 g_adp_info = pinfo;
622 613
623 return 0; 614 return 0;
624
625} 615}
626 616
627#ifdef CONFIG_PM 617#ifdef CONFIG_PM
@@ -700,24 +690,22 @@ int chd_dec_pci_resume(struct pci_dev *pdev)
700} 690}
701#endif 691#endif
702 692
703static struct pci_device_id chd_dec_pci_id_table[] = { 693static DEFINE_PCI_DEVICE_TABLE(chd_dec_pci_id_table) = {
704/* vendor, device, subvendor, subdevice, class, classmask, driver_data */ 694 { PCI_VDEVICE(BROADCOM, 0x1612), 8 },
705 { 0x14e4, 0x1612, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 },
706 { 0, }, 695 { 0, },
707}; 696};
697MODULE_DEVICE_TABLE(pci, chd_dec_pci_id_table);
708 698
709struct pci_driver bc_chd_70012_driver = { 699static struct pci_driver bc_chd_70012_driver = {
710 .name = "Broadcom 70012 Decoder", 700 .name = "Broadcom 70012 Decoder",
711 .probe = chd_dec_pci_probe, 701 .probe = chd_dec_pci_probe,
712 .remove = chd_dec_pci_remove, 702 .remove = __devexit_p(chd_dec_pci_remove),
713 .id_table = chd_dec_pci_id_table, 703 .id_table = chd_dec_pci_id_table,
714#ifdef CONFIG_PM 704#ifdef CONFIG_PM
715 .suspend = chd_dec_pci_suspend, 705 .suspend = chd_dec_pci_suspend,
716 .resume = chd_dec_pci_resume 706 .resume = chd_dec_pci_resume
717#endif 707#endif
718}; 708};
719MODULE_DEVICE_TABLE(pci, chd_dec_pci_id_table);
720
721 709
722void chd_set_log_level(struct crystalhd_adp *adp, char *arg) 710void chd_set_log_level(struct crystalhd_adp *adp, char *arg)
723{ 711{
@@ -744,7 +732,7 @@ struct crystalhd_adp *chd_get_adp(void)
744 return g_adp_info; 732 return g_adp_info;
745} 733}
746 734
747int __init chd_dec_module_init(void) 735static int __init chd_dec_module_init(void)
748{ 736{
749 int rc; 737 int rc;
750 738
@@ -759,22 +747,19 @@ int __init chd_dec_module_init(void)
759 747
760 return rc; 748 return rc;
761} 749}
750module_init(chd_dec_module_init);
762 751
763void __exit chd_dec_module_cleanup(void) 752static void __exit chd_dec_module_cleanup(void)
764{ 753{
765 BCMLOG(BCMLOG_DATA, "unloading crystalhd %d.%d.%d \n", 754 BCMLOG(BCMLOG_DATA, "unloading crystalhd %d.%d.%d \n",
766 crystalhd_kmod_major, crystalhd_kmod_minor, crystalhd_kmod_rev); 755 crystalhd_kmod_major, crystalhd_kmod_minor, crystalhd_kmod_rev);
767 756
768 pci_unregister_driver(&bc_chd_70012_driver); 757 pci_unregister_driver(&bc_chd_70012_driver);
769} 758}
770 759module_exit(chd_dec_module_cleanup);
771 760
772MODULE_AUTHOR("Naren Sankar <nsankar@broadcom.com>"); 761MODULE_AUTHOR("Naren Sankar <nsankar@broadcom.com>");
773MODULE_AUTHOR("Prasad Bolisetty <prasadb@broadcom.com>"); 762MODULE_AUTHOR("Prasad Bolisetty <prasadb@broadcom.com>");
774MODULE_DESCRIPTION(CRYSTAL_HD_NAME); 763MODULE_DESCRIPTION(CRYSTAL_HD_NAME);
775MODULE_LICENSE("GPL"); 764MODULE_LICENSE("GPL");
776MODULE_ALIAS("bcm70012"); 765MODULE_ALIAS("bcm70012");
777
778module_init(chd_dec_module_init);
779module_exit(chd_dec_module_cleanup);
780
diff --git a/drivers/staging/crystalhd/crystalhd_misc.c b/drivers/staging/crystalhd/crystalhd_misc.c
index 32e632c2ab3e..587dcc477865 100644
--- a/drivers/staging/crystalhd/crystalhd_misc.c
+++ b/drivers/staging/crystalhd/crystalhd_misc.c
@@ -959,7 +959,8 @@ void crystalhd_destroy_dio_pool(struct crystalhd_adp *adp)
959 * Create general purpose list element pool to hold pending, 959 * Create general purpose list element pool to hold pending,
960 * and active requests. 960 * and active requests.
961 */ 961 */
962int crystalhd_create_elem_pool(struct crystalhd_adp *adp, uint32_t pool_size) 962int __devinit crystalhd_create_elem_pool(struct crystalhd_adp *adp,
963 uint32_t pool_size)
963{ 964{
964 uint32_t i; 965 uint32_t i;
965 crystalhd_elem_t *temp; 966 crystalhd_elem_t *temp;