mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: greg@kroah.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -mm 1/2] drivers/char/isicom old api rewritten
Date: Sat, 10 Sep 2005 16:53:56 -0700	[thread overview]
Message-ID: <20050910165356.1ddbcc0c.akpm@osdl.org> (raw)
In-Reply-To: <43236A02.9070301@gmail.com>

Jiri Slaby <jirislaby@gmail.com> wrote:
>
> This patch removes old api in pci probing and replaces it with new.
>  Firmware loading added.
> 
>  Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz>
> 
>   drivers/char/isicom.c  | 1056 
>  ++++++++++++++++++++++++-------------------------
>   include/linux/isicom.h |   54 --
>   2 files changed, 539 insertions(+), 571 deletions(-)
> 
>  Patch is here for its size (40 KiB):
>  http://www.fi.muni.cz/~xslaby/lnx/isi_main.txt

40k isn't large - please include such patches in the email.


> +sched_again:
> +	if (!re_schedule)
> +	{

coding style.

> +static void unregister_tty_driver(void)
> +static int register_isr(struct isi_board* board, const int index)

Not a great choice of function names, IMO.  Nicer to have "isicom" in the
name.  Your call.

> +
> +	for(t = jiffies + HZ/100; time_before(jiffies, t); )
> +		;

mdelay()

> +	outw(0, base + 0x8); /* Reset */
> +
> +	for(j = 1; j <= 3; j++) {
> +		for(t = jiffies + HZ; time_before(jiffies, t); )
> +			;

mdelay()

> +
> +	switch (signature) {
> +		case 0xa5:
> +			name = "isi608.bin";
> +			break;

We usually do this:

	switch (...) {
	case N:

> +		for(i = 0; i <= 0x2f; i++)	/* a wee bit of delay */
> +			;

eep.   udelay()

> +		for(i = 0; i <= 0x0f; i++)	/* another wee bit of delay */
> +			;

more eep.

> +/* XXX: should I test it by reading it back and comparing with original like
> + * in load firmware package? */
> +#if 0

hrm

> +	case	MIOCTL_READ_FIRMWARE:
> +		if (!capable(CAP_SYS_ADMIN))
> +			return -EPERM;

Is this the right place to be performing permission checks?

> +		if(copy_from_user(&frame, argp, sizeof(bin_header)))

	if (

> +			return -EFAULT;
> +

It's just as well this code if ifdefed out.  Avoid using return statements
buried deep in the logic.  It's just asking for resource leaks, now or in
the future.  Aim for a simgle return point per function, or at least keep
all the returns right at the end of the function.

> +		if ((status=inw(base+0x4))!=0) {
> +			printk(KERN_WARNING "ISILoad:Card%d rejected verify header:\nAddress:0x%x \nCount:0x%x \nStatus:0x%x \n",

80 cols

> +		for(i=0;i<=0x0f;i++);	/* another wee bit of delay */

udelay()

> +
> +	if (card >= BOARD_COUNT) {
> +		return -EPERM;
> +	}

unneeded braces.  embedded `return'

> +
> +static void __devexit isicom_remove(struct pci_dev *pdev)
> +{
> +	int idx;
> +
> +        for(idx = 0; idx < BOARD_COUNT; idx++)
> +		if (isi_card[idx].base == pci_resource_start(pdev, 3))
> +			break;
> +

whitespace weevils at work

> +			printk(KERN_ERR "ISICOM: ISA not supported yet.");

newline

> +	retval = pci_register_driver(&isicom_driver);
> +        if (retval < 0) {
> +		printk(KERN_ERR "ISICOM: Unable to register pci driver.\n");
> +		goto error;
>  	}

weevils

> +#define InterruptTheCard(base) (outw(0,(base)+0xc))
> +#define ClearInterrupt(base) (inw((base)+0x0a))

Somewhat risky identifiers for a header file..

  parent reply	other threads:[~2005-09-10 23:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-10 23:19 Jiri Slaby
2005-09-10 23:21 ` [PATCH -mm 2/2] drivers/char/isicom whitespace cleanup Jiri Slaby
2005-09-10 23:53 ` Andrew Morton [this message]
2005-09-11 22:04   ` [PATCH] drivers/char/isicom old api rewritten (round 2) Jiri Slaby
2005-09-11 22:20     ` Andrew Morton
2005-09-11 23:11       ` [PATCH] drivers/char/isicom old api rewritten (round 3) Jiri Slaby
2005-09-12  4:58         ` Greg KH
2005-09-12 12:58           ` [PATCH] drivers/char/isicom whitespace cleanup Jiri Slaby
2005-09-13 16:49           ` [PATCH 0/5] isicom char driver to 2.6 api Jiri Slaby
2005-09-13 16:52             ` [PATCH 1/5] isicom: whitespace Jiri Slaby
2005-09-13 16:52             ` [PATCH 3/5] isicom: pci probing Jiri Slaby
2005-09-13 17:21               ` Greg KH
2005-09-14  0:10                 ` [PATCH 0/6] isicom char driver rewritten to 2.6 api Jiri Slaby
2005-09-14  0:12                   ` [PATCH 1/6] isicom: Whitespace cleanup Jiri Slaby
2005-09-14  0:12                   ` [PATCH 2/6] isicom: Type conversion and variables deletion Jiri Slaby
2005-09-14  0:12                   ` [PATCH 3/6] isicom: Others little changes Jiri Slaby
2005-09-14  0:13                   ` [PATCH 4/6] isicom: Pci probing added Jiri Slaby
2005-09-14  0:13                   ` [PATCH 5/6] isicom: Firmware loading Jiri Slaby
2005-09-14  0:13                   ` [PATCH 6/6] isicom: More whitespaces and coding style Jiri Slaby
2005-09-13 16:52             ` [PATCH 4/5] isicom: firmware Jiri Slaby
2005-09-13 16:52             ` [PATCH 2/5] isicom: types Jiri Slaby
2005-09-13 16:52             ` [PATCH 5/5] isicom: more whitespace Jiri Slaby

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=20050910165356.1ddbcc0c.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome