public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Wen Xiong <wendyx@us.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
Date: Fri, 4 Mar 2005 22:44:45 -0800	[thread overview]
Message-ID: <20050305064445.GA8447@kroah.com> (raw)
In-Reply-To: <4228CE5C.9010207@us.ltcfwd.linux.ibm.com>

On Fri, Mar 04, 2005 at 04:08:44PM -0500, Wen Xiong wrote:
> +/************************************************************************
> + * Structure used with ioctl commands for DIGI parameters.
> + ************************************************************************/
> +struct digi_t {
> +	unsigned short	digi_flags;		/* Flags (see above)	*/
> +	unsigned short	digi_maxcps;		/* Max printer CPS	*/
> +	unsigned short	digi_maxchar;		/* Max chars in print queue */
> +	unsigned short	digi_bufsize;		/* Buffer size		*/
> +	unsigned char	digi_onlen;		/* Length of ON string	*/
> +	unsigned char	digi_offlen;		/* Length of OFF string	*/
> +	char		digi_onstr[DIGI_PLEN];	/* Printer on string	*/
> +	char		digi_offstr[DIGI_PLEN];	/* Printer off string	*/
> +	char		digi_term[DIGI_TSIZ];	/* terminal string	*/
> +};

Oops, don't use _t for a structure name please.

> +#ifndef __JSM_DRIVER_H
> +#define __JSM_DRIVER_H
> +
> +#include <linux/kernel.h>
> +#include <linux/version.h>
> +#include <linux/types.h>	/* To pick up the varions Linux types */
> +#include <linux/tty.h>		
> +#include <linux/serial_core.h>
> +#include <linux/serial_reg.h>
> +#include <linux/interrupt.h>	/* For irqreturn_t type */
> +#include <linux/module.h>	
> +#include <linux/moduleparam.h>	
> +#include <linux/kdev_t.h>	
> +#include <linux/pci.h>
> +#include <linux/pci_ids.h>
> +#include <linux/device.h>
> +#include <linux/config.h>

Don't put header files in header files if you can help it.  It really
isn't needed here, and odds are, you are including files you don't
really need for each of the different driver .c files.  The build will
go faster if you don't do that.

Also, check your ordering, some of those .h files already included the
ones above it.

> +#include "digi.h"		/* Digi specific ioctl header */

Why do you have your own ioctls?  Please do not add any new ones to the
kernel.

> +#define DRVSTR	"jsm"		/* Driver name string */

What is this for?

> +#define DPRINTK(nlevel, klevel, fmt, args...) \
> +	(void)((DBG_##nlevel & debug) && \
> +	printk(KERN_##klevel "%s: " fmt, \
> +		__FUNCTION__, ## args)); 

Please use dev_dbg() or at least dev_printk() for this.  It provides
consistancy with the rest of the kernel, and it helps identify your
device much better.

> +#define JSM_MAJOR(x)	(imajor(x))
> +#define JSM_MINOR(x)	(iminor(x))

Not needed, please don't use.

> +#ifndef _POSIX_VDISABLE
> +#define	_POSIX_VDISABLE '\0'
> +#endif

What would have defined that before?

> +/*
> + * Our Global Variables.
> + */
> +extern struct	uart_driver jsm_uart_driver;
> +extern struct	board_ops jsm_neo_ops;
> +extern int	debug;
> +extern int	rawreadok;

Both of these are bad global variable names.

> +extern int	jsm_driver_state;	/* The state of the driver	*/
> +extern char	*jsm_driver_state_text[];/* Array of driver state text */
> +
> +extern spinlock_t jsm_board_head_lock;
> +static LIST_HEAD(jsm_board_head);

Hm, static variable in a header file?  bad...

> +/*************************************************************************
> + *
> + * Prototypes for non-static functions used in more than one module
> + *
> + *************************************************************************/
> +extern char *jsm_ioctl_name(int cmd);
> +extern int get_jsm_board_number(void);

Bad name for a global function, put the "jsm" at the front please.

thanks,

greg k-h

  reply	other threads:[~2005-03-05 16:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-27 23:40 [ patch 6/7] drivers/serial/jsm: new serial device driver Wen Xiong
2005-02-28  0:47 ` Jeff Garzik
2005-02-28  3:22   ` Christoph Hellwig
2005-02-28  0:56 ` Rik van Riel
2005-02-28  1:45 ` Nish Aravamudan
2005-02-28  6:55 ` Greg KH
2005-03-04 21:08   ` Wen Xiong
2005-03-05  6:44     ` Greg KH [this message]
2005-03-07 22:48       ` Wen Xiong
2005-03-08  6:42         ` Greg KH
2005-03-08 18:42           ` Wen Xiong
2005-03-09  6:04             ` Greg KH
2005-03-09 15:50               ` Wen Xiong
2005-03-09 16:31                 ` Greg KH
2005-03-09 17:31                   ` Wen Xiong
  -- strict thread matches above, loose matches on Subject: below --
2005-03-09 17:42 Kilau, Scott
2005-03-09 19:12 ` Greg KH
2005-03-09 22:11   ` Wen Xiong
2005-03-09 19:35 Kilau, Scott
2005-03-09 19:51 ` Greg KH
2005-03-09 20:33   ` Wen Xiong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050305064445.GA8447@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wendyx@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox