public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ondrej Zary <linux@zary.sk>
Cc: Rik Faith <faith@cs.unc.edu>,
	"David A . Hinds" <dahinds@users.sourceforge.net>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 1/4] fdomain: Resurrect driver (core)
Date: Tue, 23 Apr 2019 23:02:12 -0700	[thread overview]
Message-ID: <20190424060212.GA5506@infradead.org> (raw)
In-Reply-To: <20190422173323.15365-2-linux@zary.sk>

> +/* FIFO_COUNT: The host adapter has an 8K cache (host adapters based on the
> + * 18C30 chip have a 2k cache).  When this many 512 byte blocks are filled by
> + * the SCSI device, an interrupt will be raised.  Therefore, this could be as
> + * low as 0, or as high as 16.  Note, however, that values which are too high
> + * or too low seem to prevent any interrupts from occurring, and thereby lock
> + * up the machine.
> + */

Normally we use

/*
 * ...
 */

style comments.  I'm not sure it is worth bothering to change it in this
driver, though.

> +		cmd->SCp.ptr += len;
> +		cmd->SCp.this_residual -= len;
> +		if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) {
> +			--cmd->SCp.buffers_residual;
> +			++cmd->SCp.buffer;
> +			cmd->SCp.ptr = sg_virt(cmd->SCp.buffer);

This isn't safe on highmem systems.  At very least we need a depends on
!HIGHMEM for the drivers selecting this core driver.  If you feel like
doing the work it should use scsi_kmap_atomic_sg and
scsi_kunmap_atomic_sg.

> +static void fdomain_work(struct work_struct *work)
> +{
> +	struct fdomain *fd = container_of(work, struct fdomain, work);
> +	struct Scsi_Host *sh = container_of((void *)fd, struct Scsi_Host,
> +					    hostdata);

This looks odd.  We should never need a void cast for container_of.

> +	/* Abort calls fdomain_finish_cmd, so we do nothing here. */
> +	if (cmd->SCp.phase & aborted)
> +		;

This is a no-op..

> +	if (fd->chip == tmc1800 && !cmd->SCp.have_data_in
> +	    && (cmd->SCp.sent_command >= cmd->cmd_len)) {

&& goes on the first line, no need for the inner braces on the second
line.

> +int fdomain_host_reset(struct scsi_cmnd *cmd)

Should be static.

> +struct scsi_host_template fdomain_template = {

Should be marked const.

> +	if (fdomain_test_loopback(base))
> +		return NULL;
> +
> +	if (!irq) {
> +		if (dev_is_pci(dev)) {
> +			dev_err(dev, "PCI card has no IRQ assigned");
> +			return NULL;
> +		}
> +		irq = irqs[(inb(base + Configuration1) & 0x0e) >> 1];

The irqs lookup should probably go into the callers that need it.

> +	else if (sig && (sig->bios_major > 0) &&

No need for the inner braces.

> +EXPORT_SYMBOL(fdomain_create);

EXPORT_SYMBOL_GPL for internals like this and fdomain_destroy.

  reply	other threads:[~2019-04-24  6:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22 17:33 [RFC PATCH 0/4] fdomain: Resurrect driver (modular version) Ondrej Zary
2019-04-22 17:33 ` [RFC PATCH 1/4] fdomain: Resurrect driver (core) Ondrej Zary
2019-04-24  6:02   ` Christoph Hellwig [this message]
2019-04-28 19:52     ` Ondrej Zary
2019-04-29 11:51       ` Christoph Hellwig
2019-04-22 17:33 ` [RFC PATCH 2/4] fdomain: Resurrect driver (PCI support) Ondrej Zary
2019-04-24  6:02   ` Christoph Hellwig
2019-04-22 17:33 ` [RFC PATCH 3/4] fdomain: Resurrect driver (ISA support) Ondrej Zary
2019-04-22 17:33 ` [RFC PATCH 4/4] fdomain: Resurrect driver (PCMCIA support) Ondrej Zary

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=20190424060212.GA5506@infradead.org \
    --to=hch@infradead.org \
    --cc=dahinds@users.sourceforge.net \
    --cc=faith@cs.unc.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux@zary.sk \
    /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