mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
To: Jeremy Jackson <jerj@coplanar.net>
Cc: Torben Mathiasen <torben.mathiasen@hp.com>,
	linux-kernel@vger.kernel.org,
	linux-ide <linux-ide@vger.kernel.org>
Subject: Re: 2.4.23 IDE hang on boot with two single-channel controllers
Date: Wed, 18 Feb 2004 00:34:44 +0100	[thread overview]
Message-ID: <200402180034.44917.bzolnier@elka.pw.edu.pl> (raw)
In-Reply-To: <401538C6.5030609@coplanar.net>


[ I've just found it in my mail-archive :-). ]

On Monday 26 of January 2004 16:56, Jeremy Jackson wrote:
> Hi,

Hi,

> (watch crossposting when replying all)
>
> I'm hoping to reach the maintainer of the Linux IDE driver for the
> Compaq TriFlex controller.  I have a problem with this driver when used
> with a Compaq Armada 7730MT while docked in the base station.
>
> The driver appears to only support one triflex controller, due to a
> missing check (that other chipset drivers have) that should prevent it
> from registering a /proc interface more than once.  The result is that
> it hangs on boot in proc_ide_create() in an infinite loop.

Please send outputs of 'lspci' and 'dmesg' commands.

> triflex.c:
>
> static unsigned int __init init_chipset_triflex(struct pci_dev *dev,
>                  const char *name)
> {
> #ifdef CONFIG_PROC_FS
>          ide_pci_register_host_proc(&triflex_proc);
> #endif
>          return 0;
> }
>
> It also appears that triflex_get_info() doesn't support more that one
> controller.

Yep, that's true.

> I won't go into more detail until I can establish who might care :)

I might care ;-).

Does this patch fixes hang?
Does 'cat /proc/ide/triflex' produce sane output?

Cheers,
--bart

 linux-2.4.23-root/drivers/ide/pci/triflex.c |   41 +++++++++++++++++++---------
 linux-2.4.23-root/drivers/ide/pci/triflex.h |    5 ++-
 2 files changed, 32 insertions(+), 14 deletions(-)

diff -puN drivers/ide/pci/triflex.c~ide_triflex_proc_fix drivers/ide/pci/triflex.c
--- linux-2.4.23/drivers/ide/pci/triflex.c~ide_triflex_proc_fix	2004-02-17 23:40:34.324345576 +0100
+++ linux-2.4.23-root/drivers/ide/pci/triflex.c	2004-02-18 00:22:53.578320296 +0100
@@ -44,15 +44,17 @@
 #include "ide_modes.h"
 #include "triflex.h"
 
-static struct pci_dev *triflex_dev;
+#ifdef CONFIG_PROC_FS
+static u8 triflex_proc;
 
-static int triflex_get_info(char *buf, char **addr, off_t offset, int count)
-{
-	char *p = buf;
-	int len;
+#define TRIFLEX_MAX_DEVS	2
+static struct pci_dev *triflex_devs[TRIFLEX_MAX_DEVS];
+static unsigned int n_triflex_devs;
 
-	struct pci_dev *dev	= triflex_dev;
+static int triflex_info(char *buffer, struct pci_dev *dev)
+{
 	unsigned long bibma = pci_resource_start(dev, 4);
+	char *p = buffer;
 	u8  c0 = 0, c1 = 0;
 	u32 pri_timing, sec_timing;
 
@@ -87,11 +89,23 @@ static int triflex_get_info(char *buf, c
 	p += sprintf(p, "DMA\n");
 	p += sprintf(p, "PIO\n");
 
+	return p - buffer;
+}
+
+static int triflex_get_info(char *buf, char **addr, off_t offset, int count)
+{
+	char *p = buf;
+	unsigned int i, len;
+
+	for (i = 0; i < n_triflex_devs; i++)
+		buf += triflex_info(buf, triflex_devs[i]);
+
 	len = (p - buf) - offset;
 	*addr = buf + offset;
-	
+
 	return len > count ? count : len;
 }
+#endif
 
 static int triflex_tune_chipset(ide_drive_t *drive, u8 xferspeed)
 {
@@ -211,9 +225,13 @@ static unsigned int __init init_chipset_
 		const char *name) 
 {
 #ifdef CONFIG_PROC_FS
-	ide_pci_register_host_proc(&triflex_proc);
+	triflex_devs[n_triflex_devs++] = dev;
+	if (!triflex_proc) {
+		triflex_proc = 1;
+		ide_pci_register_host_proc(&triflex_procs);
+	}
 #endif
-	return 0;	
+	return 0;
 }
 
 static int __devinit triflex_init_one(struct pci_dev *dev, 
@@ -222,11 +240,10 @@ static int __devinit triflex_init_one(st
 	ide_pci_device_t *d = &triflex_devices[id->driver_data];
 	if (dev->device != d->device)
 		BUG();
-	
+
 	ide_setup_pci_device(dev, d);
-	triflex_dev = dev;
 	MOD_INC_USE_COUNT;
-	
+
 	return 0;
 }
 
diff -puN drivers/ide/pci/triflex.h~ide_triflex_proc_fix drivers/ide/pci/triflex.h
--- linux-2.4.23/drivers/ide/pci/triflex.h~ide_triflex_proc_fix	2004-02-17 23:58:11.698600256 +0100
+++ linux-2.4.23-root/drivers/ide/pci/triflex.h	2004-02-18 00:27:28.152578664 +0100
@@ -14,7 +14,6 @@
 
 static unsigned int __devinit init_chipset_triflex(struct pci_dev *, const char *);
 static void init_hwif_triflex(ide_hwif_t *);
-static int triflex_get_info(char *, char **, off_t, int);
 
 static ide_pci_device_t triflex_devices[] __devinitdata = {
 	{
@@ -34,7 +33,9 @@ static ide_pci_device_t triflex_devices[
 };
 
 #ifdef CONFIG_PROC_FS
-static ide_pci_host_proc_t triflex_proc __initdata = {
+static int triflex_get_info(char *, char **, off_t, int);
+
+static ide_pci_host_proc_t triflex_procs __initdata = {
 	.name		= "triflex",
 	.set		= 1,
 	.get_info 	= triflex_get_info,

_


  reply	other threads:[~2004-02-17 23:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-26 15:56 Jeremy Jackson
2004-02-17 23:34 ` Bartlomiej Zolnierkiewicz [this message]
2004-02-24 17:49   ` Jeremy Jackson
2004-07-31 14:37   ` Marcelo Tosatti
2004-07-31 15:37     ` Jeremy Jackson
  -- strict thread matches above, loose matches on Subject: below --
2004-01-26  0:42 Jeremy Jackson

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=200402180034.44917.bzolnier@elka.pw.edu.pl \
    --to=b.zolnierkiewicz@elka.pw.edu.pl \
    --cc=jerj@coplanar.net \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torben.mathiasen@hp.com \
    /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

all inboxes | Powered by JetHome®