All of lore.kernel.org
 help / color / mirror / Atom feed
From: "'Christoph Hellwig'" <hch@infradead.org>
To: Osamu Tomita <tomita@cinet.co.jp>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	"'Christoph Hellwig'" <hch@infradead.org>
Subject: Re: [PATCHSET] PC-9800 subarch. support for 2.5.61 (23/26) SCSI
Date: Tue, 18 Feb 2003 10:54:55 +0000	[thread overview]
Message-ID: <20030218105455.D11969@infradead.org> (raw)
In-Reply-To: <20030217142123.GW4799@yuzuki.cinet.co.jp>; from tomita@cinet.co.jp on Mon, Feb 17, 2003 at 11:21:23PM +0900

On Mon, Feb 17, 2003 at 11:21:23PM +0900, Osamu Tomita wrote:
> diff -Nru linux/drivers/scsi/pc980155.c linux98/drivers/scsi/pc980155.c
> --- linux/drivers/scsi/pc980155.c	1970-01-01 09:00:00.000000000 +0900
> +++ linux98/drivers/scsi/pc980155.c	2003-02-17 21:05:25.000000000 +0900
> @@ -0,0 +1,264 @@
> +#include <linux/kernel.h>
> +#include <linux/types.h>

no copyright statement?

> +#include <linux/mm.h>
> +#include <linux/blk.h>
> +#include <linux/sched.h>
> +#include <linux/version.h>
> +#include <linux/init.h>
> +#include <linux/ioport.h>
> +#include <linux/interrupt.h>
> +
> +#include <asm/page.h>
> +#include <asm/pgtable.h>
> +#include <asm/irq.h>
> +#include <asm/dma.h>
> +#include <linux/module.h>
> +
> +#include "scsi.h"
> +#include "hosts.h"
> +#include "wd33c93.h"
> +#include "pc980155.h"
> +#include "pc980155regs.h"
> +
> +#define DEBUG
> +
> +#include<linux/stat.h>

I doj't think you need this.

> +
> +static inline void __print_debug_info(unsigned int);
> +static inline void __print_debug_info(unsigned int a){}
> +#define print_debug_info() __print_debug_info(base_io);

Please remove unused declarations.

> +
> +#define NR_BASE_IOS 4
> +static int nr_base_ios = NR_BASE_IOS;
> +static unsigned int base_ios[NR_BASE_IOS] = {0xcc0, 0xcd0, 0xce0, 0xcf0};
> +static unsigned int  SASR;
> +static unsigned int  SCMD;
> +static wd33c93_regs regs = {&SASR, &SCMD};
> +
> +static struct Scsi_Host *pc980155_host = NULL;

> +static void pc980155_intr_handle(int irq, void *dev_id, struct pt_regs *regp);
> +
> +inline void pc980155_dma_enable(unsigned int base_io){
> +  outb(0x01, REG_CWRITE);
> +  WAIT();
> +}
> +inline void pc980155_dma_disable(unsigned int base_io){
> +  outb(0x02, REG_CWRITE);
> +  WAIT();
> +}

This whole file wants to be reformatted to follow Documentation/CodingStyle.

> +			continue;
> +		}
> +		if (request_dma(dma, "PC-9801-55")) {
> +			printk(KERN_ERR "PC-9801-55: "
> +				"unable to allocate DMA channel %d\n", dma);
> +			free_irq(irq, NULL);
> +			continue;
> +		}

You seems to sometimes miss some cleanup on failures.  cleanups gotos might
help :)

> +
> +		pc980155_host = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));

This can return NULL and you need to handle that.

> +int pc980155_proc_info(char *buf, char **start, off_t off, int len,
> +			int hostno, int in)
> +{
> +	/* NOT SUPPORTED YET! */
> +
> +	if (in) {
> +		return -EPERM;
> +	}
> +	*start = buf;
> +	return sprintf(buf, "Sorry, not supported yet.\n");
> +}

So if it's not supported don't implement this entry point :)

