[Xenomai-git] Anders Blomdell : analogy: [pcimio] fix wrong IRQ setup after reboot
Module: xenomai-abe Branch: experimental Commit: b8fa8d2d91c16af697a54bc7689369f24a0d4efb URL: http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=b8fa8d2d91c16af697a54bc7689369f24a0d4efb Author: Anders Blomdell Date: Tue Jun 28 23:56:27 2011 +0200 analogy: [pcimio] fix wrong IRQ setup after reboot --- ksrc/drivers/analogy/national_instruments/mite.c | 20 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ksrc/drivers/analogy/national_instruments/mite.c b/ksrc/drivers/analogy/national_instruments/mite.c index d3969b0..a28295a 100644 --- a/ksrc/drivers/analogy/national_instruments/mite.c +++ b/ksrc/drivers/analogy/national_instruments/mite.c @@ -61,7 +61,7 @@ static struct pci_device_id mite_id[] = { static int mite_probe(struct pci_dev *dev, const struct pci_device_id *id) { - int i; + int i, err = 0; struct mite_struct *mite; mite = kmalloc(sizeof(struct mite_struct), GFP_KERNEL); @@ -71,7 +71,13 @@ static int mite_probe(struct pci_dev *dev, const struct pci_device_id *id) memset(mite, 0, sizeof(struct mite_struct)); a4l_lock_init(&mite->lock); + mite->pcidev = dev; + if (pci_enable_device(dev) < 0) { + __a4l_err("error enabling mite\n"); + err = -EIO; + goto out; + } for(i = 0; i < MAX_MITE_DMA_CHANNELS; i++) { mite->channels[i].mite = mite; @@ -81,7 +87,11 @@ static int mite_probe(struct pci_dev *dev, const struct pci_device_id *id) list_add(&mite->list, &mite_devices); - return 0; +out: + if (err < 0) + kfree(mite); + + return err; } static void mite_remove(struct pci_dev *dev) @@ -117,11 +127,6 @@ int a4l_mite_setup(struct mite_struct *mite, int use_iodwbsr_1) __a4l_dbg(1, drv_dbg, "mite: starting setup...\n"); - if(pci_enable_device(mite->pcidev)){ - __a4l_err("error enabling mite\n"); - return -EIO; - } - pci_set_master(mite->pcidev); if (pci_request_regions( mite->pcidev, "mite")) { @@ -129,7 +134,6 @@ int a4l_mite_setup(struct mite_struct *mite, int use_iodwbsr_1) return -EIO; }; - /* The PCI BAR0 is the Mite */ addr = pci_resource_start(mite->pcidev, 0); length = pci_resource_len(mite->pcidev, 0); ___ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git
[Xenomai-git] Anders Blomdell : analogy: [pcimio] fix wrong IRQ setup after reboot
Module: xenomai-abe Branch: analogy Commit: 3826d3c9fffc4a7fba542b382b1cf9cf391d4e96 URL: http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=3826d3c9fffc4a7fba542b382b1cf9cf391d4e96 Author: Anders Blomdell Date: Tue Jun 28 23:56:27 2011 +0200 analogy: [pcimio] fix wrong IRQ setup after reboot --- ksrc/drivers/analogy/national_instruments/mite.c | 20 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ksrc/drivers/analogy/national_instruments/mite.c b/ksrc/drivers/analogy/national_instruments/mite.c index d3969b0..a28295a 100644 --- a/ksrc/drivers/analogy/national_instruments/mite.c +++ b/ksrc/drivers/analogy/national_instruments/mite.c @@ -61,7 +61,7 @@ static struct pci_device_id mite_id[] = { static int mite_probe(struct pci_dev *dev, const struct pci_device_id *id) { - int i; + int i, err = 0; struct mite_struct *mite; mite = kmalloc(sizeof(struct mite_struct), GFP_KERNEL); @@ -71,7 +71,13 @@ static int mite_probe(struct pci_dev *dev, const struct pci_device_id *id) memset(mite, 0, sizeof(struct mite_struct)); a4l_lock_init(&mite->lock); + mite->pcidev = dev; + if (pci_enable_device(dev) < 0) { + __a4l_err("error enabling mite\n"); + err = -EIO; + goto out; + } for(i = 0; i < MAX_MITE_DMA_CHANNELS; i++) { mite->channels[i].mite = mite; @@ -81,7 +87,11 @@ static int mite_probe(struct pci_dev *dev, const struct pci_device_id *id) list_add(&mite->list, &mite_devices); - return 0; +out: + if (err < 0) + kfree(mite); + + return err; } static void mite_remove(struct pci_dev *dev) @@ -117,11 +127,6 @@ int a4l_mite_setup(struct mite_struct *mite, int use_iodwbsr_1) __a4l_dbg(1, drv_dbg, "mite: starting setup...\n"); - if(pci_enable_device(mite->pcidev)){ - __a4l_err("error enabling mite\n"); - return -EIO; - } - pci_set_master(mite->pcidev); if (pci_request_regions( mite->pcidev, "mite")) { @@ -129,7 +134,6 @@ int a4l_mite_setup(struct mite_struct *mite, int use_iodwbsr_1) return -EIO; }; - /* The PCI BAR0 is the Mite */ addr = pci_resource_start(mite->pcidev, 0); length = pci_resource_len(mite->pcidev, 0); ___ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git
[Xenomai-git] Anders Blomdell : analogy: [pcimio] fix wrong IRQ setup after reboot
Module: xenomai-abe Branch: analogy Commit: 1d2d631a531568d3228ba6e642602f3d1cc10635 URL: http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=1d2d631a531568d3228ba6e642602f3d1cc10635 Author: Anders Blomdell Date: Tue Jun 28 23:56:27 2011 +0200 analogy: [pcimio] fix wrong IRQ setup after reboot --- ksrc/drivers/analogy/national_instruments/mite.c | 20 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ksrc/drivers/analogy/national_instruments/mite.c b/ksrc/drivers/analogy/national_instruments/mite.c index d3969b0..a28295a 100644 --- a/ksrc/drivers/analogy/national_instruments/mite.c +++ b/ksrc/drivers/analogy/national_instruments/mite.c @@ -61,7 +61,7 @@ static struct pci_device_id mite_id[] = { static int mite_probe(struct pci_dev *dev, const struct pci_device_id *id) { - int i; + int i, err = 0; struct mite_struct *mite; mite = kmalloc(sizeof(struct mite_struct), GFP_KERNEL); @@ -71,7 +71,13 @@ static int mite_probe(struct pci_dev *dev, const struct pci_device_id *id) memset(mite, 0, sizeof(struct mite_struct)); a4l_lock_init(&mite->lock); + mite->pcidev = dev; + if (pci_enable_device(dev) < 0) { + __a4l_err("error enabling mite\n"); + err = -EIO; + goto out; + } for(i = 0; i < MAX_MITE_DMA_CHANNELS; i++) { mite->channels[i].mite = mite; @@ -81,7 +87,11 @@ static int mite_probe(struct pci_dev *dev, const struct pci_device_id *id) list_add(&mite->list, &mite_devices); - return 0; +out: + if (err < 0) + kfree(mite); + + return err; } static void mite_remove(struct pci_dev *dev) @@ -117,11 +127,6 @@ int a4l_mite_setup(struct mite_struct *mite, int use_iodwbsr_1) __a4l_dbg(1, drv_dbg, "mite: starting setup...\n"); - if(pci_enable_device(mite->pcidev)){ - __a4l_err("error enabling mite\n"); - return -EIO; - } - pci_set_master(mite->pcidev); if (pci_request_regions( mite->pcidev, "mite")) { @@ -129,7 +134,6 @@ int a4l_mite_setup(struct mite_struct *mite, int use_iodwbsr_1) return -EIO; }; - /* The PCI BAR0 is the Mite */ addr = pci_resource_start(mite->pcidev, 0); length = pci_resource_len(mite->pcidev, 0); ___ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git
[Xenomai-git] Anders Blomdell : analogy: [pcimio] fix wrong IRQ setup after reboot
Module: xenomai-head Branch: master Commit: 1d2d631a531568d3228ba6e642602f3d1cc10635 URL: http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=1d2d631a531568d3228ba6e642602f3d1cc10635 Author: Anders Blomdell Date: Tue Jun 28 23:56:27 2011 +0200 analogy: [pcimio] fix wrong IRQ setup after reboot --- ksrc/drivers/analogy/national_instruments/mite.c | 20 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ksrc/drivers/analogy/national_instruments/mite.c b/ksrc/drivers/analogy/national_instruments/mite.c index d3969b0..a28295a 100644 --- a/ksrc/drivers/analogy/national_instruments/mite.c +++ b/ksrc/drivers/analogy/national_instruments/mite.c @@ -61,7 +61,7 @@ static struct pci_device_id mite_id[] = { static int mite_probe(struct pci_dev *dev, const struct pci_device_id *id) { - int i; + int i, err = 0; struct mite_struct *mite; mite = kmalloc(sizeof(struct mite_struct), GFP_KERNEL); @@ -71,7 +71,13 @@ static int mite_probe(struct pci_dev *dev, const struct pci_device_id *id) memset(mite, 0, sizeof(struct mite_struct)); a4l_lock_init(&mite->lock); + mite->pcidev = dev; + if (pci_enable_device(dev) < 0) { + __a4l_err("error enabling mite\n"); + err = -EIO; + goto out; + } for(i = 0; i < MAX_MITE_DMA_CHANNELS; i++) { mite->channels[i].mite = mite; @@ -81,7 +87,11 @@ static int mite_probe(struct pci_dev *dev, const struct pci_device_id *id) list_add(&mite->list, &mite_devices); - return 0; +out: + if (err < 0) + kfree(mite); + + return err; } static void mite_remove(struct pci_dev *dev) @@ -117,11 +127,6 @@ int a4l_mite_setup(struct mite_struct *mite, int use_iodwbsr_1) __a4l_dbg(1, drv_dbg, "mite: starting setup...\n"); - if(pci_enable_device(mite->pcidev)){ - __a4l_err("error enabling mite\n"); - return -EIO; - } - pci_set_master(mite->pcidev); if (pci_request_regions( mite->pcidev, "mite")) { @@ -129,7 +134,6 @@ int a4l_mite_setup(struct mite_struct *mite, int use_iodwbsr_1) return -EIO; }; - /* The PCI BAR0 is the Mite */ addr = pci_resource_start(mite->pcidev, 0); length = pci_resource_len(mite->pcidev, 0); ___ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git