public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	torvalds@osdl.org
Subject: Re: [ide] clean up error path in do_ide_setup_pci_device()
Date: Mon, 3 Jan 2005 23:22:37 +0100	[thread overview]
Message-ID: <58cb370e050103142269e1f67f@mail.gmail.com> (raw)
In-Reply-To: <1104773262.13302.3.camel@localhost.localdomain>

On Mon, 03 Jan 2005 18:42:26 +0000, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> This changeset will break support for several systems because the PCI
> IDE controller uses some BARs on a multifunction PCI northbridge. The
> old IDE code was extremely careful *NOT* to play pci_disable_device
> games because of this.

Well, I supposed something like this but since pci_disable_device()
is called *only* in error paths I decided to take the risk. ;-)

> Nothing in the IDE specification requires the PCI IDE controller be the
> only use of that PCI function. The damage is probably minimal as it
> deals with error paths but this change should be reverted (and will be
> for -ac).

Different PCI functions should have different struct pci_dev instances
so is this really a problem?

> On Iau, 2004-12-30 at 19:08, Linux Kernel Mailing List wrote:
> > ChangeSet 1.2034.118.8, 2004/12/30 20:08:53+01:00, bzolnier@trik.(none)
> >
> >       [ide] clean up error path in do_ide_setup_pci_device()
> >
> >       ide_setup_pci_controller() puts the device in a PCI enabled state.
> >       The patch adds a small helper to balance it when things go wrong.
> >
> >       Actually the helper does not *exactly* balance the setup: if it can
> >       not do a better job, ide_setup_pci_controller() may only enable some
> >       BARS whereas the new counterpart will try to disable everything.
> >
> >       Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
> >       Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> >
> >
> >
> >  setup-pci.c |   15 +++++++++++++--
> >  1 files changed, 13 insertions(+), 2 deletions(-)
> >
> >
> > diff -Nru a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
> > --- a/drivers/ide/setup-pci.c 2004-12-30 19:44:05 -08:00
> > +++ b/drivers/ide/setup-pci.c 2004-12-30 19:44:05 -08:00
> > @@ -542,6 +542,13 @@
> >       return 0;
> >  }
> >
> > +static void ide_release_pci_controller(struct pci_dev *dev, ide_pci_device_t *d,
> > +                                    int noisy)
> > +{
> > +     /* Balance ide_pci_enable() */
> > +     pci_disable_device(dev);
> > +}
> > +
> >  /**
> >   *   ide_pci_setup_ports     -       configure ports/devices on PCI IDE
> >   *   @dev: PCI device
> > @@ -672,7 +679,7 @@
> >                */
> >               ret = d->init_chipset ? d->init_chipset(dev, d->name) : 0;
> >               if (ret < 0)
> > -                     goto out;
> > +                     goto err_release_pci_controller;
> >               pciirq = ret;
> >       } else if (tried_config) {
> >               if (noisy)
> > @@ -687,7 +694,7 @@
> >               if (d->init_chipset) {
> >                       ret = d->init_chipset(dev, d->name);
> >                       if (ret < 0)
> > -                             goto out;
> > +                             goto err_release_pci_controller;
> >               }
> >               if (noisy)
> >  #ifdef __sparc__
> > @@ -705,6 +712,10 @@
> >       ide_pci_setup_ports(dev, d, pciirq, index);
> >  out:
> >       return ret;
> > +
> > +err_release_pci_controller:
> > +     ide_release_pci_controller(dev, d, noisy);
> > +     goto out;
> >  }
> >
> >  int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)

  reply	other threads:[~2005-01-03 22:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200412310343.iBV3hqvd015595@hera.kernel.org>
2005-01-03 18:42 ` [ide] clean up error path in do_ide_setup_pci_device() Alan Cox
2005-01-03 22:22   ` Bartlomiej Zolnierkiewicz [this message]
2005-01-03 21:44     ` Alan Cox
2005-01-04  0:14       ` Francois Romieu
2005-01-04 22:02         ` Alan Cox
2005-01-07  2:20           ` Bartlomiej Zolnierkiewicz

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=58cb370e050103142269e1f67f@mail.gmail.com \
    --to=bzolnier@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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