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");
MODULE_DESCRIPTION("Driver for the Digi International Neo and Classic PCI based product line");
MODULE_SUPPORTED_DEVICE("dgnc");
/* File operations permitted on Control/Management major. */
static const struct file_operations dgnc_board_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = dgnc_mgmt_ioctl,
......@@ -39,8 +37,6 @@ static const struct file_operations dgnc_board_fops = {
.release = dgnc_mgmt_close
};
/* Globals */
uint dgnc_num_boards;
struct dgnc_board *dgnc_board[MAXBOARDS];
DEFINE_SPINLOCK(dgnc_global_lock);
......@@ -48,12 +44,8 @@ DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
uint dgnc_major;
int dgnc_poll_tick = 20; /* Poll interval - 20 ms */
/* Static vars. */
static struct class *dgnc_class;
/* Poller stuff */
static ulong dgnc_poll_time; /* Time of next poll */
static uint dgnc_poll_stop; /* Used to tell poller to stop */
static struct timer_list dgnc_poll_timer;
......@@ -95,7 +87,6 @@ static const struct board_id dgnc_ids[] = {
};
/* Remap PCI memory. */
static int dgnc_do_remap(struct dgnc_board *brd)
{
brd->re_map_membase = ioremap(brd->membase, 0x1000);
......@@ -105,11 +96,8 @@ static int dgnc_do_remap(struct dgnc_board *brd)
return 0;
}
/*
* dgnc_found_board()
*
* A board has been found, init it.
*/
/* A board has been found, initialize it. */
static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
{
struct dgnc_board *brd;
......@@ -117,7 +105,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
int i = 0;
int rc = 0;
/* get the board structure and prep it */
brd = kzalloc(sizeof(*brd), GFP_KERNEL);
if (!brd)
return ERR_PTR(-ENOMEM);
......@@ -168,7 +155,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
* 4 Memory Mapped UARTs and Status
*/
/* get the PCI Base Address Registers */
brd->membase = pci_resource_start(pdev, 4);
if (!brd->membase) {
......@@ -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 = ((unsigned int)(brd->iobase)) & 0xFFFE;
/* Assign the board_ops struct */
brd->bd_ops = &dgnc_cls_ops;
brd->bd_uart_offset = 0x8;
......@@ -234,7 +219,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
else
brd->dpatype = T_NEO | T_PCIBUS;
/* get the PCI Base Address Registers */
brd->membase = pci_resource_start(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)
else
brd->membase &= ~15;
/* Assign the board_ops struct */
brd->bd_ops = &dgnc_neo_ops;
brd->bd_uart_offset = 0x200;
......@@ -269,7 +252,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
goto failed;
}
/* init our poll helper tasklet */
tasklet_init(&brd->helper_tasklet,
brd->bd_ops->tasklet,
(unsigned long)brd);
......@@ -306,30 +288,12 @@ static void dgnc_free_irq(struct dgnc_board *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.
*/
static void dgnc_poll_handler(ulong dummy)
{
struct dgnc_board *brd;
......@@ -337,19 +301,16 @@ static void dgnc_poll_handler(ulong dummy)
int i;
unsigned long new_time;
/* Go thru each board, kicking off a tasklet for each if needed */
for (i = 0; i < dgnc_num_boards; i++) {
brd = dgnc_board[i];
spin_lock_irqsave(&brd->bd_lock, flags);
/* If board is in a failed state don't schedule a tasklet */
if (brd->state == BOARD_FAILED) {
spin_unlock_irqrestore(&brd->bd_lock, flags);
continue;
}
/* Schedule a poll helper task */
tasklet_schedule(&brd->helper_tasklet);
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)
int rc;
struct dgnc_board *brd;
/* wake up and enable device */
rc = pci_enable_device(pdev);
if (rc)
return -EIO;
......@@ -388,8 +348,6 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (IS_ERR(brd))
return PTR_ERR(brd);
/* Do tty device initialization. */
rc = dgnc_tty_register(brd);
if (rc < 0) {
pr_err(DRVSTR ": Can't register tty devices (%d)\n", rc);
......@@ -431,24 +389,14 @@ static struct pci_driver dgnc_driver = {
.id_table = dgnc_pci_tbl,
};
/* Start of driver. */
static int dgnc_start(void)
{
int rc = 0;
unsigned long flags;
struct device *dev;
/* make sure timer is initialized before we do anything else */
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);
if (rc < 0) {
pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc);
......@@ -491,11 +439,7 @@ static int dgnc_start(void)
return rc;
}
/*
* dgnc_cleanup_board()
*
* Free all the memory associated with a board
*/
/* Free all the memory associated with a board */
static void dgnc_cleanup_board(struct dgnc_board *brd)
{
int i = 0;
......@@ -527,7 +471,6 @@ static void dgnc_cleanup_board(struct dgnc_board *brd)
brd->re_map_membase = NULL;
}
/* Free all allocated channels structs */
for (i = 0; i < MAXPORTS ; i++) {
if (brd->channels[i]) {
kfree(brd->channels[i]->ch_rqueue);
......@@ -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)
{
cleanup();
pci_unregister_driver(&dgnc_driver);
}
/*
* init_module()
*
* Module load. This is where it all starts.
*/
static int __init dgnc_init_module(void)
{
int rc;
/* Initialize global stuff */
rc = dgnc_start();
if (rc < 0)
return rc;
/* Find and configure all the cards */
rc = pci_register_driver(&dgnc_driver);
if (rc) {
pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n");
......
......@@ -20,11 +20,11 @@
#include <linux/kernel.h>
#include <linux/ctype.h>
#include <linux/sched.h> /* For jiffies, task states */
#include <linux/interrupt.h> /* For tasklet and interrupt structs/defines */
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/serial_reg.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_pci.h"
......@@ -33,10 +33,8 @@
/* Our "in use" variables, to enforce 1 open only */
static int dgnc_mgmt_in_use[MAXMGMTDEVICES];
/*
* dgnc_mgmt_open()
*
* Open the mgmt/downld/dpa device
/**
* dgnc_mgmt_open() - Open the mgmt/downld/dpa device.
*/
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);
/* mgmt device */
if (minor >= MAXMGMTDEVICES) {
rc = -ENXIO;
goto out;
......@@ -64,10 +61,8 @@ int dgnc_mgmt_open(struct inode *inode, struct file *file)
return rc;
}
/*
* dgnc_mgmt_close()
*
* Open the mgmt/dpa device
/**
* dgnc_mgmt_close() - Close the mgmt/dpa device
*/
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);
/* mgmt device */
if (minor >= MAXMGMTDEVICES) {
rc = -ENXIO;
goto out;
......@@ -90,12 +84,9 @@ int dgnc_mgmt_close(struct inode *inode, struct file *file)
return rc;
}
/*
* dgnc_mgmt_ioctl()
*
* ioctl the mgmt/dpa device
/**
* dgnc_mgmt_ioctl() - Ioctl the mgmt/dpa device.
*/
long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
unsigned long flags;
......@@ -176,11 +167,9 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
board = ni.board;
channel = ni.channel;
/* Verify boundaries on board */
if (board >= dgnc_num_boards)
return -ENODEV;
/* Verify boundaries on channel */
if (channel >= dgnc_board[board]->nasync)
return -ENODEV;
......
This diff is collapsed.
This diff is collapsed.
......@@ -2,12 +2,11 @@
#include <linux/sched/signal.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
*
* Returns 0 if timed out, !0 (showing signal) if interrupted by a signal.
* Return: 0 if timed out, if interrupted by a signal return signal.
*/
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