> +
> +int pc980155_setup(char *str)
> +{
> +next:
> +  if (!strncmp(str, "io:", 3)){
> +    base_ios[0] = simple_strtoul(str+3,NULL,0);
> +    nr_base_ios = 1;
> +    while (*str > ' ' && *str != ',')
> +      str++;
> +    if (*str == ','){
> +      str++;
> +      goto next;
> +    }
> +  }
> +  return 0;

This might be easier to read when rewritten into a while loop..

> +}
> +
> +int scsi_pc980155_release(struct Scsi_Host *pc980155_host)
> +{
> +#ifdef MODULE
> +        pc980155_int_disable(regs);
> +        release_region(pc980155_host->io_port, pc980155_host->n_io_port);
> +        free_irq(pc980155_host->irq, NULL);
> +        free_dma(pc980155_host->dma_channel);
> +        wd33c93_release();
> +#endif

no need for the ifdef module here.

> +    return 1;
> +}
> +
> +__setup("pc980155=", pc980155_setup);
> +
> +Scsi_Host_Template driver_template = SCSI_PC980155;

Please don't use the  SCSI_PC980155 macro - declare the struct members here
directly.

> +int pc98_bios_param(struct block_device *bdev, int *ip)

This should _not_ be in sd.c but the lowlevel driver.

> +static spinlock_t wd_lock = SPIN_LOCK_UNLOCKED;

Where is this used?


  reply	other threads:[~2003-02-18 10:44 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-17 13:43 [PATCHSET] PC-9800 subarch. support for 2.5.61 (0/26) summary Osamu Tomita
2003-02-17 13:48 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (1/26) ALSA Osamu Tomita
2003-02-17 13:49 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (2/26) APM Osamu Tomita
2003-02-18 10:37   ` Christoph Hellwig
2003-02-17 13:51 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (3/26) mach-pc9800 Osamu Tomita
2003-02-17 14:48   ` Sam Ravnborg
2003-02-17 15:35     ` Osamu Tomita
2003-02-18 10:39   ` Christoph Hellwig
2003-02-17 13:54 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (4/26) boot Osamu Tomita
2003-02-17 13:56 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (5/26) char device Osamu Tomita
2003-02-18 10:45   ` Christoph Hellwig
2003-02-17 14:03 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (6/26) console Osamu Tomita
2003-02-17 14:06 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (7/26) misc core Osamu Tomita
2003-02-17 14:07 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (8/26) core Osamu Tomita
2003-02-17 14:58   ` Sam Ravnborg
2003-02-17 14:08 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (9/26) DMA Osamu Tomita
2003-02-17 14:09 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (10/26) floppy #1 Osamu Tomita
2003-02-17 14:09 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (11/26) floppy #2 Osamu Tomita
2003-02-17 14:10 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (12/26) FS Osamu Tomita
2003-02-17 14:11 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (13/26) IDE Osamu Tomita
2003-02-17 14:12 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (14/26) input Osamu Tomita
2003-03-14  8:22   ` Vojtech Pavlik
2003-03-15  6:09     ` Osamu Tomita
2003-03-15  8:01       ` Vojtech Pavlik
2003-02-17 14:13 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (15/26) kanji Osamu Tomita
2003-02-17 14:15 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (16/26) NIC Osamu Tomita
2003-02-17 17:02   ` Jeff Garzik
2003-02-17 18:06     ` Brian Gerst
2003-02-17 18:33       ` Jeff Garzik
2003-02-17 19:02       ` YOSHIFUJI Hideaki / 吉藤英明
2003-02-17 14:16 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (17/26) parport Osamu Tomita
2003-02-17 14:17 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (18/26) PCI Osamu Tomita
2003-02-17 14:18 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (19/26) PCI BIOS Osamu Tomita
2003-02-17 14:18 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (20/26) PCMCIA Osamu Tomita
2003-02-17 14:19 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (21/26) PNP Osamu Tomita
2003-02-17 14:20 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (22/26) reboot Osamu Tomita
2003-02-17 14:21 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (23/26) SCSI Osamu Tomita
2003-02-18 10:54   ` 'Christoph Hellwig' [this message]
2003-02-17 14:24 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (24/26) serial Osamu Tomita
2003-02-17 14:25 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (25/26) SMP Osamu Tomita
2003-02-17 14:26 ` [PATCHSET] PC-9800 subarch. support for 2.5.61 (26/26) video card Osamu Tomita
  -- strict thread matches above, loose matches on Subject: below --
2003-02-20  5:37 [PATCHSET] PC-9800 subarch. support for 2.5.61 (23/26) SCSI Osamu Tomita

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=20030218105455.D11969@infradead.org \
    --to=hch@infradead.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomita@cinet.co.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.