public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rolf Eike Beer <eike-kernel@sf-tec.de>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, R.E.Wolff@bitwizard.nl,
	support@specialix.co.uk
Subject: Re: [PATCH 1/5] Char: sx, convert to pci probing
Date: Mon, 23 Oct 2006 10:56:46 +0200	[thread overview]
Message-ID: <200610231056.47011.eike-kernel@sf-tec.de> (raw)
In-Reply-To: <651531477799512100@wsc.cz>

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

Jiri Slaby wrote:
> sx, convert to pci probing
>
> convert old pci code to pci probing.
>
> Cc: <R.E.Wolff@BitWizard.nl>
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
>
> ---
> commit 56b6b52313a48cbda4c84bd35252337063269d88
> tree 1f32778374ad0eb5d2671cc94674753d1198dbff
> parent d8e4a1a052b460b07936030bc99d8d9fe2b4bbf9
> author Jiri Slaby <jirislaby@gmail.com> Sun, 22 Oct 2006 01:51:54 +0200
> committer Jiri Slaby <jirislaby@gmail.com> Sun, 22 Oct 2006 01:51:54 +0200
>
>  drivers/char/sx.c |  183
> ++++++++++++++++++++++++++++++----------------------- 1 files changed, 105
> insertions(+), 78 deletions(-)
>
> diff --git a/drivers/char/sx.c b/drivers/char/sx.c
> index cf08be7..9b800bd 100644
> --- a/drivers/char/sx.c
> +++ b/drivers/char/sx.c
> @@ -246,14 +246,6 @@ #ifndef PCI_DEVICE_ID_SPECIALIX_SX_XIO_I
>  #define PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8 0x2000
>  #endif
>
> -#ifdef CONFIG_PCI
> -static struct pci_device_id sx_pci_tbl[] = {
> -	{ PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8,
> PCI_ANY_ID, PCI_ANY_ID }, -	{ 0 }
> -};
> -MODULE_DEVICE_TABLE(pci, sx_pci_tbl);
> -#endif /* CONFIG_PCI */
> -
>  /* Configurable options:
>     (Don't be too sure that it'll work if you toggle them) */
>
> @@ -2373,7 +2365,6 @@ static void __exit sx_release_drivers(vo
>  	func_exit();
>  }
>
> -#ifdef CONFIG_PCI
>   /********************************************************
>   * Setting bit 17 in the CNTRL register of the PLX 9050  *
>   * chip forces a retry on writes while a read is pending.*
> @@ -2404,22 +2395,112 @@ #define CNTRL_REG_GOODVALUE     0x182600
>  	}
>  	iounmap(rebase);
>  }
> -#endif
>
> +static int __devinit sx_pci_probe(struct pci_dev *pdev,
> +	const struct pci_device_id *ent)
> +{
> +	struct sx_board *board;
> +	unsigned int i;
> +	int retval = -EIO;
> +
> +	for (i = 0; i < SX_NBOARDS; i++)
> +		if (!(boards[i].flags & SX_BOARD_PRESENT))
> +			break;
> +
> +	if (i == SX_NBOARDS)
> +		goto err;
> +
> +	retval = pci_enable_device(pdev);
> +	if (retval)
> +		goto err;
> +
> +	board = &boards[i];

I'm rather sure you need some type of locking here.

> +
> +	board->flags &= ~SX_BOARD_TYPE;
> +	board->flags |= (pdev->subsystem_vendor == 0x200) ? SX_PCI_BOARD :
> +				SX_CFPCI_BOARD;
> +
> +	/* CF boards use base address 3.... */
> +	if (IS_CF_BOARD (board))
> +		board->hw_base = pci_resource_start(pdev, 3);
> +	else
> +		board->hw_base = pci_resource_start(pdev, 2);
> +	board->base2 =
> +	board->base = ioremap(board->hw_base, WINDOW_LEN (board));
> +	if (!board->base) {
> +		dev_err(&pdev->dev, "ioremap failed\n");
> +		goto err;
> +	}

pci_iomap() or something?

> +
> +	/* Most of the stuff on the CF board is offset by 0x18000 ....  */
> +	if (IS_CF_BOARD (board))
> +		board->base += 0x18000;
> +
> +	board->irq = pdev->irq;

Is this extra copy of the IRQ number needed?


> @@ -2585,6 +2611,7 @@ static void __exit sx_exit (void)
>  	struct sx_board *board;
>
>  	func_enter();
> +	pci_unregister_driver(&sx_pcidriver);
>  	for (i = 0; i < SX_NBOARDS; i++) {
>  		board = &boards[i];
>  		if (board->flags & SX_BOARD_INITIALIZED) {

Locking?

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2006-10-23  8:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-22  0:56 [PATCH 1/5] Char: sx, convert to pci probing Jiri Slaby
2006-10-23  8:56 ` Rolf Eike Beer [this message]
2006-10-23 10:55   ` Jiri Slaby

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=200610231056.47011.eike-kernel@sf-tec.de \
    --to=eike-kernel@sf-tec.de \
    --cc=R.E.Wolff@bitwizard.nl \
    --cc=akpm@osdl.org \
    --cc=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=support@specialix.co.uk \
    /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