public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Max Asbock <masbock@us.ibm.com>
To: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ibmasm: add missing pci_enable_device()
Date: Mon, 09 Aug 2004 10:18:45 -0700	[thread overview]
Message-ID: <1092071925.3711.17.camel@w-amax> (raw)
In-Reply-To: <200408041532.55146.bjorn.helgaas@hp.com>

I tested this on the hardware. It works fine.
Is there any reason we shouldn't use dev_err() for the pci_enable error
message like in the other messages?

regards,
max

On Wed, 2004-08-04 at 14:32, Bjorn Helgaas wrote:
> I don't have this hardware, so this has not been tested.
> 
> 
> Add pci_enable_device()/pci_disable_device().  In the past, drivers
> often worked without this, but it is now required in order to route
> PCI interrupts correctly.
> 
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
> 
> ===== drivers/misc/ibmasm/module.c 1.2 vs edited =====
> --- 1.2/drivers/misc/ibmasm/module.c	2004-05-14 06:00:50 -06:00
> +++ edited/drivers/misc/ibmasm/module.c	2004-08-04 13:15:46 -06:00
> @@ -62,10 +62,17 @@
>  	int result = -ENOMEM;
>  	struct service_processor *sp;
>  
> +	if (pci_enable_device(pdev)) {
> +		printk(KERN_ERR "%s: can't enable PCI device at %s\n",
> +			DRIVER_NAME, pci_name(pdev));
> +		return -ENODEV;
> +	}
> +
>  	sp = kmalloc(sizeof(struct service_processor), GFP_KERNEL);
>  	if (sp == NULL) {
>  		dev_err(&pdev->dev, "Failed to allocate memory\n");
> -		return result;
> +		result = -ENOMEM;
> +		goto error_kmalloc;
>  	}
>  	memset(sp, 0, sizeof(struct service_processor));
>  
> @@ -148,6 +155,8 @@
>  	ibmasm_event_buffer_exit(sp);
>  error_eventbuffer:
>  	kfree(sp);
> +error_kmalloc:
> +	pci_disable_device(pdev);
>  
>  	return result;
>  }
> @@ -166,6 +175,7 @@
>  	iounmap(sp->base_address);
>  	ibmasm_event_buffer_exit(sp);
>  	kfree(sp);
> +	pci_disable_device(pdev);
>  }
>  
>  static struct pci_device_id ibmasm_pci_table[] =
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
> 


  reply	other threads:[~2004-08-09 17:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-04 21:32 [PATCH] ibmasm: add missing pci_enable_device() Bjorn Helgaas
2004-08-09 17:18 ` Max Asbock [this message]
2004-08-09 17:28   ` Bjorn Helgaas
2004-08-09 22:27     ` Francois Romieu
     [not found] <200408242224.i7OMOs1H029517@hera.kernel.org>
2004-08-25  0:43 ` Jeff Garzik

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=1092071925.3711.17.camel@w-amax \
    --to=masbock@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=bjorn.helgaas@hp.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