Commit 51061652 authored by Tobin C. Harding's avatar Tobin C. Harding Committed by Greg Kroah-Hartman

staging: dgnc: remove unnecessary comments

TODO file lists task to remove unnecessary comments.

Make initial attempt at removing unnecessary comments. Choose not to
be to vicious in removal. We can remove more once the driver is
cleaned up/tested some more.

For functions with internal linkage, reduce the function comment where
possible. For functions with external linkage, migrate the function
comment to kernel doc format.
Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2539fc0c
This diff is collapsed.
...@@ -30,8 +30,6 @@ MODULE_AUTHOR("Digi International, http://www.digi.com"); ...@@ -30,8 +30,6 @@ MODULE_AUTHOR("Digi International, http://www.digi.com");
MODULE_DESCRIPTION("Driver for the Digi International Neo and Classic PCI based product line"); MODULE_DESCRIPTION("Driver for the Digi International Neo and Classic PCI based product line");
MODULE_SUPPORTED_DEVICE("dgnc"); MODULE_SUPPORTED_DEVICE("dgnc");
/* File operations permitted on Control/Management major. */
static const struct file_operations dgnc_board_fops = { static const struct file_operations dgnc_board_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.unlocked_ioctl = dgnc_mgmt_ioctl, .unlocked_ioctl = dgnc_mgmt_ioctl,
...@@ -39,8 +37,6 @@ static const struct file_operations dgnc_board_fops = { ...@@ -39,8 +37,6 @@ static const struct file_operations dgnc_board_fops = {
.release = dgnc_mgmt_close .release = dgnc_mgmt_close
}; };
/* Globals */
uint dgnc_num_boards; uint dgnc_num_boards;
struct dgnc_board *dgnc_board[MAXBOARDS]; struct dgnc_board *dgnc_board[MAXBOARDS];
DEFINE_SPINLOCK(dgnc_global_lock); DEFINE_SPINLOCK(dgnc_global_lock);
...@@ -48,12 +44,8 @@ DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */ ...@@ -48,12 +44,8 @@ DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
uint dgnc_major; uint dgnc_major;
int dgnc_poll_tick = 20; /* Poll interval - 20 ms */ int dgnc_poll_tick = 20; /* Poll interval - 20 ms */
/* Static vars. */
static struct class *dgnc_class; static struct class *dgnc_class;
/* Poller stuff */
static ulong dgnc_poll_time; /* Time of next poll */ static ulong dgnc_poll_time; /* Time of next poll */
static uint dgnc_poll_stop; /* Used to tell poller to stop */ static uint dgnc_poll_stop; /* Used to tell poller to stop */
static struct timer_list dgnc_poll_timer; static struct timer_list dgnc_poll_timer;
...@@ -95,7 +87,6 @@ static const struct board_id dgnc_ids[] = { ...@@ -95,7 +87,6 @@ static const struct board_id dgnc_ids[] = {
}; };
/* Remap PCI memory. */ /* Remap PCI memory. */
static int dgnc_do_remap(struct dgnc_board *brd) static int dgnc_do_remap(struct dgnc_board *brd)
{ {
brd->re_map_membase = ioremap(brd->membase, 0x1000); brd->re_map_membase = ioremap(brd->membase, 0x1000);
...@@ -105,11 +96,8 @@ static int dgnc_do_remap(struct dgnc_board *brd) ...@@ -105,11 +96,8 @@ static int dgnc_do_remap(struct dgnc_board *brd)
return 0; return 0;
} }
/*
* dgnc_found_board() /* A board has been found, initialize it. */
*
* A board has been found, init it.
*/
static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id) static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
{ {
struct dgnc_board *brd; struct dgnc_board *brd;
...@@ -117,7 +105,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id) ...@@ -117,7 +105,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
int i = 0; int i = 0;
int rc = 0; int rc = 0;
/* get the board structure and prep it */
brd = kzalloc(sizeof(*brd), GFP_KERNEL); brd = kzalloc(sizeof(*brd), GFP_KERNEL);
if (!brd) if (!brd)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -168,7 +155,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id) ...@@ -168,7 +155,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
* 4 Memory Mapped UARTs and Status * 4 Memory Mapped UARTs and Status
*/ */
/* get the PCI Base Address Registers */
brd->membase = pci_resource_start(pdev, 4); brd->membase = pci_resource_start(pdev, 4);
if (!brd->membase) { if (!brd->membase) {
...@@ -189,7 +175,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id) ...@@ -189,7 +175,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
brd->iobase_end = pci_resource_end(pdev, 1); brd->iobase_end = pci_resource_end(pdev, 1);
brd->iobase = ((unsigned int)(brd->iobase)) & 0xFFFE; brd->iobase = ((unsigned int)(brd->iobase)) & 0xFFFE;
/* Assign the board_ops struct */
brd->bd_ops = &dgnc_cls_ops; brd->bd_ops = &dgnc_cls_ops;
brd->bd_uart_offset = 0x8; brd->bd_uart_offset = 0x8;
...@@ -234,7 +219,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id) ...@@ -234,7 +219,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
else else
brd->dpatype = T_NEO | T_PCIBUS; brd->dpatype = T_NEO | T_PCIBUS;
/* get the PCI Base Address Registers */
brd->membase = pci_resource_start(pdev, 0); brd->membase = pci_resource_start(pdev, 0);
brd->membase_end = pci_resource_end(pdev, 0); brd->membase_end = pci_resource_end(pdev, 0);
...@@ -243,7 +227,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id) ...@@ -243,7 +227,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
else else
brd->membase &= ~15; brd->membase &= ~15;
/* Assign the board_ops struct */
brd->bd_ops = &dgnc_neo_ops; brd->bd_ops = &dgnc_neo_ops;
brd->bd_uart_offset = 0x200; brd->bd_uart_offset = 0x200;
...@@ -269,7 +252,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id) ...@@ -269,7 +252,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
goto failed; goto failed;
} }
/* init our poll helper tasklet */
tasklet_init(&brd->helper_tasklet, tasklet_init(&brd->helper_tasklet,
brd->bd_ops->tasklet, brd->bd_ops->tasklet,
(unsigned long)brd); (unsigned long)brd);
...@@ -306,30 +288,12 @@ static void dgnc_free_irq(struct dgnc_board *brd) ...@@ -306,30 +288,12 @@ static void dgnc_free_irq(struct dgnc_board *brd)
free_irq(brd->irq, brd); free_irq(brd->irq, brd);
} }
/*
* Function:
*
* dgnc_poll_handler
*
* Author:
*
* Scott H Kilau
*
* Parameters:
*
* dummy -- ignored
*
* Return Values:
*
* none
*
* Description:
*
* As each timer expires, it determines (a) whether the "transmit"
* waiter needs to be woken up, and (b) whether the poller needs to
* be rescheduled.
*/
/*
* As each timer expires, it determines (a) whether the "transmit"
* waiter needs to be woken up, and (b) whether the poller needs to
* be rescheduled.
*/
static void dgnc_poll_handler(ulong dummy) static void dgnc_poll_handler(ulong dummy)
{ {
struct dgnc_board *brd; struct dgnc_board *brd;
...@@ -337,19 +301,16 @@ static void dgnc_poll_handler(ulong dummy) ...@@ -337,19 +301,16 @@ static void dgnc_poll_handler(ulong dummy)
int i; int i;
unsigned long new_time; unsigned long new_time;
/* Go thru each board, kicking off a tasklet for each if needed */
for (i = 0; i < dgnc_num_boards; i++) { for (i = 0; i < dgnc_num_boards; i++) {
brd = dgnc_board[i]; brd = dgnc_board[i];
spin_lock_irqsave(&brd->bd_lock, flags); spin_lock_irqsave(&brd->bd_lock, flags);
/* If board is in a failed state don't schedule a tasklet */
if (brd->state == BOARD_FAILED) { if (brd->state == BOARD_FAILED) {
spin_unlock_irqrestore(&brd->bd_lock, flags); spin_unlock_irqrestore(&brd->bd_lock, flags);
continue; continue;
} }
/* Schedule a poll helper task */
tasklet_schedule(&brd->helper_tasklet); tasklet_schedule(&brd->helper_tasklet);
spin_unlock_irqrestore(&brd->bd_lock, flags); spin_unlock_irqrestore(&brd->bd_lock, flags);
...@@ -379,7 +340,6 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -379,7 +340,6 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
int rc; int rc;
struct dgnc_board *brd; struct dgnc_board *brd;
/* wake up and enable device */
rc = pci_enable_device(pdev); rc = pci_enable_device(pdev);
if (rc) if (rc)
return -EIO; return -EIO;
...@@ -388,8 +348,6 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -388,8 +348,6 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (IS_ERR(brd)) if (IS_ERR(brd))
return PTR_ERR(brd); return PTR_ERR(brd);
/* Do tty device initialization. */
rc = dgnc_tty_register(brd); rc = dgnc_tty_register(brd);
if (rc < 0) { if (rc < 0) {
pr_err(DRVSTR ": Can't register tty devices (%d)\n", rc); pr_err(DRVSTR ": Can't register tty devices (%d)\n", rc);
...@@ -431,24 +389,14 @@ static struct pci_driver dgnc_driver = { ...@@ -431,24 +389,14 @@ static struct pci_driver dgnc_driver = {
.id_table = dgnc_pci_tbl, .id_table = dgnc_pci_tbl,
}; };
/* Start of driver. */
static int dgnc_start(void) static int dgnc_start(void)
{ {
int rc = 0; int rc = 0;
unsigned long flags; unsigned long flags;
struct device *dev; struct device *dev;
/* make sure timer is initialized before we do anything else */
init_timer(&dgnc_poll_timer); init_timer(&dgnc_poll_timer);
/*
* Register our base character device into the kernel.
* This allows the download daemon to connect to the downld device
* before any of the boards are init'ed.
*
* Register management/dpa devices
*/
rc = register_chrdev(0, "dgnc", &dgnc_board_fops); rc = register_chrdev(0, "dgnc", &dgnc_board_fops);
if (rc < 0) { if (rc < 0) {
pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc); pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc);
...@@ -491,11 +439,7 @@ static int dgnc_start(void) ...@@ -491,11 +439,7 @@ static int dgnc_start(void)
return rc; return rc;
} }
/* /* Free all the memory associated with a board */
* dgnc_cleanup_board()
*
* Free all the memory associated with a board
*/
static void dgnc_cleanup_board(struct dgnc_board *brd) static void dgnc_cleanup_board(struct dgnc_board *brd)
{ {
int i = 0; int i = 0;
...@@ -527,7 +471,6 @@ static void dgnc_cleanup_board(struct dgnc_board *brd) ...@@ -527,7 +471,6 @@ static void dgnc_cleanup_board(struct dgnc_board *brd)
brd->re_map_membase = NULL; brd->re_map_membase = NULL;
} }
/* Free all allocated channels structs */
for (i = 0; i < MAXPORTS ; i++) { for (i = 0; i < MAXPORTS ; i++) {
if (brd->channels[i]) { if (brd->channels[i]) {
kfree(brd->channels[i]->ch_rqueue); kfree(brd->channels[i]->ch_rqueue);
...@@ -567,34 +510,22 @@ static void cleanup(void) ...@@ -567,34 +510,22 @@ static void cleanup(void)
} }
} }
/*
* dgnc_cleanup_module()
*
* Module unload. This is where it all ends.
*/
static void __exit dgnc_cleanup_module(void) static void __exit dgnc_cleanup_module(void)
{ {
cleanup(); cleanup();
pci_unregister_driver(&dgnc_driver); pci_unregister_driver(&dgnc_driver);
} }
/*
* init_module()
*
* Module load. This is where it all starts.
*/
static int __init dgnc_init_module(void) static int __init dgnc_init_module(void)
{ {
int rc; int rc;
/* Initialize global stuff */ /* Initialize global stuff */
rc = dgnc_start(); rc = dgnc_start();
if (rc < 0) if (rc < 0)
return rc; return rc;
/* Find and configure all the cards */ /* Find and configure all the cards */
rc = pci_register_driver(&dgnc_driver); rc = pci_register_driver(&dgnc_driver);
if (rc) { if (rc) {
pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n"); pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n");
......
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/sched.h> /* For jiffies, task states */ #include <linux/sched.h>
#include <linux/interrupt.h> /* For tasklet and interrupt structs/defines */ #include <linux/interrupt.h>
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#include <linux/termios.h> #include <linux/termios.h>
#include <linux/uaccess.h> /* For copy_from_user/copy_to_user */ #include <linux/uaccess.h>
#include "dgnc_driver.h" #include "dgnc_driver.h"
#include "dgnc_pci.h" #include "dgnc_pci.h"
...@@ -33,10 +33,8 @@ ...@@ -33,10 +33,8 @@
/* Our "in use" variables, to enforce 1 open only */ /* Our "in use" variables, to enforce 1 open only */
static int dgnc_mgmt_in_use[MAXMGMTDEVICES]; static int dgnc_mgmt_in_use[MAXMGMTDEVICES];
/* /**
* dgnc_mgmt_open() * dgnc_mgmt_open() - Open the mgmt/downld/dpa device.
*
* Open the mgmt/downld/dpa device
*/ */
int dgnc_mgmt_open(struct inode *inode, struct file *file) int dgnc_mgmt_open(struct inode *inode, struct file *file)
{ {
...@@ -46,7 +44,6 @@ int dgnc_mgmt_open(struct inode *inode, struct file *file) ...@@ -46,7 +44,6 @@ int dgnc_mgmt_open(struct inode *inode, struct file *file)
spin_lock_irqsave(&dgnc_global_lock, flags); spin_lock_irqsave(&dgnc_global_lock, flags);
/* mgmt device */
if (minor >= MAXMGMTDEVICES) { if (minor >= MAXMGMTDEVICES) {
rc = -ENXIO; rc = -ENXIO;
goto out; goto out;
...@@ -64,10 +61,8 @@ int dgnc_mgmt_open(struct inode *inode, struct file *file) ...@@ -64,10 +61,8 @@ int dgnc_mgmt_open(struct inode *inode, struct file *file)
return rc; return rc;
} }
/* /**
* dgnc_mgmt_close() * dgnc_mgmt_close() - Close the mgmt/dpa device
*
* Open the mgmt/dpa device
*/ */
int dgnc_mgmt_close(struct inode *inode, struct file *file) int dgnc_mgmt_close(struct inode *inode, struct file *file)
{ {
...@@ -77,7 +72,6 @@ int dgnc_mgmt_close(struct inode *inode, struct file *file) ...@@ -77,7 +72,6 @@ int dgnc_mgmt_close(struct inode *inode, struct file *file)
spin_lock_irqsave(&dgnc_global_lock, flags); spin_lock_irqsave(&dgnc_global_lock, flags);
/* mgmt device */
if (minor >= MAXMGMTDEVICES) { if (minor >= MAXMGMTDEVICES) {
rc = -ENXIO; rc = -ENXIO;
goto out; goto out;
...@@ -90,12 +84,9 @@ int dgnc_mgmt_close(struct inode *inode, struct file *file) ...@@ -90,12 +84,9 @@ int dgnc_mgmt_close(struct inode *inode, struct file *file)
return rc; return rc;
} }
/* /**
* dgnc_mgmt_ioctl() * dgnc_mgmt_ioctl() - Ioctl the mgmt/dpa device.
*
* ioctl the mgmt/dpa device
*/ */
long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
unsigned long flags; unsigned long flags;
...@@ -176,11 +167,9 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -176,11 +167,9 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
board = ni.board; board = ni.board;
channel = ni.channel; channel = ni.channel;
/* Verify boundaries on board */
if (board >= dgnc_num_boards) if (board >= dgnc_num_boards)
return -ENODEV; return -ENODEV;
/* Verify boundaries on channel */
if (channel >= dgnc_board[board]->nasync) if (channel >= dgnc_board[board]->nasync)
return -ENODEV; return -ENODEV;
......
This diff is collapsed.
This diff is collapsed.
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
#include <linux/sched/signal.h> #include <linux/sched/signal.h>
#include "dgnc_utils.h" #include "dgnc_utils.h"
/* /**
* dgnc_ms_sleep() * dgnc_ms_sleep - Put the driver to sleep
* @ms - milliseconds to sleep
* *
* Put the driver to sleep for x ms's * Return: 0 if timed out, if interrupted by a signal return signal.
*
* Returns 0 if timed out, !0 (showing signal) if interrupted by a signal.
*/ */
int dgnc_ms_sleep(ulong ms) int dgnc_ms_sleep(ulong ms)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment