public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: skinbits@substancia.com
To: linux-kernel@vger.kernel.org
Subject: scsi_unregister_device
Date: Wed, 13 Dec 2000 01:00:37 +0000	[thread overview]
Message-ID: <20001213010037.A2201@substancia.com> (raw)

Hello all,

As part of our final year project, we are implementing a network based on
SCSI to use as a cheap fast eth link. 

This module is made of two parts:

	-sn: A scsi device that talk with the scsi mid layer
	-scsinet: A network device driver that talks with sn.

We made a module based on code allready made for kernel 2.1.97, ported
it to 2.4.0test10, and put it as a module. The module allready loads,
both subsystems are initialized and the kernel dosen't crash :))

The problem happens when we try to load our module without a SCSI device
driver loaded (We use Symbios 53c8xx). When that happens, we register
sn with scsi_register_device, but when we try to init scsinet, it fails
(there are no devices to talk to, so it will fail). So, before our
module is unloaded, we try to unregister the sn device using
scsi_unregister_device. All is allright, the module get's out, but, the
usage count of the scsi_mod.o dosen't decrement. So it stays blocked in
the kernel and we can't unload it...

the relevant code is something like:

static int __init init_sc(void) 
{
	int ret;
	
	sn_template.module=THIS_MODULE;
	if ((ret=scsi_register_module(MODULE_SCSI_DEV,&sn_template))!=0)
		return ret;

	if ((ret=register_netdev(&scsinet_template)!=0) 
	{
		scsi_unregister_module(MODULE_SCSI_DEV,&sn_template);
		sn_template.dev_max=0;
		return ret;
	}

	return 0;
}

sn_template is the template for the scsi device, scsinet_template is the
template for a ehternet driver.

Anyone knows what we are doing wrong?

Pedro Semeano	
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

                 reply	other threads:[~2000-12-13  1:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20001213010037.A2201@substancia.com \
    --to=skinbits@substancia.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