public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Rolf Eike Beer <eike-kernel@sf-tec.de>
To: James Bottomley <James.Bottomley@hansenpartnership.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH 2/2] gdth: fix Error: Driver 'gdth' is already registered, aborting...
Date: Mon, 5 May 2008 11:24:06 +0200	[thread overview]
Message-ID: <200805051124.11940.eike-kernel@sf-tec.de> (raw)
In-Reply-To: <1209958558.16283.42.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1629 bytes --]

James Bottomley wrote:
> This message appears on modprobe/rmmod/modprobe of the driver.  It's
> caused because if the driver has no instances, it returns an error
> from gdth_init, which causes the module to fail to load.
> Unfortunately, the module's pci driver is still registered at this
> point.
>
> Fix this by making gdth behave like a modern driver and insert even if
> it doesn't find any instances (in case of hot plug or software driven
> binding).
>
> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
> ---
>  drivers/scsi/gdth.c |   13 ++++++++-----
>  1 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
> index 16785a2..46771d4 100644
> --- a/drivers/scsi/gdth.c
> +++ b/drivers/scsi/gdth.c
> @@ -550,7 +550,6 @@ static int __init gdth_search_isa(ulong32 bios_adr)
>  #endif /* CONFIG_ISA */
>
>  #ifdef CONFIG_PCI
> -static bool gdth_pci_registered;
>
>  static bool gdth_search_vortex(ushort device)
>  {
> @@ -5157,8 +5156,13 @@ static int __init gdth_init(void)
>
>  #ifdef CONFIG_PCI
>  	/* scanning for PCI controllers */
> -	if (pci_register_driver(&gdth_pci_driver) == 0)
> -		gdth_pci_registered = true;
> +	if (pci_register_driver(&gdth_pci_driver)) {
> +		gdth_ha_str *ha;
> +
> +		list_for_each_entry(ha, &gdth_instances, list)
> +			gdth_remove_one(ha);
> +		return -ENODEV;
> +	}
>  #endif /* CONFIG_PCI */
>
>  	TRACE2(("gdth_detect() %d controller detected\n", gdth_ctr_count));

Wouldn't it be better to return the error code that pci_register_driver() sent 
back?

Eike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

  reply	other threads:[~2008-05-05  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-05  3:35 [PATCH 2/2] gdth: fix Error: Driver 'gdth' is already registered, aborting James Bottomley
2008-05-05  9:24 ` Rolf Eike Beer [this message]
2008-05-05 14:17   ` James Bottomley

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=200805051124.11940.eike-kernel@sf-tec.de \
    --to=eike-kernel@sf-tec.de \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=linux-scsi@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